Edge Intersection with C++
← Iso Line Edge Intersection | ● | Marching Triangles Algorithm →
With C++ we use a class which encapsulates the x-,y-, and z-component of a 3D vector. The header of that vector class is part of the frame work. It represents 3D vectors as C++ object via a header-only implementation (v3d.h):
The vector header provides overloaded vector operators +, - and *. For example the addition of two vectors c=a+b is written as:
v3d c = a+b;
For that to work the +-operator is overloaded as follows:
{return(v3d(a.x+b.x, a.y+b.y, a.z+b.z));}
With that vector class 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 →