xmsgrid
1.0
|
Implementation of GmTriSearch. More...
Public Member Functions | |
GmTriSearchImpl () | |
Constructor. | |
virtual | ~GmTriSearchImpl () |
Destructor. | |
virtual void | TrisToSearch (BSHP< std::vector< Pt3d >> a_pts, BSHP< std::vector< int >> a_tris) override |
Adds the triangles to the class. More... | |
virtual void | SetPtActivity (DynBitset &a_activity) override |
Modifies the activity bitset of the points. More... | |
virtual void | SetTriActivity (DynBitset &a_activity) override |
Modifies the activity bitset of the triangles. More... | |
virtual DynBitset | GetPtActivity () const override |
Activity of the points based on the triangle activity. More... | |
virtual DynBitset | GetTriActivity () const override |
Gets the activity bitset of the triangles. More... | |
bool | ActiveTri (int a_idx) const |
Tests if a triangle is active. If any of the points of the tri are not active then the tri is not active. More... | |
virtual int | TriContainingPt (const Pt3d &a_pt) override |
Find the triangle containing the point. More... | |
virtual void | TriEnvelopsContainingPt (const Pt3d &a_pt, std::vector< int > &a_tris) override |
Find all triangles whose envelope contains the point. More... | |
virtual void | TriEnvelopesOverlap (const Pt3d &a_pMin, const Pt3d &a_pMax, std::vector< int > &a_tris) override |
Find all triangles whose envelope overlaps the envelope defined by a_pMin and a_pMax. More... | |
virtual bool | InterpWeights (const Pt3d &a_pt, std::vector< int > &a_idxs, std::vector< double > &a_wts) override |
Use the stored triangles to get interpolation weights for a point. Returns false if the point is outside the triangles. More... | |
virtual bool | InterpWeightsTriangleIdx (const Pt3d &a_pt, int &a_triangleIdx, std::vector< int > &a_idxs, std::vector< double > &a_wts) override |
Use the stored triangles to get interpolation weights for a point. Returns false if the point is outside the triangles. More... | |
virtual const BSHP< VecPt3d > | GetPoints () const override |
Returns the points. More... | |
virtual const BSHP< VecInt > | GetTriangles () const override |
Returns the triangles. More... | |
virtual std::string | ToString () const override |
Write the internals to a string. More... | |
void | CreateRTree () |
Creates the RTree of the triangles. | |
void | PointIdxesFromTriIdx (int a_triIdx, int a_ptIdxes[3]) |
Fills in the point indices based on the triangle index. More... | |
int | FindTriangle (const Pt3d &a_pt, int ix[3], Pt3d &weights) |
Find the triangle containing the location a_pt. More... | |
void | GetTriBarycentricVals (int a_idx, int a_ix[3], BarycentricVals &a_b) |
Gets the barycentric values for a triangle. More... | |
DynBitset | PointActivityFromTriActivity () const |
Gets the activity of the points from the triangles. More... | |
BSHP< GmPtSearch > | CreatePtSearch () |
creates the rtree of the points More... | |
Public Member Functions inherited from xms::GmTriSearch | |
virtual | ~GmTriSearch () |
Destructor. | |
Public Attributes | |
Pt3d | m_min |
mininum extents of all points | |
Pt3d | m_max |
maximum extents of all points | |
BSHP< std::vector< Pt3d > > | m_pts |
point locations | |
BSHP< std::vector< int > > | m_tris |
triangles that reference point indexes | |
DynBitset | m_triActivity |
activity of the triangles | |
boost::unordered_map< size_t, BarycentricVals > | m_cache |
bgi::rtree< value, qRtree, idx_tri > * | m_rTree |
spatial index of the triangle extents | |
Additional Inherited Members | |
Static Public Member Functions inherited from xms::GmTriSearch | |
static BSHP< GmTriSearch > | New () |
Creates an TriSearch class. More... | |
Protected Member Functions inherited from xms::GmTriSearch | |
GmTriSearch () | |
Constructor. | |
Implementation of GmTriSearch.
Provides functionality to do spatial queries on a set of triangles. Uses the boost RTree for queries.
Definition at line 124 of file GmTriSearch.cpp.
bool xms::GmTriSearchImpl::ActiveTri | ( | int | a_idx | ) | const |
Tests if a triangle is active. If any of the points of the tri are not active then the tri is not active.
a_idx | Triangle index |
Definition at line 380 of file GmTriSearch.cpp.
References m_triActivity.
Referenced by FindTriangle(), and PointActivityFromTriActivity().
BSHP< GmPtSearch > xms::GmTriSearchImpl::CreatePtSearch | ( | ) |
creates the rtree of the points
Definition at line 657 of file GmTriSearch.cpp.
References m_pts, xms::GmPtSearch::New(), and PointActivityFromTriActivity().
Find the triangle containing the location a_pt.
a_pt | The location to interpolate to. |
ix | The point indices from the triangle containing a_pt. |
weights | The weights associated with the points ix. |
Definition at line 550 of file GmTriSearch.cpp.
References ActiveTri(), BARYTOL, xmlog::error, GetTriBarycentricVals(), xms::iGetBarycentricCoords(), m_pts, m_rTree, m_tris, xms::Pt3< T >::x, XM_LOG, XM_NONE, xms::Pt3< T >::y, and xms::Pt3< T >::z.
Referenced by InterpWeightsTriangleIdx(), and TriContainingPt().
Returns the points.
Definition at line 494 of file GmTriSearch.cpp.
References m_pts.
|
inlineoverridevirtual |
Activity of the points based on the triangle activity.
Definition at line 134 of file GmTriSearch.cpp.
References PointActivityFromTriActivity().
|
overridevirtual |
Gets the activity bitset of the triangles.
Definition at line 361 of file GmTriSearch.cpp.
References m_triActivity, and m_tris.
Returns the triangles.
Definition at line 502 of file GmTriSearch.cpp.
References m_tris.
void xms::GmTriSearchImpl::GetTriBarycentricVals | ( | int | a_idx, |
int | a_ix[3], | ||
BarycentricVals & | a_b | ||
) |
Gets the barycentric values for a triangle.
a_idx | Triangle index |
a_ix | Point indexes that make up triangle |
a_b | The barycentric values |
Definition at line 617 of file GmTriSearch.cpp.
References xms::iCartToBary(), m_cache, and m_pts.
Referenced by FindTriangle().
|
overridevirtual |
Use the stored triangles to get interpolation weights for a point. Returns false if the point is outside the triangles.
a_pt | Location that is interpolated to. |
a_idxs | Vector of triangle point indices filled in by this method. |
a_wts | Vector of triangle point weights filled in by this method. |
Definition at line 452 of file GmTriSearch.cpp.
References InterpWeightsTriangleIdx().
|
overridevirtual |
Use the stored triangles to get interpolation weights for a point. Returns false if the point is outside the triangles.
a_pt | Location that is interpolated to. |
a_triangleIdx | Found triangles index in triangle array (zero based count*3). |
a_idxs | Vector of triangle point indices filled in by this method. |
a_wts | Vector of triangle point weights filled in by this method. |
Definition at line 468 of file GmTriSearch.cpp.
References FindTriangle(), xms::Pt3< T >::x, XM_NONE, xms::Pt3< T >::y, and xms::Pt3< T >::z.
Referenced by InterpWeights().
DynBitset xms::GmTriSearchImpl::PointActivityFromTriActivity | ( | ) | const |
Gets the activity of the points from the triangles.
Definition at line 633 of file GmTriSearch.cpp.
References ActiveTri(), m_pts, m_triActivity, and m_tris.
Referenced by CreatePtSearch(), and GetPtActivity().
void xms::GmTriSearchImpl::PointIdxesFromTriIdx | ( | int | a_triIdx, |
int | a_ptIdxes[3] | ||
) |
Fills in the point indices based on the triangle index.
a_triIdx | The triangle index in the m_tris vector. |
a_ptIdxes | Array of point indices filled by this method. The indices correspond to locations in the m_pts vector. |
Definition at line 529 of file GmTriSearch.cpp.
References xmlog::debug, m_tris, and XM_LOG.
|
overridevirtual |
Modifies the activity bitset of the points.
a_activity | bitset of the activity of the points |
Definition at line 316 of file GmTriSearch.cpp.
References m_pts, m_triActivity, m_tris, and XM_ENSURE_TRUE_NO_ASSERT.
|
overridevirtual |
Modifies the activity bitset of the triangles.
a_activity | bitset of the activity of the triangles |
Definition at line 336 of file GmTriSearch.cpp.
References m_triActivity, m_tris, and XM_ENSURE_TRUE_NO_ASSERT.
|
overridevirtual |
Write the internals to a string.
Definition at line 510 of file GmTriSearch.cpp.
References m_max, m_min, m_pts, m_triActivity, m_tris, and VecToStream().
|
overridevirtual |
Find the triangle containing the point.
a_pt | Location used to find a triangle. |
Definition at line 394 of file GmTriSearch.cpp.
References FindTriangle().
Referenced by TriSearchUnitTests::testSmsCase1(), and TriSearchUnitTests::testTouch().
|
overridevirtual |
Find all triangles whose envelope overlaps the envelope defined by a_pMin and a_pMax.
a_pMin | min x,y location of the box |
a_pMax | max x,y location of the box |
a_tris | The indices to triangles whose envelope intersects with the input envelope. |
Definition at line 426 of file GmTriSearch.cpp.
References m_rTree, and xms::Pt3< T >::z.
Referenced by TriSearchUnitTests::testTriEnvelopesOverlap().
|
overridevirtual |
Find all triangles whose envelope contains the point.
a_pt | Location used to find a triangle. |
a_tris | The indices to triangles whose envelop contains the point |
Definition at line 405 of file GmTriSearch.cpp.
References m_rTree, xms::Pt3< T >::x, and xms::Pt3< T >::y.
|
overridevirtual |
Adds the triangles to the class.
a_pts | Array of point locations. |
a_tris | Array of triangles that references the a_pts array. This array will have a size that is a multiple of 3. The first 3 locations in array represent the first triangle and will have indices that correspond to locations in the a_pts array. |
Definition at line 266 of file GmTriSearch.cpp.
References CreateRTree(), m_cache, m_pts, m_rTree, and m_tris.
Referenced by TriSearchUnitTests::testSmsCase1(), TriSearchUnitTests::testTouch(), and TriSearchUnitTests::testTriEnvelopesOverlap().
boost::unordered_map<size_t, BarycentricVals> xms::GmTriSearchImpl::m_cache |
we create a cache of these for faster interp the second time we hit the triangle
Definition at line 173 of file GmTriSearch.cpp.
Referenced by GetTriBarycentricVals(), and TrisToSearch().