xmsmesh  1.0
xms::MePolyRedistributePtsImpl Class Reference

Redistributes points along polylines using a size function. More...

Inheritance diagram for xms::MePolyRedistributePtsImpl:
xms::MePolyRedistributePts

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< VecPt3dm_polyPts
 polygon point locations
 
VecDbl m_polyEdgeLengths
 edge lengths of the polygon
 
BSHP< InterpBasem_interp
 interpolation class given to this class
 
BSHP< VecPt3dm_sizePts
 points from the m_interp class
 
BSHP< VecIntm_sizeTris
 triangles from the m_interp class
 
BSHP< GmMultiPolyIntersectorm_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< MePolyRedistributePtsCurvaturem_curvatureRedist
 Point redistributor that uses curvature.
 

Additional Inherited Members

- Static Public Member Functions inherited from xms::MePolyRedistributePts
static BSHP< MePolyRedistributePtsNew ()
 Creates an instance of this class. More...
 
- Protected Member Functions inherited from xms::MePolyRedistributePts
 MePolyRedistributePts ()
 constructor
 

Detailed Description

Redistributes points along polylines using a size function.

Definition at line 57 of file MePolyRedistributePts.cpp.

Member Function Documentation

◆ CalcInterpWeights()

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.

Parameters
a_ptThe location being interpolated to.
a_wtVector of weights calculated by this function
a_d2Vector of distance squared
a_sumWtSum 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().

◆ CalcSegLengths()

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.

Parameters
a_ptsVector of locations.
a_segLengthVector of segment lengths. Filled by this method.
a_segTvaluesVector 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().

◆ GetSegmentFromTval()

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.

Parameters
a_segTvaluesVector of parametric values of segment endpoints relative to the perimeter of the closed loop.
a_tValParametric value along closed loop.
a_segIdxIndex for starting the search of a_segTvalues and can be modified by this method when the segment is found.
a_segT0The parametric t value for the start of the found segment
a_segT1The parametric t value for the end of the found segment

Definition at line 1038 of file MePolyRedistributePts.cpp.

References XM_ASSERT.

Referenced by RedistPts().

◆ InterpEdgeLengths()

void xms::MePolyRedistributePtsImpl::InterpEdgeLengths ( const VecPt3d a_pts,
VecDbl a_lengths 
)

◆ InterpToPoint()

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.

Parameters
[in]a_idxIndex of point
[in]a_ptsVector of point locations
[out]a_lengthsVector of lengths. Value at a_idx computed.
[out]a_wtVector of weights from polygon points filled in CalcInterpWeights.
[out]a_d2Vector of distance squared between polygon points and the point at a_idx that is filled by CalcInterpWeights.
[in]a_biasA 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().

◆ IntersectWithTris()

void xms::MePolyRedistributePtsImpl::IntersectWithTris ( VecPt3d a_pts)

Creates a vector of pts from indices into another vector of points.

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

◆ LoopToVecPt3d()

VecPt3d xms::MePolyRedistributePtsImpl::LoopToVecPt3d ( const VecSizet a_idx,
const VecPt3d a_pts 
)

Creates a vector of pts from indices into another vector of points.

Parameters
a_idxVector of indices into the a_pts vector. Defines the closed loop polyline.
a_ptsVector of locations.
Returns
Vector of locations defining the loop.

Definition at line 427 of file MePolyRedistributePts.cpp.

Referenced by Redistribute().

◆ RedistPts()

◆ RedistPts2()

VecPt3d xms::MePolyRedistributePtsImpl::RedistPts2 ( const VecPt3d a_pts,
const VecDbl a_interpLengths 
)

Uses interpolated lengths to redistribute points on a polyline.

Parameters
a_ptsVector of locations.
a_interpLengthsVector of interpolated lengths.
Returns
Vector of locations of redistributed points

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

◆ RedistPtsToOutput()

void xms::MePolyRedistributePtsImpl::RedistPtsToOutput ( const VecPt3d a_pts,
int  a_polyType,
MePolyOffsetterOutput a_out 
)

Move the redistributed points to the output class.

Parameters
a_ptsVector of locations of the redistributed points.
a_polyTypeThe type of polygon that is represented by a_idx (MePolyOffsetter::polytype)
a_outThe 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().

◆ Redistribute() [1/2]

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.

Parameters
a_inputInput closed loop polylines
a_outRedistributed closed loop polylines
a_polyOffsetIterNumber 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().

◆ Redistribute() [2/2]

VecPt3d xms::MePolyRedistributePtsImpl::Redistribute ( const VecPt3d a_polyLine)
overridevirtual

