xmsmesh
1.0
|
Redistributes points along polylines using a size function. More...
Public Member Functions | |
virtual void | SetSizeFunc (BSHP< InterpBase > a_interp) override |
Sets the size function interpolator. More... | |
virtual void | SetSizeFuncFromPoly (const VecPt3d &a_outPoly, const VecPt3d2d &a_inPolys, double a_sizeBias) override |
Creates an interpolator that uses the spacing on the input polygon as its scalar. More... | |
virtual void | SetConstantSizeFunc (double a_size) override |
Sets the size function to a constant value. More... | |
virtual void | SetConstantSizeBias (double a_sizeBias) override |
Sets the bias for constant value size function. More... | |
void | SetUseCurvatureRedistribution (double a_featureSize, double a_meanSpacing, double a_minimumCurvature, bool a_smooth) override |
Specifies that curvature redistribution will be used. More... | |
void | Redistribute (const MePolyOffsetterOutput &a_input, MePolyOffsetterOutput &a_out, int a_polyOffsetIter) |
Redistributes points on closed loop polylines. The length of edges in the redistribution comes from a size function that is interpolated to the points that make up the polylines. By default this size function comes from the edge lengths in the original polygon. More... | |
virtual VecPt3d | Redistribute (const VecPt3d &a_polyLine) override |
Redistributes points on a polyline. More... | |
virtual double | SizeFromLocation (const Pt3d &a_location) override |
returns a size based on the xy location More... | |
virtual std::string | ToPyRepr () const override |
returns a string for use in the python repr attribute More... | |
VecPt3d | LoopToVecPt3d (const VecSizet &a_idx, const VecPt3d &a_pts) |
Creates a vector of pts from indices into another vector of points. More... | |
void | IntersectWithTris (VecPt3d &a_pts) |
Creates a vector of pts from indices into another vector of points. More... | |
void | InterpEdgeLengths (const VecPt3d &a_pts, VecDbl &lengths) |
Interpolates edge lengths to each of the points that make up a polyline. More... | |
void | InterpToPoint (size_t a_idx, const VecPt3d &a_pts, VecDbl &a_lengths, VecDbl &a_wt, VecDbl &a_d2, double &a_bias) |
Interpolates to a point from the boundary of the polygon. More... | |
void | CalcInterpWeights (const Pt3d &a_pt, VecDbl &a_wt, VecDbl &a_d2, double &a_sumWt) |
Calculates the interpolation weights of the points used to do the interpolation. More... | |
VecPt3d | RedistPts (const VecPt3d &a_pts, const VecDbl &lengths) |
Uses interpolated lengths to redistribute points on a polyline. More... | |
VecPt3d | RedistPts2 (const VecPt3d &a_pts, const VecDbl &lengths) |
Uses interpolated lengths to redistribute points on a polyline. More... | |
void | RedistPtsToOutput (const VecPt3d &a_pts, int a_polyType, MePolyOffsetterOutput &a_out) |
Move the redistributed points to the output class. More... | |
void | TvaluesForSeg (size_t a_idx, size_t a_nextIdx, const VecDbl &a_segLengths, const VecDbl &a_segTvalues, const VecDbl &a_interpLengths, double &a_pcntin, VecDbl &a_tVals) |
A single segment of a polygon is analyzed to see where points are redistributed on that segment. More... | |
void | SizeFromPolyCalcAveEdgeLengthAtPts (const VecPt3d &a_outPoly, const VecPt3d2d &a_inPolys) |
Calculates average edge lengths at each point in a loop defining a polygon. More... | |
void | SizeFromPolyAddEdgeLengths (const VecPt3d &a_pts) |
Calculates average edge lengths at each point in a loop defining a polygon. More... | |
void | CalcSegLengths (const VecPt3d &a_pts, VecDbl &a_segLength, VecDbl &_segTvalues) |
Calculates the lengths of segments and parametric values of segment endpoints. More... | |
void | GetSegmentFromTval (const VecDbl &a_segTvalues, double a_tVal, size_t &a_segIdx, double &a_segT0, double &a_segT1) |
Finds the segment that contains a_tVal. More... | |
void | CreatePolyIntersector () |
Creates the poly intersector class member variable. | |
Public Member Functions inherited from xms::MePolyRedistributePts | |
virtual | ~MePolyRedistributePts () |
destructor | |
Public Attributes | |
double | m_constSize |
constant size function | |
double | m_minLength |
min segment length in polygon | |
double | m_maxLength |
max segment length in polygon | |
double | m_sizeBias |
transition factor for size function | |
BSHP< VecPt3d > | m_polyPts |
polygon point locations | |
VecDbl | m_polyEdgeLengths |
edge lengths of the polygon | |
BSHP< InterpBase > | m_interp |
interpolation class given to this class | |
BSHP< VecPt3d > | m_sizePts |
points from the m_interp class | |
BSHP< VecInt > | m_sizeTris |
triangles from the m_interp class | |
BSHP< GmMultiPolyIntersector > | m_polyIntersector |
used to intersect the polygon with m_sizeTris | |
VecInt2d | m_polys |
bool | m_intersectWithTris |
flag to indicate that polygon should be intersected with the triangles | |
double | m_distSqTol |
tolerance used to speed up interpolation | |
bool | m_biasConstSize |
flag to indicate transitioning to constant size function | |
int | m_polyOffsetIter |
double | m_featureSizeCurvature |
double | m_meanSpacingCurvature |
Used by curvature redistribution. The mean spacing between the distributed points. | |
double | m_minimumCurvature |
bool | m_smoothCurvature |
BSHP< MePolyRedistributePtsCurvature > | m_curvatureRedist |
Point redistributor that uses curvature. | |
Additional Inherited Members | |
Static Public Member Functions inherited from xms::MePolyRedistributePts | |
static BSHP< MePolyRedistributePts > | New () |
Creates an instance of this class. More... | |
Protected Member Functions inherited from xms::MePolyRedistributePts | |
MePolyRedistributePts () | |
constructor | |
Redistributes points along polylines using a size function.
Definition at line 57 of file MePolyRedistributePts.cpp.
void xms::MePolyRedistributePtsImpl::CalcInterpWeights | ( | const Pt3d & | a_pt, |
VecDbl & | a_wt, | ||
VecDbl & | a_d2, | ||
double & | a_sumWt | ||
) |
Calculates the interpolation weights of the points used to do the interpolation.
a_pt | The location being interpolated to. |
a_wt | Vector of weights calculated by this function |
a_d2 | Vector of distance squared |
a_sumWt | Sum of the weights in a_wt |
Definition at line 598 of file MePolyRedistributePts.cpp.
References m_minLength, m_polyEdgeLengths, m_polyPts, m_sizeBias, MdistSq(), xms::Pt3< T >::x, and xms::Pt3< T >::y.
Referenced by InterpToPoint().
void xms::MePolyRedistributePtsImpl::CalcSegLengths | ( | const VecPt3d & | a_pts, |
VecDbl & | a_segLength, | ||
VecDbl & | a_segTvalues | ||
) |
Calculates the lengths of segments and parametric values of segment endpoints.
a_pts | Vector of locations. |
a_segLength | Vector of segment lengths. Filled by this method. |
a_segTvalues | Vector of parametric values of segment endpoints relative to the perimeter of the closed loop. Filled by this method. |
Definition at line 1008 of file MePolyRedistributePts.cpp.
References Mdist(), xms::Pt3< T >::x, and xms::Pt3< T >::y.
Referenced by InterpEdgeLengths(), and RedistPts().
void xms::MePolyRedistributePtsImpl::GetSegmentFromTval | ( | const VecDbl & | a_segTvalues, |
double | a_tVal, | ||
size_t & | a_segIdx, | ||
double & | a_segT0, | ||
double & | a_segT1 | ||
) |
Finds the segment that contains a_tVal.
a_segTvalues | Vector of parametric values of segment endpoints relative to the perimeter of the closed loop. |
a_tVal | Parametric value along closed loop. |
a_segIdx | Index for starting the search of a_segTvalues and can be modified by this method when the segment is found. |
a_segT0 | The parametric t value for the start of the found segment |
a_segT1 | The parametric t value for the end of the found segment |
Definition at line 1038 of file MePolyRedistributePts.cpp.
References XM_ASSERT.
Referenced by RedistPts().
void xms::MePolyRedistributePtsImpl::InterpEdgeLengths | ( | const VecPt3d & | a_pts, |
VecDbl & | a_lengths | ||
) |
Interpolates edge lengths to each of the points that make up a polyline.
a_pts | Vector of locations. |
a_lengths | Vector of interpolated lengths filled in by the method. Will be the same size as a_idx. |
Definition at line 464 of file MePolyRedistributePts.cpp.
References CalcSegLengths(), xmlog::debug, InterpToPoint(), m_biasConstSize, m_constSize, m_distSqTol, m_interp, m_polyEdgeLengths, m_polyOffsetIter, m_sizeBias, MdistSq(), xms::Pt3< T >::x, XM_LOG, XM_NONE, and xms::Pt3< T >::y.
Referenced by Redistribute(), SizeFromLocation(), MePolyRedistributePtsUnitTests::testInterpEdgeLengths(), MePolyRedistributePtsUnitTests::testInterpEdgeLengths1(), MePolyRedistributePtsUnitTests::testInterpEdgeLengths2(), MePolyRedistributePtsUnitTests::testInterpEdgeLengths3(), and MePolyRedistributePtsUnitTests::testInterpEdgeLengths4().
void xms::MePolyRedistributePtsImpl::InterpToPoint | ( | size_t | a_idx, |
const VecPt3d & | a_pts, | ||
VecDbl & | a_lengths, | ||
VecDbl & | a_wt, | ||
VecDbl & | a_d2, | ||
double & | a_bias | ||
) |
Interpolates to a point from the boundary of the polygon.
[in] | a_idx | Index of point |
[in] | a_pts | Vector of point locations |
[out] | a_lengths | Vector of lengths. Value at a_idx computed. |
[out] | a_wt | Vector of weights from polygon points filled in CalcInterpWeights. |
[out] | a_d2 | Vector of distance squared between polygon points and the point at a_idx that is filled by CalcInterpWeights. |
[in] | a_bias | A factor for scaling the length when doing a smooth transition to a constant size function. |
Definition at line 553 of file MePolyRedistributePts.cpp.
References CalcInterpWeights(), m_constSize, m_maxLength, m_minLength, m_polyEdgeLengths, and XM_NONE.
Referenced by InterpEdgeLengths().
void xms::MePolyRedistributePtsImpl::IntersectWithTris | ( | VecPt3d & | a_pts | ) |
Creates a vector of pts from indices into another vector of points.
a_pts | Vector of locations. |
Definition at line 439 of file MePolyRedistributePts.cpp.
References m_polyIntersector, xms::Pt3< T >::x, and xms::Pt3< T >::y.
Referenced by Redistribute(), and MePolyRedistributePtsUnitTests::testIntersectWithTris().
VecPt3d xms::MePolyRedistributePtsImpl::LoopToVecPt3d | ( | const VecSizet & | a_idx, |
const VecPt3d & | a_pts | ||
) |
Creates a vector of pts from indices into another vector of points.
a_idx | Vector of indices into the a_pts vector. Defines the closed loop polyline. |
a_pts | Vector of locations. |
Definition at line 427 of file MePolyRedistributePts.cpp.
Referenced by Redistribute().
VecPt3d xms::MePolyRedistributePtsImpl::RedistPts | ( | const VecPt3d & | a_pts, |
const VecDbl & | a_interpLengths | ||
) |
Uses interpolated lengths to redistribute points on a polyline.
a_pts | Vector of locations. |
a_interpLengths | Vector of interpolated lengths. |
Definition at line 630 of file MePolyRedistributePts.cpp.
References CalcSegLengths(), debug, GetSegmentFromTval(), RedistPts2(), TvaluesForSeg(), xms::Pt3< T >::x, and xms::Pt3< T >::y.
Referenced by Redistribute(), MePolyRedistributePtsUnitTests::testRedistPolyLine(), MePolyRedistributePtsUnitTests::testRedistPolyLine1(), MePolyRedistributePtsUnitTests::testRedistPolyLine2(), MePolyRedistributePtsUnitTests::testRedistPts(), MePolyRedistributePtsUnitTests::testRedistPts1(), MePolyRedistributePtsUnitTests::testRedistPts2(), MePolyRedistributePtsUnitTests::testRedistPts3(), MePolyRedistributePtsUnitTests::testRedistPts4(), and MePolyRedistributePtsUnitTests::testRedistPts5().
VecPt3d xms::MePolyRedistributePtsImpl::RedistPts2 | ( | const VecPt3d & | a_pts, |
const VecDbl & | a_interpLengths | ||
) |
Uses interpolated lengths to redistribute points on a polyline.
a_pts | Vector of locations. |
a_interpLengths | Vector of interpolated lengths. |
Definition at line 721 of file MePolyRedistributePts.cpp.
References Mdist(), xms::Pt3< T >::x, xms::Pt3< T >::y, and xms::Pt3< T >::z.
Referenced by RedistPts().
void xms::MePolyRedistributePtsImpl::RedistPtsToOutput | ( | const VecPt3d & | a_pts, |
int | a_polyType, | ||
MePolyOffsetterOutput & | a_out | ||
) |
Move the redistributed points to the output class.
a_pts | Vector of locations of the redistributed points. |
a_polyType | The type of polygon that is represented by a_idx (MePolyOffsetter::polytype) |
a_out | The output filled by this method. Creates a new polygon with redistributed points. |
Definition at line 882 of file MePolyRedistributePts.cpp.
References xms::MePolyOffsetterOutput::m_loops, xms::MePolyOffsetterOutput::m_loopTypes, and xms::MePolyOffsetterOutput::m_pts.
Referenced by Redistribute().
void xms::MePolyRedistributePtsImpl::Redistribute | ( | const MePolyOffsetterOutput & | a_input, |
MePolyOffsetterOutput & | a_out, | ||
int | a_polyOffsetIter | ||
) |
Redistributes points on closed loop polylines. The length of edges in the redistribution comes from a size function that is interpolated to the points that make up the polylines. By default this size function comes from the edge lengths in the original polygon.
a_input | Input closed loop polylines |
a_out | Redistributed closed loop polylines |
a_polyOffsetIter | Number of iterations from the polygon boundary |
Definition at line 321 of file MePolyRedistributePts.cpp.
References InterpEdgeLengths(), IntersectWithTris(), LoopToVecPt3d(), m_intersectWithTris, xms::MePolyOffsetterOutput::m_loops, xms::MePolyOffsetterOutput::m_loopTypes, m_polyOffsetIter, xms::MePolyOffsetterOutput::m_pts, RedistPts(), and RedistPtsToOutput().
Redistributes points on a polyline.
[in] | a_polyLine | Input polyline |
Definition at line 355 of file MePolyRedistributePts.cpp.
References InterpEdgeLengths(), IntersectWithTris(), m_curvatureRedist, m_featureSizeCurvature, m_intersectWithTris, m_meanSpacingCurvature, m_minimumCurvature, m_smoothCurvature, and RedistPts().
|
inlineoverridevirtual |
Sets the bias for constant value size function.
a_sizeBias | Transition rate for size function |
Definition at line 97 of file MePolyRedistributePts.cpp.
References m_biasConstSize, m_curvatureRedist, and m_sizeBias.
|
inlineoverridevirtual |
Sets the size function to a constant value.
a_size | The element edge size. |
Definition at line 87 of file MePolyRedistributePts.cpp.
References m_constSize, and m_curvatureRedist.
Referenced by MePolyRedistributePtsUnitTests::testInterpEdgeLengths3().
|
overridevirtual |
Sets the size function interpolator.
a_interp | Size function interpolator class |
Definition at line 211 of file MePolyRedistributePts.cpp.
References CreatePolyIntersector(), m_curvatureRedist, m_interp, m_intersectWithTris, m_sizePts, m_sizeTris, and xms::TrTriangulator::Triangulate().
|
overridevirtual |
Creates an interpolator that uses the spacing on the input polygon as its scalar.
a_outPoly | The outside polygon |
a_inPolys | Inside polygons that are inside of a_outPoly |
a_sizeBias | A factor used in transitioning the size |
Definition at line 242 of file MePolyRedistributePts.cpp.
References m_constSize, m_curvatureRedist, m_distSqTol, m_maxLength, m_minLength, m_polyPts, m_sizeBias, MdistSq(), SizeFromPolyCalcAveEdgeLengthAtPts(), xms::Pt3< T >::x, and xms::Pt3< T >::y.
Referenced by MePolyRedistributePtsUnitTests::testInterpEdgeLengths(), MePolyRedistributePtsUnitTests::testInterpEdgeLengths1(), and MePolyRedistributePtsUnitTests::testInterpEdgeLengths2().
|
override |
Specifies that curvature redistribution will be used.
[in] | a_featureSize | The size of the smallest feature in the polyline to be detected. Large values will generate point distributions that follow coarser curvatures. |
[in] | a_meanSpacing | The mean spacing between the distributed points. |
[in] | a_minimumCurvature | The value of the curvature to be used instead of 0 in staight lines. It limits the maximum spacing between points. If not included, the default is 0.001. |
[in] | a_smooth | Detemines if the curvatures are to be averaged by a rolling 0.25-0.5-0.25 weighted rolling average. |
Definition at line 301 of file MePolyRedistributePts.cpp.
References m_curvatureRedist, m_featureSizeCurvature, m_meanSpacingCurvature, m_minimumCurvature, m_smoothCurvature, and xms::MePolyRedistributePtsCurvature::New().
|
overridevirtual |
returns a size based on the xy location
[in] | a_location | the location |
Definition at line 380 of file MePolyRedistributePts.cpp.
References xmlog::error, InterpEdgeLengths(), m_curvatureRedist, XM_LOG, and XM_NODATA.
void xms::MePolyRedistributePtsImpl::SizeFromPolyAddEdgeLengths | ( | const VecPt3d & | a_pts | ) |
Calculates average edge lengths at each point in a loop defining a polygon.
a_pts | Locations that define a polygon |
Definition at line 972 of file MePolyRedistributePts.cpp.
References m_maxLength, m_minLength, m_polyEdgeLengths, m_polyPts, xms::Pt3< T >::x, and xms::Pt3< T >::y.
Referenced by SizeFromPolyCalcAveEdgeLengthAtPts().
void xms::MePolyRedistributePtsImpl::SizeFromPolyCalcAveEdgeLengthAtPts | ( | const VecPt3d & | a_outPoly, |
const VecPt3d2d & | a_inPolys | ||
) |
Calculates average edge lengths at each point in a loop defining a polygon.
a_outPoly | Outside polygon |
a_inPolys | Inside polygons that are in a_outPoly |
Definition at line 958 of file MePolyRedistributePts.cpp.
References m_maxLength, m_minLength, and SizeFromPolyAddEdgeLengths().
Referenced by SetSizeFuncFromPoly().
|
overridevirtual |
returns a string for use in the python repr attribute
Definition at line 402 of file MePolyRedistributePts.cpp.
References m_constSize, m_featureSizeCurvature, m_interp, m_meanSpacingCurvature, m_minimumCurvature, m_sizeBias, m_smoothCurvature, STRstd(), and XM_NONE.
void xms::MePolyRedistributePtsImpl::TvaluesForSeg | ( | size_t | a_idx, |
size_t | a_nextIdx, | ||
const VecDbl & | a_segLengths, | ||
const VecDbl & | a_segTvalues, | ||
const VecDbl & | a_interpLengths, | ||
double & | a_pcntin, | ||
VecDbl & | a_tVals | ||
) |
A single segment of a polygon is analyzed to see where points are redistributed on that segment.
a_idx | Index of the segment |
a_nextIdx | The next index in the array. Since this is a closed loop this value can wrap back to 0 |
a_segLengths | Vector of segment lengths |
a_segTvalues | Vector of parametric values for the end points of segments relative to the total polyline length |
a_interpLengths | Vector of interpolated edgelengths at the end points of the segments |
a_pcntin | A running percentage that is added to by this method. |
a_tVals | Vector of parametric values for redistributed points. Filled by this method. |
Definition at line 911 of file MePolyRedistributePts.cpp.
Referenced by RedistPts().
double xms::MePolyRedistributePtsImpl::m_featureSizeCurvature |
Used by curvature redistribution. The size of the smallest feature in the polyline to be detected. Large values will generate point distributions that follow coarser curvatures.
Definition at line 167 of file MePolyRedistributePts.cpp.
Referenced by Redistribute(), SetUseCurvatureRedistribution(), and ToPyRepr().
double xms::MePolyRedistributePtsImpl::m_minimumCurvature |
Used by curvature redistribution. The value of the curvature to be used instead of 0 in staight lines. It limits the maximum spacing between points. If not included, the default is 0.001.
Definition at line 173 of file MePolyRedistributePts.cpp.
Referenced by Redistribute(), SetUseCurvatureRedistribution(), and ToPyRepr().
int xms::MePolyRedistributePtsImpl::m_polyOffsetIter |
number of iterations from the polygon boundary
Definition at line 164 of file MePolyRedistributePts.cpp.
Referenced by InterpEdgeLengths(), and Redistribute().
VecInt2d xms::MePolyRedistributePtsImpl::m_polys |
polygon definition of triangles for m_polyIntersector
Definition at line 159 of file MePolyRedistributePts.cpp.
Referenced by CreatePolyIntersector().
bool xms::MePolyRedistributePtsImpl::m_smoothCurvature |
Used by curvature redistribution. Detemines if the curvatures are to be averaged by a rolling 0.25-0.5-0.25 weighted rolling average.
Definition at line 176 of file MePolyRedistributePts.cpp.
Referenced by Redistribute(), SetUseCurvatureRedistribution(), and ToPyRepr().