|
![](/i/fill.gif) |
"Massimo Valentini" ha scritto
: I try to show what I mean. You are first scaling the direction
:
: <CODE src=cones.cpp lines=197-200>
: MInvTransDirection(D, Ray->Direction, Cone->Trans);
:
: VLength(len, D);
: VInverseScaleEq(D, len);
: </CODE>
:
: This last line is a macro for a vector/scalar division:
: D = D / len
:
: Doing so results in a scaling of the coefficients (a & b)
: of the 2nd order equation you are going to solve:
:
: <CODE src=cones.cpp lines=206-213>
: a = D[X] * D[X] + D[Y] * D[Y];
:
: if (a > EPSILON)
: {
This solution is not equivalent to the original code.
This condition is different whether you scale the direction
or not. May be there could be a way to avoid the square root (e.g.
expressing this condition if (a > EPSILON*len^2)) but it'd require
some work analyzing the code for both cones and cylinders.
So you may either remove the condition for intersctions over
Max_Distance, or shift the divisions t1,2/len before the test against
Max_Distance.
Massimo
Post a reply to this message
|
![](/i/fill.gif) |