xmsmesh
1.0
|
Creates a mesh from multiple polygons that will honor polygon boundaries. More...
Public Member Functions | |
MeMultiPolyMesherImpl () | |
Constructor. | |
virtual bool | MeshIt (MeMultiPolyMesherIo &a_io) override |
Creates a triangle mesh from the input polygons. The polygons can not overlap. More... | |
virtual void | CheckForIntersections (const MeMultiPolyMesherIo &a_io, std::string &a_errors) const override |
Checks input to see if anything intersects. Will not catch polys entirely inside or outside of where they are supposed to be. More... | |
Private Member Functions | |
void | AppendMesh (VecPt3d &a_points, const VecInt &a_triangles, VecInt &a_cells) |
Adds new points and triangles to existing mesh, hashing points and renumbering. More... | |
void | AddUniquePoints (const VecPt3d &a_points, VecInt &a_oldDups, VecInt &a_newDups) |
Adds new mesh points that aren't in old mesh, to old mesh. More... | |
void | RenumberNewMesh (int a_oldNumPts, size_t a_numNewPts, const VecInt &a_oldDups, const VecInt &a_newDups, VecInt &a_cells) const |
Renumber points referred to in the new mesh to remove duplicate points and to start new mesh numbering at size of existing mesh. More... | |
void | AppendNewCells (const VecInt &a_cells) |
Append the new cells to the existing cells. More... | |
void | ReportUnusedRefinePts (const MeMultiPolyMesherIo &a_io, const VecPt3d &a_usedPts) |
Reports refine points that were not used. More... | |
void | EnsureProperPolygonInputs (MeMultiPolyMesherIo &a_io) |
Remove last point of polygon if it is the same as the first point and make sure the polygon points are ordered correctly. More... | |
bool | ValidateInput (const MeMultiPolyMesherIo &a_io) |
Make sure the input makes sense. More... | |
bool | ExtentsOverlap (const Pt3d &oneMn, const Pt3d &oneMx, const Pt3d &two1, const Pt3d &two2) const |
Given extents of one segment, and another segment, return true if the extents of the two segments overlap. More... | |
Private Attributes | |
BSHP< VecPt3d > | m_pts |
Mesh points. BSHP because of PtSearch::VectorThatGrowsToSearch. | |
VecInt | m_cells |
Mesh cells as a stream. | |
int | m_cellCount |
Number of cells. | |
boost::unordered_map< std::pair< double, double >, int > | m_ptHash |
hashes points | |
Additional Inherited Members | |
Static Public Member Functions inherited from xms::MeMultiPolyMesher | |
static boost::shared_ptr< MeMultiPolyMesher > | New () |
Creates a class. More... | |
Creates a mesh from multiple polygons that will honor polygon boundaries.
Definition at line 51 of file MeMultiPolyMesher.cpp.
|
private |
Adds new mesh points that aren't in old mesh, to old mesh.
Also gives back lists of duplicate points found (if any) in a_oldDups and a_newDups which are the same size and correspond with each other (a_oldDups[3] => a_newDups[3])
a_points | New mesh points. |
a_oldDups | Indices in m_pts (old mesh) of duplicate points. |
a_newDups | Indices in a_points (new mesh) of duplicate points. |
Definition at line 689 of file MeMultiPolyMesher.cpp.
References m_ptHash, m_pts, and XM_ENSURE_TRUE_VOID_NO_ASSERT.
Referenced by AppendMesh().
|
private |
Adds new points and triangles to existing mesh, hashing points and renumbering.
a_points | New mesh points. |
a_triangles | New mesh triangle cells. |
a_cells | New mesh cells. |
Definition at line 618 of file MeMultiPolyMesher.cpp.
References AddUniquePoints(), AppendNewCells(), m_cellCount, m_cells, m_ptHash, m_pts, and RenumberNewMesh().
Referenced by MeshIt().
|
private |
Append the new cells to the existing cells.
a_cells | New cells to append to existing mesh. |
Definition at line 777 of file MeMultiPolyMesher.cpp.
References m_cells.
Referenced by AppendMesh().
|
overridevirtual |
Checks input to see if anything intersects. Will not catch polys entirely inside or outside of where they are supposed to be.
We check by intersecting every line segment on every poly with every other line segment on every other poly, if the extents overlap. This can be slow.
a_io | Mesher input/output |
a_errors | Error string that may get appended to. |
Definition at line 411 of file MeMultiPolyMesher.cpp.
References ExtentsOverlap(), gmAddToExtents(), gmEqualPointsXY(), gmIntersectLineSegmentsWithTol(), gmXyTol(), xms::SegmentLocation::m_inPoly, xms::SegmentLocation::m_inPolySeg, xms::MePolyInput::m_insidePolys, xms::MePolyInput::m_outPoly, xms::SegmentLocation::m_poly, xms::MeMultiPolyMesherIo::m_polys, xms::SegmentLocation::m_polySeg, xms::Pt3< T >::x, and xms::Pt3< T >::y.
Referenced by ValidateInput().
|
private |
Remove last point of polygon if it is the same as the first point and make sure the polygon points are ordered correctly.
a_io | The input/output parameters. |
Definition at line 287 of file MeMultiPolyMesher.cpp.
References gmEqualPointsXY(), gmPolygonArea(), xms::MePolyInput::m_insidePolys, xms::MePolyInput::m_outPoly, and xms::MeMultiPolyMesherIo::m_polys.
Referenced by MeshIt().
|
private |
Given extents of one segment, and another segment, return true if the extents of the two segments overlap.
a_oneMn | Min extents of first segment. |
a_oneMx | Max extents of first segment. |
a_two1 | First point defining second segment. |
a_two2 | Second point defining second segment. |
Definition at line 585 of file MeMultiPolyMesher.cpp.
References gmAddToExtents(), xms::Pt3< T >::x, and xms::Pt3< T >::y.
Referenced by CheckForIntersections().
|
overridevirtual |
Creates a triangle mesh from the input polygons. The polygons can not overlap.
[in] | a_io | Input/output of polygons and options for generating a mesh. MeMultiPolyMesherIo::m_returnCellPolygons is true. |
Definition at line 230 of file MeMultiPolyMesher.cpp.
References AppendMesh(), EnsureProperPolygonInputs(), m_cellCount, xms::MeMultiPolyMesherIo::m_cellPolygons, m_cells, xms::MeMultiPolyMesherIo::m_cells, xms::MeMultiPolyMesherIo::m_points, xms::MeMultiPolyMesherIo::m_polys, m_ptHash, m_pts, xms::MeMultiPolyMesherIo::m_returnCellPolygons, xms::MePolyMesher::New(), ReportUnusedRefinePts(), and ValidateInput().
|
private |
Renumber points referred to in the new mesh to remove duplicate points and to start new mesh numbering at size of existing mesh.
a_oldNumPts | Number of points we had before adding this mesh. |
a_numNewPts | Number of new, unique points |
a_oldDups | Indices in m_pts of duplicate points. |
a_newDups | Indices in a_points of duplicate points. |
a_cells | Cells of mesh (same format as vtk cell stream) |
Definition at line 728 of file MeMultiPolyMesher.cpp.
References XM_ENSURE_TRUE_VOID_NO_ASSERT.
Referenced by AppendMesh().
|
private |
Reports refine points that were not used.
a_io | MeMultiPolyMesherIo class that was provided to generate the mesh. |
a_usedPts | The locations of points that were processed. |
Definition at line 787 of file MeMultiPolyMesher.cpp.
References xms::MeMultiPolyMesherIo::m_refPts, xmlog::warning, and XM_LOG.
Referenced by MeshIt().
|
private |
Make sure the input makes sense.
a_io | The input/output parameters. |
Definition at line 337 of file MeMultiPolyMesher.cpp.
References CheckForIntersections(), xms::MeMultiPolyMesherIo::m_checkTopology, xms::MePolyInput::m_insidePolys, xms::MePolyInput::m_outPoly, xms::MePolyInput::m_polyCorners, xms::MePolyInput::m_polyId, xms::MeMultiPolyMesherIo::m_polys, xmlog::warning, XM_ASSERT, and XM_LOG.
Referenced by MeshIt().