40#ifndef GEOGRAM_MESH_MESH_SURFACE_INTERSECTION_INTERNAL
41#define GEOGRAM_MESH_MESH_SURFACE_INTERSECTION_INTERNAL
58 class MeshSurfaceIntersection;
114 UNINITIALIZED, MESH_VERTEX, PRIMARY_ISECT, SECONDARY_ISECT
145 type = PRIMARY_ISECT;
159 type = SECONDARY_ISECT;
169 type = UNINITIALIZED;
172 mesh_vertex_index =
index_t(-1);
188 void print(std::ostream& out=std::cerr)
const;
196 std::ostringstream out;
201 vec2 get_UV_approx()
const {
202 double u = point_exact[mit->u_].estimate();
203 double v = point_exact[mit->v_].estimate();
204 double w = point_exact.w.
estimate();
205 return vec2(u/w,v/w);
223 mesh_vertex_index =
index_t(-1);
276 approx_incircle_ = x;
318 return vec3(
mesh().vertices.point_ptr(v));
323 return mesh_vertex(v);
328 return vec2(p[u_], p[v_]);
333 return mesh_vertex_UV(v);
343 void log_err()
const {
344 std::cerr <<
"Houston, we got a problem (while remeshing facet "
345 << f1_ <<
"):" << std::endl;
419 void save(
const std::string& filename)
const override;
432 bool has_planar_isect_;
433 bool approx_incircle_;
455 std::swap(A_rgn_f1, A_rgn_f2);
458 std::swap(B_rgn_f1, B_rgn_f2);
468 A_rgn_f1 == B_rgn_f1 &&
469 A_rgn_f2 == B_rgn_f2 ;
Simple constained Delaunay triangulation in 2D.
#define geo_assert(x)
Verifies that a condition is met.
Common include file, providing basic definitions. Should be included before anything else by all head...
Base class for constrained Delaunay triangulation.
virtual void clear()
Removes everything from this triangulation.
index_t vertex(index_t f, index_t lv) const
Gets a vertex by facet and local vertex index.
A vertex of the triangulation.
void init_geometry(const vec3HE &P)
Optimizes exact numbers in generated points and computes approximate coordinates.
Vertex(MeshInTriangle *M, index_t f1, index_t f2, TriangleRegion R1, TriangleRegion R2)
Constructor for intersections with other facets.
void init_sym(index_t f1, index_t f2, TriangleRegion R1, TriangleRegion R2)
Initializes the symbolic information of this Vertex.
std::string to_string() const
Gets a string representation of this Vertex.
Vertex(MeshInTriangle *M, const vec3HE &point_exact_in)
Constructor for intersections between constraints.
vec3HE compute_geometry()
Gets the geometry of this vertex.
const Mesh & mesh() const
Gets the mesh.
void print(std::ostream &out=std::cerr) const
Prints this vertex.
Vertex()
Default constructor.
Vertex(MeshInTriangle *M, index_t f, index_t lv)
Constructor for macro-triangle vertices.
Meshes a single triangle with the constraints that come from the intersections with the other triangl...
index_t create_intersection(index_t e1, index_t i, index_t j, index_t e2, index_t k, index_t l) override
Given two segments that have an intersection, create the intersection.
Sign incircle(index_t v1, index_t v2, index_t v3, index_t v4) const override
Tests the relative position of a point with respect to the circumscribed circle of a triangle.
Sign orient2d(index_t v1, index_t v2, index_t v3) const override
Tests the orientation of three vertices.
void clear() override
Removes everything from this triangulation.
void get_edge_edge_intersection(index_t e1, index_t e2, vec3HE &I) const
Computes the intersection between two edges.
const Mesh & mesh() const
Gets the readonly initial mesh.
void save_constraints(const std::string &filename)
For debugging, save constraints to a file.
void set_approx_incircle(bool x)
If Delaunay is set, use approximated incircle predicate (default: use exact incircle)
void get_edge_edge_intersection_2D(index_t e1, index_t e2, vec3HE &I) const
Auxilliary function used by get_edge_edge_intersection() for the special case when the two edges are ...
Mesh & target_mesh()
Gets the target mesh.
void save(const std::string &filename) const override
Saves this CDT to a geogram mesh file.
void commit()
Creates new vertices and new triangles in target mesh.
void get_constraints(Mesh &M, bool with_edges=true) const
For debugging, copies the constraints to a mesh.
Computes surface intersections.
Mesh & target_mesh()
Gets the target mesh.
const double * point_ptr(index_t v) const
Gets a point.
double estimate() const
Computes an approximation of the stored value in this expansion.
Vector with aligned memory allocation.
Exact predicates and constructs.
The class that represents a mesh.
Functions to load and save meshes.
Functions for computing intersections between surfacic meshes and boolean operations.
Global Vorpaline namespace.
TriangleRegion
Encodes the location of a point within a triangle.
TriangleRegion swap_T1_T2(TriangleRegion R)
Replaces T1 with T2 or T2 with T1 in a region code.
vecng< 3, Numeric::float64 > vec3
Represents points and vectors in 3d.
bool mesh_save(const Mesh &M, const std::string &filename, const MeshIOFlags &ioflags=MeshIOFlags())
Saves a mesh to a file.
geo_index_t index_t
The type for storing and manipulating indices.
Sign
Integer constants that represent the sign of a value.
vecng< 2, Numeric::float64 > vec2
Represents points and vectors in 2d.
geo_coord_index_t coord_index_t
The type for storing coordinate indices, and iterating on the coordinates of a point.
Stores information about a triangle-triangle intersection.
bool is_point() const
Tests whether intersection is just a point.
3D vector in homogeneous coordinates with coordinates as arithmetic expansions.
Symbolic computation of triangle-triangle intersection.