// x0 is the point and x1-x2-x3-x4 is the tetrahedron. Order is irrelevant. bool point_tetrahedron_intersection(const Vec3d& x0, unsigned int index0, const Vec3d& x1, unsigned int index1, const Vec3d& x2, unsigned int index2, const Vec3d& x3, unsigned int index3, const Vec3d& x4, unsigned int index4) { double bary[5]; return simplex_intersection3d( 1, x0.v, x1.v, x2.v, x3.v, x4.v, &bary[0], &bary[1], &bary[2], &bary[3], &bary[4] ); }
// x0 is the point and x1-x2-x3-x4 is the tetrahedron. Order is irrelevant. bool point_tetrahedron_intersection(const Vec3d& x0, size_t /*index0*/, const Vec3d& x1, size_t /*index1*/, const Vec3d& x2, size_t /*index2*/, const Vec3d& x3, size_t /*index3*/, const Vec3d& x4, size_t /*index4*/) { double bary[5]; return simplex_intersection3d( 1, x0.v, x1.v, x2.v, x3.v, x4.v, &bary[0], &bary[1], &bary[2], &bary[3], &bary[4] ); }
// x0-x1 is the segment and and x2-x3-x4 is the triangle. bool segment_triangle_intersection(const Vec3d& x0, unsigned int index0, const Vec3d& x1, unsigned int index1, const Vec3d& x2, unsigned int index2, const Vec3d& x3, unsigned int index3, const Vec3d& x4, unsigned int index4, bool degenerate_counts_as_intersection, bool verbose ) { double bary[5]; return simplex_intersection3d( 2, x0.v, x1.v, x2.v, x3.v, x4.v, &bary[0], &bary[1], &bary[2], &bary[3], &bary[4] ); }
bool segment_triangle_intersection(const Vec3d& x0, size_t /*index0*/, const Vec3d& x1, size_t /*index1*/, const Vec3d& x2, size_t /*index2*/, const Vec3d& x3, size_t /*index3*/, const Vec3d& x4, size_t /*index4*/, double& bary0, double& bary1, double& bary2, double& bary3, double& bary4, bool /*degenerate_counts_as_intersection*/, bool /*verbose*/ ) { return simplex_intersection3d( 2, x0.v, x1.v, x2.v, x3.v, x4.v, &bary0, &bary1, &bary2, &bary3, &bary4 ); }
// x0-x1 is the segment and and x2-x3-x4 is the triangle. bool segment_triangle_intersection(const Vec3d& x0, size_t /*index0*/, const Vec3d& x1, size_t /*index1*/, const Vec3d& x2, size_t /*index2*/, const Vec3d& x3, size_t /*index3*/, const Vec3d& x4, size_t /*index4*/, bool /*degenerate_counts_as_intersection*/, bool /*verbose*/ ) { double bary[5]; return simplex_intersection3d( 2, x0.v, x1.v, x2.v, x3.v, x4.v, &bary[0], &bary[1], &bary[2], &bary[3], &bary[4] ); }