xmsmesh
1.0
|
Creates a mesh inside a polygon. More...
Public Types | |
enum | BoundaryEnum { BE_UNVISITED = 0, BE_VISITED = 1, BE_OUTSIDE = 2, BE_INSIDE = 4, BE_ONBOUNDARY = 8 } |
enumeration for boundary processing | |
Public Member Functions | |
virtual bool | MeshIt (const MeMultiPolyMesherIo &a_input, size_t a_polyIdx, VecPt3d &a_points, VecInt &a_triangles, VecInt &a_cells) override |
Perform MESH_PAVE, MESH_SPAVE, MESH_PATCH meshing on a polygon. More... | |
virtual bool | MeshIt (const VecPt3d &a_outPoly, const VecPt3d2d &a_inPolys, double a_bias, VecPt3d &a_points, VecInt &a_triangles) |
Perform MESH_PAVE, MESH_SPAVE meshing on a polygon. Return the mesh points through a_points and triangles through a_triangles. More... | |
virtual void | GetProcessedRefinePts (std::vector< Pt3d > &a_pts) override |
Gets the refine points that were inside the polygon, both points that are included in the meshing process and those that were not. More... | |
void | TestWithPoints (const VecInt &a_outPoly, const VecInt2d &a_inPolys, const VecPt3d &a_points, VecInt &a_triangles) |
Used only for testing. Test the class by supplying the polygons and mesh points. More... | |
Private Member Functions | |
bool | MeshFromInputs (std::vector< Pt3d > &a_points, VecInt &a_triangles, VecInt &a_cells) |
Creates the mesh from inputs that have set member variables in the class. More... | |
void | SortPoly (VecPt3d &a_outPoly) |
Start polygon with lower left most point so results are consistent. More... | |
bool | ComputeExtents (Pt3d &a_mn, Pt3d &a_mx) |
Computes the extents (min, max) of the polygon. More... | |
void | ComputeTolerance () |
Computes a tolerance to use based on point extents. | |
void | GenerateMeshPts () |
Creates the points in interior of the input polygon that are used to create cells. | |
void | ProcessBoundaryPtsFlaggedToRemove () |
Remove boundary points. | |
void | Triangulate () |
Triangulate the mesh points. | |
void | FindAllPolyPointIdxs () |
Find the indices of the poly points among m_points. They will most likely be at the front of m_points so we don't use an rtree to find them. | |
void | FindPolyPointIdxs (const VecPt3d &a_poly, VecInt &a_polyPtIdxs) |
See FindAllPolyPointIdxs. More... | |
void | AddBreaklines () |
Add the polys as breaklines in the tin. | |
void | DeleteTrianglesOutsidePolys () |
Delete triangles outside the polygon boundary or in polygon holes. More... | |
void | AutoFixFourTrianglePts () |
Delete internal points that are only connected to 4 triangles and retriangulates. | |
void | Relax () |
Relaxes the mesh points for better element quality. | |
void | ExportTinForDebug () |
Exports the tin for debugging purposes. | |
Private Attributes | |
VecPt3d | m_outPoly |
outer boundary of polygon being meshed | |
VecPt3d2d | m_inPolys |
inside boundaries or holes in polygon | |
VecPt3d2d | m_refPtPolys |
refine points | |
VecPt3d | m_refMeshPts |
refine point that have been made into mesh nodes | |
VecPt3d | m_refPtsTooClose |
refine points that can not be honored because of distance constraints | |
BSHP< VecPt3d > | m_points |
resulting mesh nodes | |
BSHP< TrTin > | m_tin |
triangles that become mesh elements | |
BSHP< MePolyRedistributePts > | m_redist |
class for performing redistribution of points along a polyline | |
BSHP< MePolyPaverToMeshPts > | m_polyPaver |
class for paving from a polygon definition | |
BSHP< MeRefinePtsToPolys > | m_refineToPolys |
class for creating polygon from refine point information | |
BSHP< MeRelaxer > | m_relaxer |
class for relaxing the location of mesh nodes | |
VecInt | m_cells |
Cells generated by the Patcher. | |
double | m_bias |
factor that affects how quickly the size of elements transitions in the mesh | |
VecInt | m_outPolyPtIdxs |
indices to the mesh points that match the outer polygon boundary | |
VecInt2d | m_inPolyPtIdxs |
indices to the mesh points that match the inner polygon boundaries | |
VecInt | m_refPtIdxs |
indices to points mesh point that match refine points | |
VecInt | m_polyCorners |
corner indexes used with mesh patch generation | |
double | m_xyTol |
xy tolerance used in geometric comparisons | |
bool | m_testing |
flag to indicate if we are testing the class | |
Pt3d | m_min |
min xy bound | |
Pt3d | m_max |
max xy bound | |
PtHash | m_ptHash |
hash for point locations | |
BSHP< InterpBase > | m_elev |
interpolator to assign elevations to mesh points | |
int | m_polyId |
id of the polygon | |
VecPt3d | m_seedPts |
user generated seed points. | |
VecPt3d | m_boundPtsToRemove |
boundary points to remove after the paving process is complete | |
bool | m_removeInternalFourTrianglePts |
flag to indicate the removal of internal pts connected to 4 triangles will occur More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from xms::MePolyMesher | |
static boost::shared_ptr< MePolyMesher > | New () |
Creates a polymesher class. More... | |
Creates a mesh inside a polygon.
The polygon may contain holes. The mesh is returned as a vector of points and a vector of triangles.
Definition at line 65 of file MePolyMesher.cpp.
Computes the extents (min, max) of the polygon.
[out] | a_mn | The minimum coordinates of the polygon extents. |
[out] | a_mx | The maximum coordinates of the polygon extents. |
Definition at line 442 of file MePolyMesher.cpp.
References gmAddToExtents(), and m_outPoly.
Referenced by ComputeTolerance().
|
private |
Delete triangles outside the polygon boundary or in polygon holes.
The polygon may be concave or have holes so we may need to delete some triangles. This method finds triangles along the polygon and classifies them as in or out and deletes all that are out.
Definition at line 597 of file MePolyMesher.cpp.
References m_inPolyPtIdxs, m_outPolyPtIdxs, m_tin, and xms::TrOuterTriangleDeleter::New().
Referenced by MeshFromInputs().
|
private |
See FindAllPolyPointIdxs.
[in] | a_poly | The polygon. |
[out] | a_polyPtIdxs | Polygon point indices. |
Definition at line 697 of file MePolyMesher.cpp.
References m_ptHash.
Referenced by FindAllPolyPointIdxs().
|
overridevirtual |
Gets the refine points that were inside the polygon, both points that are included in the meshing process and those that were not.
a_pts | Locations of refine points used inside of this polygon. |
Definition at line 343 of file MePolyMesher.cpp.
References m_refMeshPts, and m_refPtsTooClose.
|
private |
Creates the mesh from inputs that have set member variables in the class.
[out] | a_points | Points filled by meshing. |
[out] | a_triangles | Triangles created by paving meshing. |
[out] | a_cells | Cells created by patch meshing. |
Definition at line 357 of file MePolyMesher.cpp.
References AddBreaklines(), AutoFixFourTrianglePts(), DeleteTrianglesOutsidePolys(), xmlog::error, FindAllPolyPointIdxs(), GenerateMeshPts(), m_cells, m_elev, m_points, m_polyCorners, m_polyId, m_tin, xms::meModifyMessageWithPolygonId(), ProcessBoundaryPtsFlaggedToRemove(), Relax(), Triangulate(), and XM_LOG.
Referenced by MeshIt().
|
overridevirtual |
Perform MESH_PAVE, MESH_SPAVE, MESH_PATCH meshing on a polygon.
[in] | a_input | Meshing input: polygons and optional inputs |
[in] | a_polyIdx | Index to the polygon in a_input to mesh |
[out] | a_points | Computed mesh points. |
[out] | a_triangles | Computed mesh triangles from paving. |
[out] | a_cells | Computed mesh cells from patch. |
Definition at line 220 of file MePolyMesher.cpp.
References ComputeTolerance(), xms::MePolyInput::m_bias, m_bias, xms::MePolyInput::m_boundPtsToRemove, m_boundPtsToRemove, xms::MePolyInput::m_constSizeBias, xms::MePolyInput::m_constSizeFunction, m_elev, xms::MePolyInput::m_elevFunction, m_inPolys, xms::MePolyInput::m_insidePolys, xms::MePolyInput::m_outPoly, m_outPoly, xms::MePolyInput::m_polyCorners, m_polyCorners, xms::MePolyInput::m_polyId, m_polyId, m_polyPaver, xms::MeMultiPolyMesherIo::m_polys, m_redist, m_refineToPolys, m_refMeshPts, m_refPtPolys, xms::MeMultiPolyMesherIo::m_refPts, m_refPtsTooClose, xms::MePolyInput::m_relaxationMethod, m_relaxer, xms::MePolyInput::m_removeInternalFourTrianglePts, m_removeInternalFourTrianglePts, xms::MePolyInput::m_seedPoints, m_seedPts, xms::MePolyInput::m_sizeFunction, m_tin, m_xyTol, MeshFromInputs(), xms::TrTin::New(), xms::MeRefinePtsToPolys::New(), xms::MePolyPaverToMeshPts::New(), xms::MePolyRedistributePts::New(), xms::MeRelaxer::New(), and SortPoly().
Referenced by TestWithPoints().
|
virtual |
Perform MESH_PAVE, MESH_SPAVE meshing on a polygon. Return the mesh points through a_points and triangles through a_triangles.
[in] | a_outPoly | Outer polygon. Clockwise. 1st pt != last |
[in] | a_inPolys | Inner polygons (holes). Counter clockwise. 1st pt != last |
[in] | a_bias | |
[out] | a_points | Computed mesh points. |
[out] | a_triangles | Computed mesh triangles. |
Definition at line 295 of file MePolyMesher.cpp.
References ComputeTolerance(), m_bias, m_inPolys, m_outPoly, MeshFromInputs(), and SortPoly().
|
private |
Start polygon with lower left most point so results are consistent.
[in,out] | a_outPoly | The polygon. |
Definition at line 313 of file MePolyMesher.cpp.
References EQ_TOL(), and m_xyTol.
Referenced by MeshIt().
void xms::MePolyMesherImpl::TestWithPoints | ( | const VecInt & | a_outPoly, |
const VecInt2d & | a_inPolys, | ||
const VecPt3d & | a_points, | ||
VecInt & | a_triangles | ||
) |
Used only for testing. Test the class by supplying the polygons and mesh points.
[in] | a_outPoly | Outer polygon. |
[in] | a_inPolys | Inner polygons. |
[in] | a_points | The points. |
[out] | a_triangles | The created triangles. |
Definition at line 409 of file MePolyMesher.cpp.
|
private |
flag to indicate the removal of internal pts connected to 4 triangles will occur
Definition at line 145 of file MePolyMesher.cpp.
Referenced by AutoFixFourTrianglePts(), and MeshIt().