(L) [2014/02/26] [tby spectral] [Curve bounding box - fast computation] Wayback!Hi all,
I'm currently looking for an approach to compute the bounding box of a cardinal curve (I use cardinal because the curve pass through the control points), in 2D !
You can look here for more explanations about the problem, and all the math stuffs : [LINK http://math.stackexchange.com/questions/691018/cardinal-curve-computing-the-bounding-boxe]
The problem is that I have write a "processing" program to draw the curve and the bounding box. But it does not gives the desired result... !
I attach the "processing" code if you are interested.
Any idea ?
Thx
(L) [2014/02/26] [tby darkhorse64] [Curve bounding box - fast computation] Wayback!Quite simply
Code: [LINK # Select all]// The transformation matrix you need - Matrix4 is a 4x4 matrix
Matrix4 fromCatmullRom = Matrix4( -1, 3, -3, 1, 3, -6, 3, 0, -3, 3, 0, 0, 1, 0, 0, 0 ).inverse() // to bezier space
* Matrix4( -1, 3, -3, 1, 2, -5, 4, -1, -1, 0, 1, 0, 0, 2, 0, 0 ) / 2; // from catmull-rom space
For each component (x, y, z) of your control points, do
Code: [LINK # Select all]Vector4 oldControlPoints// = {x0, x1, x2, x3};
Vector4 newControlPoints = fromCatmullRom * oldControlPoints; // matrix - vector multiply
For detailed explanations, look at [LINK http://therndguy.com/papers/curves.pdf]
(L) [2014/02/26] [tby spectral] [Curve bounding box - fast computation] Wayback!I have try using the following formulas : [LINK http://www.ibiblio.org/e-notes/Splines/Cardinal.htm]
It seems to work, and so quick to compute... but the problem is that it is not really the minimum bounding box !
BTW, I will look at your paper right now... thanks