Redistributes points on a polyline.

Parameters
[in]a_polyLineInput polyline
Returns
Redistributed 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().

◆ SetConstantSizeBias()

virtual void xms::MePolyRedistributePtsImpl::SetConstantSizeBias ( double  a_sizeBias)
inlineoverridevirtual

Sets the bias for constant value size function.

Parameters
a_sizeBiasTransition rate for size function

Definition at line 97 of file MePolyRedistributePts.cpp.

References m_biasConstSize, m_curvatureRedist, and m_sizeBias.

◆ SetConstantSizeFunc()

virtual void xms::MePolyRedistributePtsImpl::SetConstantSizeFunc ( double  a_size)
inlineoverridevirtual

Sets the size function to a constant value.

Parameters
a_sizeThe element edge size.

Definition at line 87 of file MePolyRedistributePts.cpp.

References m_constSize, and m_curvatureRedist.

Referenced by MePolyRedistributePtsUnitTests::testInterpEdgeLengths3().

◆ SetSizeFunc()

void xms::MePolyRedistributePtsImpl::SetSizeFunc ( BSHP< InterpBase a_interp)
overridevirtual

Sets the size function interpolator.

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

◆ SetSizeFuncFromPoly()

void xms::MePolyRedistributePtsImpl::SetSizeFuncFromPoly ( const VecPt3d a_outPoly,
const VecPt3d2d a_inPolys,
double  a_sizeBias 
)
overridevirtual

Creates an interpolator that uses the spacing on the input polygon as its scalar.

Parameters
a_outPolyThe outside polygon
a_inPolysInside polygons that are inside of a_outPoly
a_sizeBiasA 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().

◆ SetUseCurvatureRedistribution()

void xms::MePolyRedistributePtsImpl::SetUseCurvatureRedistribution ( double  a_featureSize,
double  a_meanSpacing,
double  a_minimumCurvature,
bool  a_smooth 
)
override

Specifies that curvature redistribution will be used.

Parameters
[in]a_featureSizeThe size of the smallest feature in the polyline to be detected. Large values will generate point distributions that follow coarser curvatures.
[in]a_meanSpacingThe mean spacing between the distributed points.
[in]a_minimumCurvatureThe 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_smoothDetemines 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().

◆ SizeFromLocation()

double xms::MePolyRedistributePtsImpl::SizeFromLocation ( const Pt3d a_location)
overridevirtual

returns a size based on the xy location

Parameters
[in]a_locationthe location
Returns
size function value for the desired edge length at the location

Definition at line 380 of file MePolyRedistributePts.cpp.

References xmlog::error, InterpEdgeLengths(), m_curvatureRedist, XM_LOG, and XM_NODATA.

◆ SizeFromPolyAddEdgeLengths()

void xms::MePolyRedistributePtsImpl::SizeFromPolyAddEdgeLengths ( const VecPt3d a_pts)

Calculates average edge lengths at each point in a loop defining a polygon.

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

◆ 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.

Parameters
a_outPolyOutside polygon
a_inPolysInside polygons that are in a_outPoly

Definition at line 958 of file MePolyRedistributePts.cpp.

References m_maxLength, m_minLength, and SizeFromPolyAddEdgeLengths().

Referenced by SetSizeFuncFromPoly().

◆ ToPyRepr()

std::string xms::MePolyRedistributePtsImpl::ToPyRepr ( ) const
overridevirtual

returns a string for use in the python repr attribute

Returns
a repr string

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.

◆ TvaluesForSeg()

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.

Parameters
a_idxIndex of the segment
a_nextIdxThe next index in the array. Since this is a closed loop this value can wrap back to 0
a_segLengthsVector of segment lengths
a_segTvaluesVector of parametric values for the end points of segments relative to the total polyline length
a_interpLengthsVector of interpolated edgelengths at the end points of the segments
a_pcntinA running percentage that is added to by this method.
a_tValsVector of parametric values for redistributed points. Filled by this method.

Definition at line 911 of file MePolyRedistributePts.cpp.

Referenced by RedistPts().

Member Data Documentation

◆ m_featureSizeCurvature

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

◆ m_minimumCurvature

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

◆ m_polyOffsetIter

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

◆ m_polys

VecInt2d xms::MePolyRedistributePtsImpl::m_polys

polygon definition of triangles for m_polyIntersector

Definition at line 159 of file MePolyRedistributePts.cpp.

Referenced by CreatePolyIntersector().

◆ m_smoothCurvature

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


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