49 template < index_t DIMENSION >
52 for(
auto i :
range( DIMENSION ) )
60 template < index_t DIMENSION >
66 template < index_t DIMENSION >
71 return length( v2 - v1 ) < epsilon;
84 template <
typename T >
92 template < index_t DIMENSION >
96 template < index_t DIMENSION >
101 : p0( std::move( p0 ) ), p1( std::move( p1 ) )
110 return normalize(
p1 -
p0 );
114 return (
p1 +
p0 ) / 2.;
118 return (
p1 -
p0 ).length();
125 template < index_t DIMENSION >
130 : origin( std::move( origin ) ),
131 direction( normalize( direction ) )
147 : normal( normalize( normal ) ), origin( std::move( origin ) )
152 double plane_constant{ 0.0 };
153 for(
auto i :
range( 3 ) )
155 plane_constant -= origin[i] * normal[i];
157 return plane_constant;
163 template < index_t DIMENSION >
170 : p0( std::move( p0 ) ),
171 p1( std::move( p1 ) ),
172 p2( std::move( p2 ) )
184 : p0( std::move( p0 ) ),
185 p1( std::move( p1 ) ),
186 p2( std::move( p2 ) )
191 return { cross(
p1 -
p0, p2 -
p0 ),
p0 };
203 : p0( std::move( p0 ) ),
204 p1( std::move( p1 ) ),
205 p2( std::move( p2 ) ),
206 p3( std::move( p3 ) )
219 : origin( std::move( origin ) ), radius( std::move( radius ) )
232 : plane( std::move( plane ) ), radius( std::move( radius ) )
250 template < index_t DIMENSION >
261 template < index_t DIMENSION >
284 namespace Intersection
292 std::tuple< bool, vec3 > RINGMESH_API
line_plane(
301 std::tuple< bool, std::vector< vec3 > > RINGMESH_API
line_sphere(
310 std::tuple< bool, std::vector< vec3 > > RINGMESH_API
segment_sphere(
311 const Geometry::Segment3D& segment,
330 const Geometry::Segment3D& segment,
331 const Geometry::Triangle3D& triangle );
339 std::tuple< bool, std::vector< vec3 > > RINGMESH_API
circle_plane(
358 const Geometry::Triangle3D& triangle,
367 std::tuple< bool, Geometry::Line3D > RINGMESH_API
plane_plane(
376 std::tuple< bool, vec2 > RINGMESH_API
line_line(
377 const Geometry::Line2D& line0,
const Geometry::Line2D& line1 );
386 const Geometry::Segment2D& segment0,
387 const Geometry::Segment2D& segment1 );
396 const Geometry::Segment2D& segment,
const Geometry::Line2D& line );
406 const Geometry::Segment3D& segment );
413 template < index_t DIMENSION >
428 const Geometry::Segment2D& segment );
441 const vec3& triangle_normal );
452 template < index_t DIMENSION >
470 std::tuple< bool, std::array< double, 4 > >
488 std::tuple< bool, std::array< double, 3 > >
503 std::tuple< bool, std::array< double, 3 > >
523 const vec3& origin,
const vec3& axis,
double theta,
bool degrees );
std::tuple< bool, vecn< DIMENSION > > point_segment_projection(const vecn< DIMENSION > &p, const vecn< DIMENSION > &p0, const vecn< DIMENSION > &p1)
GEO::vecng< DIMENSION, double > vecn
std::tuple< double, vec3 > RINGMESH_API point_to_tetra(const Geometry::Point3D &point, const Geometry::Tetra &tetra)
Plane(const vec3 &normal, vec3 origin)
std::tuple< double, vecn< DIMENSION > > point_to_triangle(const Geometry::Point< DIMENSION > &point, const Geometry::Triangle< DIMENSION > &triangle)
Line(Segment< DIMENSION > segment)
Sphere(vec3 origin, double radius)
double RINGMESH_API triangle_signed_area(const vec3 &p0, const vec3 &p1, const vec3 &p2, const vec3 &triangle_normal)
double RINGMESH_API dot_perp(const vec2 &v0, const vec2 &v1)
bool RINGMESH_API point_inside_segment(const Geometry::Point3D &point, const Geometry::Segment3D &segment)
Tests if a point is on a segment.
Tetra(vec3 p0, vec3 p1, vec3 p2, vec3 p3)
std::tuple< bool, std::array< double, 4 > > RINGMESH_API tetra_barycentric_coordinates(const vec3 &p, const vec3 &p0, const vec3 &p1, const vec3 &p2, const vec3 &p3)
bool operator==(const vecn< DIMENSION > &u, const vecn< DIMENSION > &v)
bool operator!=(const vecn< DIMENSION > &u, const vecn< DIMENSION > &v)
std::tuple< bool, std::array< double, 3 > > RINGMESH_API triangle_barycentric_coordinates(const vec3 &p, const vec3 &p0, const vec3 &p1, const vec3 &p2)
Triangle(vecn< DIMENSION > p0, vecn< DIMENSION > p1, vecn< DIMENSION > p2)
std::tuple< bool, vec3 > RINGMESH_API segment_disk(const Geometry::Segment3D &segment, const Geometry::Disk &disk)
std::tuple< bool, vec2 > RINGMESH_API segment_line(const Geometry::Segment2D &segment, const Geometry::Line2D &line)
std::tuple< bool, Geometry::Line3D > RINGMESH_API plane_plane(const Geometry::Plane &plane0, const Geometry::Plane &plane1)
GEO::Matrix< 4, double > RINGMESH_API rotation_matrix_about_arbitrary_axis(const vec3 &origin, const vec3 &axis, double theta, bool degrees)
Builds a rotational matrix about an arbitrary axis.
Line(const vecn< DIMENSION > &direction, vecn< DIMENSION > origin)
std::tuple< bool, std::vector< vec3 > > RINGMESH_API line_sphere(const Geometry::Line3D &line, const Geometry::Sphere &sphere)
Triangle(vec3 p0, vec3 p1, vec3 p2)
Sign RINGMESH_API point_side_to_segment(const Geometry::Point2D &point, const Geometry::Segment2D &segment)
std::tuple< bool, std::vector< vec3 > > RINGMESH_API triangle_circle(const Geometry::Triangle3D &triangle, const Geometry::Circle &circle)
std::tuple< double, vec3 > RINGMESH_API point_to_plane(const Geometry::Point3D &point, const Geometry::Plane &plane)
Sign RINGMESH_API point_side_to_plane(const Geometry::Point3D &point, const Geometry::Plane &plane)
std::tuple< bool, vec3 > RINGMESH_API segment_plane(const Geometry::Segment3D &segment, const Geometry::Plane &plane)
vecn< DIMENSION > direction() const
std::tuple< bool, std::vector< vec3 > > RINGMESH_API segment_sphere(const Geometry::Segment3D &segment, const Geometry::Sphere &sphere)
std::tuple< bool, vec3 > RINGMESH_API segment_triangle(const Geometry::Segment3D &segment, const Geometry::Triangle3D &triangle)
double plane_constant() const
bool point_inside_triangle(const Geometry::Point< DIMENSION > &point, const Geometry::Triangle< DIMENSION > &triangle)
Tests if a point is inside a triangle.
std::tuple< bool, vec2 > RINGMESH_API line_line(const Geometry::Line2D &line0, const Geometry::Line2D &line1)
std::tuple< bool, vec2 > RINGMESH_API segment_segment(const Geometry::Segment2D &segment0, const Geometry::Segment2D &segment1)
vecn< DIMENSION > barycenter() const
Circle(Plane plane, double radius)
Classes to build GeoModel from various inputs.
std::tuple< bool, vec3 > RINGMESH_API line_plane(const Geometry::Line3D &line, const Geometry::Plane &plane)
Segment(vecn< DIMENSION > p0, vecn< DIMENSION > p1)
std::tuple< bool, std::vector< vec3 > > RINGMESH_API circle_plane(const Geometry::Circle &circle, const Geometry::Plane &plane)
bool RINGMESH_API point_inside_tetra(const Geometry::Point3D &point, const Geometry::Tetra &tetra)
bool inexact_equal(const vecn< DIMENSION > &v1, const vecn< DIMENSION > &v2, double epsilon)
std::tuple< double, vecn< DIMENSION > > point_to_segment(const Geometry::Point< DIMENSION > &point, const Geometry::Segment< DIMENSION > &segment)