POV-Ray : Newsgroups : povray.programming : cones.cpp: A typo and a question. : Re: cones.cpp: A typo and a question. Server Time
28 Jul 2024 06:19:11 EDT (-0400)
  Re: cones.cpp: A typo and a question.  
From: Massimo Valentini
Date: 8 Oct 2002 06:45:19
Message: <3da2b73f$1@news.povray.org>
"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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.