xmsmesh  1.0
xms::MePolyMesherImpl Class Reference

Creates a mesh inside a polygon. More...

Inheritance diagram for xms::MePolyMesherImpl:
xms::MePolyMesher

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< VecPt3dm_points
 resulting mesh nodes
 
BSHP< TrTinm_tin
 triangles that become mesh elements
 
BSHP< MePolyRedistributePtsm_redist
 class for performing redistribution of points along a polyline
 
BSHP< MePolyPaverToMeshPtsm_polyPaver
 class for paving from a polygon definition
 
BSHP< MeRefinePtsToPolysm_refineToPolys
 class for creating polygon from refine point information
 
BSHP< MeRelaxerm_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< InterpBasem_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< MePolyMesherNew ()
 Creates a polymesher class. More...
 

Detailed Description

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.

Member Function Documentation

◆ ComputeExtents()

bool xms::MePolyMesherImpl::ComputeExtents ( Pt3d a_mn,
Pt3d a_mx 
)
private

Computes the extents (min, max) of the polygon.

Parameters
[out]a_mnThe minimum coordinates of the polygon extents.
[out]a_mxThe maximum coordinates of the polygon extents.
Returns
true if there are any points and the extents were computed.

Definition at line 442 of file MePolyMesher.cpp.

References gmAddToExtents(), and m_outPoly.

Referenced by ComputeTolerance().

◆ DeleteTrianglesOutsidePolys()

void xms::MePolyMesherImpl::DeleteTrianglesOutsidePolys ( )
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().

◆ FindPolyPointIdxs()

void xms::MePolyMesherImpl::FindPolyPointIdxs ( const VecPt3d a_poly,
VecInt a_polyPtIdxs 
)
private

See FindAllPolyPointIdxs.

Parameters
[in]a_polyThe polygon.
[out]a_polyPtIdxsPolygon point indices.

Definition at line 697 of file MePolyMesher.cpp.

References m_ptHash.

Referenced by FindAllPolyPointIdxs().

◆ GetProcessedRefinePts()

void xms::MePolyMesherImpl::GetProcessedRefinePts ( std::vector< Pt3d > &  a_pts)
overridevirtual

Gets the refine points that were inside the polygon, both points that are included in the meshing process and those that were not.

Parameters
a_ptsLocations of refine points used inside of this polygon.

Definition at line 343 of file MePolyMesher.cpp.

References m_refMeshPts, and m_refPtsTooClose.

◆ MeshFromInputs()

bool xms::MePolyMesherImpl::MeshFromInputs ( std::vector< Pt3d > &  a_points,
VecInt a_triangles,
VecInt a_cells 
)
private

Creates the mesh from inputs that have set member variables in the class.

Parameters
[out]a_pointsPoints filled by meshing.
[out]a_trianglesTriangles created by paving meshing.
[out]a_cellsCells created by patch meshing.
Returns
true if no errors encountered.

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().

◆ MeshIt() [1/2]

bool xms::MePolyMesherImpl::MeshIt ( const MeMultiPolyMesherIo a_input,
size_t  a_polyIdx,
VecPt3d a_points,
VecInt a_triangles,
VecInt a_cells 
)
overridevirtual

◆ MeshIt() [2/2]

bool xms::MePolyMesherImpl::MeshIt ( const VecPt3d a_outPoly,
const VecPt3d2d a_inPolys,
double  a_bias,
VecPt3d a_points,
VecInt a_triangles 
)
virtual

Perform MESH_PAVE, MESH_SPAVE meshing on a polygon. Return the mesh points through a_points and triangles through a_triangles.

Parameters
[in]a_outPolyOuter polygon. Clockwise. 1st pt != last
[in]a_inPolysInner polygons (holes). Counter clockwise. 1st pt != last
[in]a_bias
[out]a_pointsComputed mesh points.
[out]a_trianglesComputed mesh triangles.
Returns
true on success.

Definition at line 295 of file MePolyMesher.cpp.

References ComputeTolerance(), m_bias, m_inPolys, m_outPoly, MeshFromInputs(), and SortPoly().

◆ SortPoly()

void xms::MePolyMesherImpl::SortPoly ( VecPt3d a_outPoly)
private

Start polygon with lower left most point so results are consistent.

Parameters
[in,out]a_outPolyThe polygon.

Definition at line 313 of file MePolyMesher.cpp.

References EQ_TOL(), and m_xyTol.

Referenced by MeshIt().

◆ TestWithPoints()

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.

Parameters
[in]a_outPolyOuter polygon.
[in]a_inPolysInner polygons.
[in]a_pointsThe points.
[out]a_trianglesThe created triangles.

Definition at line 409 of file MePolyMesher.cpp.

References m_points, m_testing, and MeshIt().

Member Data Documentation

◆ m_removeInternalFourTrianglePts

bool xms::MePolyMesherImpl::m_removeInternalFourTrianglePts
private
Initial value:
=
false

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().


The documentation for this class was generated from the following file: