|
 |
"Bald Eagle" <cre### [at] netscape net> wrote:
I have a functional, if not yet rigorous understanding about the ray-radius
intersection test(s). I am hoping to understand it completely enough to make
one of my explanatory diagrams.
> immediately following that, I have a comparison of the length of the ray
> direction vector D with some variable "a", which due to poor source code
> documentation, I have no idea what "a" exactly is, or why if they are equal that
> r0 has to get divided by the sqrt of a.
>
> #if ((a = Dx * D.x + D.z * D.z) > 0.0)
> #local r0 = r0/sqrt(a);
> #end
I believe I see what's going on here.
in c++, == is a comparison.
= is an assignment.
So the #if line is simultaneously assigning the evaluation of the expression to
a, and then comparing it's value to 0.0.
> I also have Entry->A (through D) which I need to figure out.
This has to do with the arrow operator, or "Class Member Access Operator".
In sor.h, we have
struct Sor_Spline_Entry_Struct final
{
DBL A, B, C, D;
};
and
struct Sor_Spline_Struct final
{
int References;
SOR_SPLINE_ENTRY *Entry;
BCYL *BCyl; /* bounding cylinder. */
};
So "Entry" is a pointer to SOR_SPLINE_ENTRY, which has class members A through
D.
"Entry->A" is a whole identifier, which snakes through the 2 structs to identify
and use A.
and
class Sor final : public ObjectBase
{
public:
int Number;
SOR_SPLINE *Spline; /* List of spline segments */
.... etc.
So A through D have something to do with the spline segments.
I just don't "see" where they come from or what their exact meaning is.
Perhaps somewhere else farther upstream in the code is a place where the control
points get grouped in sets of 4, and so A through D would be sets of control
points.
- BW
Post a reply to this message
|
 |