|
 |
While playing with the Spline_Trans macro from transforms.inc in my text layout
tests I ran into an issue when the spline I was using hand segments that aligned
with the Sky axis.
The problem is that Spline_Trans computes Forward and then determines the
"right" vector using VPerp_To_Plane(Sky,Forward). VPerp_To_Plane calls
vnormalize(vcross(V1,V2)), and vnormalize barfs on a zero-length vector, which
is what happens if V1 and V2 are co-linear.
I have created a new version that I am now using that checks for this
possibility when computing the Right axis. If the Forward is co-linear with
Sky, then the right vector can be any arbitrary vector that is perpendicular to
the Sky vector, so I compute the transformation from the "y" vector <0,1,0>, to
the given Sky vector, and apply the same transformation to the "x" vector
<1,0,0> and use that as Right. Otherwise, I just use VPerp_To_Plane as before.
The choice of x is arbitrary, but the easiest to implement since Spline_Trans
has an assumption that the forward direction of the object being transformed is
on the z axis.
-- Chris R.
Post a reply to this message
|
 |