// clip this line segment against this triangle. bool clip(const Vector3d &start,Vector3d &end) const { Vector3d sect; bool hit = lineIntersectsTriangle(start.Ptr(), end.Ptr(), mP1.Ptr(), mP2.Ptr(), mP3.Ptr(), sect.Ptr() ); if ( hit ) { end = sect; } return hit; }
void addTri(VertexLookup vl,UintVector &list,const Vector3d &p1,const Vector3d &p2,const Vector3d &p3) { unsigned int i1 = Vl_getIndex(vl, p1.Ptr() ); unsigned int i2 = Vl_getIndex(vl, p2.Ptr() ); unsigned int i3 = Vl_getIndex(vl, p3.Ptr() ); // do *not* process degenerate triangles! if ( i1 != i2 && i1 != i3 && i2 != i3 ) { list.push_back(i1); list.push_back(i2); list.push_back(i3); } }
float raySect(const Vector3d &p,const Vector3d &dir,Vector3d §) const { float plane[4]; plane[0] = mNormal.x; plane[1] = mNormal.y; plane[2] = mNormal.z; plane[3] = mPlaneD; Vector3d dest = p+dir*100000; intersect( p.Ptr(), dest.Ptr(), sect.Ptr(), plane ); return sect.Distance(p); // return the intersection distance. }
float planeDistance(const Vector3d &p) const { float plane[4]; plane[0] = mNormal.x; plane[1] = mNormal.y; plane[2] = mNormal.z; plane[3] = mPlaneD; return DistToPt( p.Ptr(), plane ); }