## Edge Intersection with C++

‹ Iso Line Edge Intersection | ● | Marching Triangles Algorithm ›

With C++ we use the v3d.h vector header as part of the frame work to represent 3D vectors as C++ object.

The vector header also provides overloaded vector operators +, - and *. For example the addition of two vectors c=a+b is written as:

v3d c=a+b;

The intersection point of an iso line for the iso value v with an edge given by the endpoints x1 and x2 and the respective scalar values s1 and s2 is written as follows:

double s1,s2;

double w = (v-s1)/(s2-s1);

v3d p = (1-w)*x1 + w*x2;

‹ Iso Line Edge Intersection | ● | Marching Triangles Algorithm ›