1 #ifndef __P2TC_REFINE_MESH_H__
2 #define __P2TC_REFINE_MESH_H__
7 #include "triangulation.h"
11 P2trHashSet *triangles;
17 gboolean _is_clearing_now;
20 P2trMesh* p2tr_mesh_new (void);
22 P2trPoint* p2tr_mesh_new_point (P2trMesh *mesh,
23 const P2trVector2 *c);
25 P2trPoint* p2tr_mesh_new_point2 (P2trMesh *mesh,
29 P2trEdge* p2tr_mesh_new_edge (P2trMesh *mesh,
32 gboolean constrained);
35 * Return a new edge between the two points if an edge doesn't exist, or
36 * return an existing edge between the two points if there is such one.
37 * THE RETURNED EDGE MUST BE UNREFFED, NO MATTER IF IT'S A NEW EDGE OR
40 P2trEdge* p2tr_mesh_new_or_existing_edge (P2trMesh *self,
43 gboolean constrained);
45 P2trTriangle* p2tr_mesh_new_triangle (P2trMesh *mesh,
50 void p2tr_mesh_on_point_removed (P2trMesh *mesh,
53 void p2tr_mesh_on_edge_removed (P2trMesh *mesh,
56 void p2tr_mesh_on_triangle_removed (P2trMesh *mesh,
57 P2trTriangle *triangle);
59 void p2tr_mesh_clear (P2trMesh *mesh);
61 void p2tr_mesh_destroy (P2trMesh *mesh);
63 void p2tr_mesh_unref (P2trMesh *mesh);
65 P2trMesh* p2tr_mesh_ref (P2trMesh *mesh);
67 P2trTriangle* p2tr_mesh_find_point (P2trMesh *self,
68 const P2trVector2 *pt);
70 P2trTriangle* p2tr_mesh_find_point2 (P2trMesh *self,
71 const P2trVector2 *pt,
75 /** This function assumes the mesh is composed entirely of one
76 * continuous region. The region may have holes, but eventually every
77 * triangle should be accessible from any other triangle by going
78 * through a chain of neigbor triangles
79 * @param[in] self The mesh to search
80 * @param[in] pt The point to find
81 * @param[in] initial_guess An initial guess for which triangle contains
82 * the point or is at least near it
83 * @return The triangle containing the point, or NULL if it's outside
84 * the triangulation domain
86 P2trTriangle* p2tr_mesh_find_point_local (P2trMesh *self,
87 const P2trVector2 *pt,
88 P2trTriangle *initial_guess);
90 /** Same as @ref p2tr_mesh_find_point_local but also returns the u and v
91 * coordinates of the given point inside the triangle
92 * @param[in] self The mesh to search
93 * @param[in] pt The point to find
94 * @param[in] initial_guess An initial guess for which triangle contains
95 * the point or is at least near it
96 * @param[out] u The u coordinate of the point inside the returned triangle
97 * @param[out] v The v coordinate of the point inside the returned triangle
98 * @return The triangle containing the point, or NULL if it's outside
99 * the triangulation domain
101 P2trTriangle* p2tr_mesh_find_point_local2 (P2trMesh *self,
102 const P2trVector2 *pt,
103 P2trTriangle *initial_guess,