mysterious variables

I’m writing a tool with Java to extract slices from a 3D dataset and I’m using vectors and planes to detect the edges of the slice.
In the Panda3D library there is a function intersectsPlane() from src/mathutil/plane_src.cxx
Therein the variable _v is used but I’m unable to find out what type it is and where it comes from.
I assume it is a private variable because of the underscore but I’m completely lost in the sourcecode atm.

I hope someone knows what it is :slight_smile:

_v is inherited from the base class, LVecBase4. It is defined as a union to get around some compiler optimization issues with VC7, but it amounts to a float[4].

David

Do you also know what is contained in it because I would like to use the algorithm in intersectsPlane.

It is the four coefficients A, B, C, D of the plane equation: Ax + By + Cz + D = 0. By the nature of the plane equation, the first three components (A, B, C) happen to define the surface normal of the plane, while the last component D is proportional to the distance along the surface normal at which the plane lies from the origin.

There are several good mathematics books directed at computer game and 3-D programming; most of them include some discussion of planes and the various ways to define them.

David