xmsmesh  1.0
xms::MePolyRedistributePtsCurvatureImpl Class Reference

Redistributes the point locations on a polyline or polygon based on curvature. More...

Inheritance diagram for xms::MePolyRedistributePtsCurvatureImpl:
xms::MePolyRedistributePtsCurvature

Public Member Functions

virtual VecPt3d Redistribute (const VecPt3d &a_points, double a_featureSize, double a_mean_spacing, double a_minimumCurvature=0.001, bool a_smooth=false)
 Redistribute points according to curvature. More...
 
void Setup (const VecPt3d &)
 sets up the class to do a Redistribute operation More...
 
VecPt3d PlacePoints (double a_featureSize, int a_numPoints, double a_minimumCurvature, bool a_smooth)
 Redistribute points according to curvature. More...
 
void GetSignificantPoints (double a_featureSize)
 Redistribute points according to curvature. More...
 
void CalculateCurvature (double a_featureSize, double a_minimumCurvature)
 Calculates the curvature at the points where it has not yet been calculated. More...
 
double GetCurvatureFromParameter (double a_param, double a_interval)
 Redistribute points according to curvature. More...
 
Pt3d GetPointFromParameter (double a_param)
 Get location based on parametric value a_param. More...
 
void GetParameterIFM (double a_param, double a_interval, double &a_ti, double &a_tm, double &a_tf)
 Calculates the parameterized station values of the two point at each side of tc. More...
 
void ShiftAndAggregateOpen ()
 Shifts half an interval and aggregates the curvature data in an open polyline.
 
void ShiftAndAggregateClosed ()
 Shifts half an interval and aggregates the curvature data in closed polygon.
 
void DoSmoothing (bool a_smooth)
 Shifts half an interval and aggregates the curvature data in closed polygon. More...
 
VecPt3d NewPointsFromParamCurvs (int a_numPoints)
 Shifts half an interval and aggregates the curvature data in closed polygon. More...
 
- Public Member Functions inherited from xms::MePolyRedistributePtsCurvature
virtual ~MePolyRedistributePtsCurvature ()
 destructor
 

Public Attributes

VecPt3d m_points
 locations defining polyline/polygon
 
VecDbl m_segmentLengths
 length of each segment
 
VecDbl m_accumulatedSegmentLengths
 accumulated length of polyline
 
VecDbl m_parametricDistance
 distance (0-1) from starting to ending point
 
VecDbl m_curvature
 curvature at each point
 
double m_length = 0.0
 total length
 
bool m_open = false
 false means polygon, true mean polyline
 
double m_tol = 1e-6
 tolerance used for geometric calculations
 
std::map< double, int > m_distMap
 map of distances and indices
 

Additional Inherited Members

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

Detailed Description

Redistributes the point locations on a polyline or polygon based on curvature.

Definition at line 45 of file MePolyRedistributePtsCurvature.cpp.

Member Function Documentation

◆ CalculateCurvature()

void xms::MePolyRedistributePtsCurvatureImpl::CalculateCurvature ( double  a_featureSize,
double  a_minimumCurvature 
)

Calculates the curvature at the points where it has not yet been calculated.

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

Definition at line 199 of file MePolyRedistributePtsCurvature.cpp.

References GetCurvatureFromParameter(), m_accumulatedSegmentLengths, m_curvature, m_distMap, m_length, and m_parametricDistance.

Referenced by PlacePoints(), MePolyRedistributePtsCurvatureUnitTests::testCalculateCurvature(), MePolyRedistributePtsCurvatureUnitTests::testDoSmoothing(), MePolyRedistributePtsCurvatureUnitTests::testNewPointsFromParamCurvs(), MePolyRedistributePtsCurvatureUnitTests::testShiftAndAggregateClosed(), and MePolyRedistributePtsCurvatureUnitTests::testShiftAndAggregateOpen().

◆ DoSmoothing()

void xms::MePolyRedistributePtsCurvatureImpl::DoSmoothing ( bool  a_smooth)

Shifts half an interval and aggregates the curvature data in closed polygon.

Parameters
[in]a_smoothflag to indicate if smoothing should happen

Definition at line 439 of file MePolyRedistributePtsCurvature.cpp.

References m_curvature.

Referenced by PlacePoints(), MePolyRedistributePtsCurvatureUnitTests::testDoSmoothing(), and MePolyRedistributePtsCurvatureUnitTests::testNewPointsFromParamCurvs().

◆ GetCurvatureFromParameter()

double xms::MePolyRedistributePtsCurvatureImpl::GetCurvatureFromParameter ( double  a_param,
double  a_interval 
)

Redistribute points according to curvature.

Parameters
[in]a_paramPoint, in parameterized station form, where the curvature will be calculated.
[in]a_intervalParameterized form of the feature_size. Determines the two other points used to calculate the curvature at tc
Returns
The computed curvature.

Definition at line 267 of file MePolyRedistributePtsCurvature.cpp.

References GetParameterIFM(), GetPointFromParameter(), gmCircumcircleWithTol(), and m_tol.

Referenced by CalculateCurvature().

◆ GetParameterIFM()

void xms::MePolyRedistributePtsCurvatureImpl::GetParameterIFM ( double  a_param,
double  a_interval,
double &  a_ti,
double &  a_tm,
double &  a_tf 
)

Calculates the parameterized station values of the two point at each side of tc.

Parameters
[in]a_paramA parameterized station [0,1] of the central point.
[in]a_intervalA parameterized form of the feature size. Determines the two other points used to calculate the curvature at tc.
[out]a_tiParameter of the initial point.
[out]a_tmParameter of the mid point.
[out]a_tfParameter of the final point.

Definition at line 326 of file MePolyRedistributePtsCurvature.cpp.

References m_open.

Referenced by GetCurvatureFromParameter().

◆ GetPointFromParameter()

Pt3d xms::MePolyRedistributePtsCurvatureImpl::GetPointFromParameter ( double  a_param)

Get location based on parametric value a_param.

Parameters
[in]a_paramThe parameterized position between [0, 1] along the curve.
Returns
The point for the paramater.

Definition at line 287 of file MePolyRedistributePtsCurvature.cpp.

References m_accumulatedSegmentLengths, m_distMap, m_length, m_points, m_segmentLengths, xms::Pt3< T >::x, and xms::Pt3< T >::y.

Referenced by GetCurvatureFromParameter(), and NewPointsFromParamCurvs().

◆ GetSignificantPoints()

void xms::MePolyRedistributePtsCurvatureImpl::GetSignificantPoints ( double  a_featureSize)

◆ NewPointsFromParamCurvs()

VecPt3d xms::MePolyRedistributePtsCurvatureImpl::NewPointsFromParamCurvs ( int  a_numPoints)

Shifts half an interval and aggregates the curvature data in closed polygon.

Parameters
[in]a_numPointsthe number of desired points
Returns
vector of points redistributed according to curvature

Definition at line 461 of file MePolyRedistributePtsCurvature.cpp.

References GetPointFromParameter(), LT_TOL(), m_curvature, m_parametricDistance, and m_points.

Referenced by PlacePoints(), and MePolyRedistributePtsCurvatureUnitTests::testNewPointsFromParamCurvs().

◆ PlacePoints()

VecPt3d xms::MePolyRedistributePtsCurvatureImpl::PlacePoints ( double  a_featureSize,
int  a_numPoints,
double  a_minimumCurvature,
bool  a_smooth 
)

Redistribute points according to curvature.

Parameters
[in]a_featureSizeThe maximum distance around each point when computing curvature at that point. In the future we may want to change the algorithm to use this distance around each point instead of just using it as a maximum.
[in]a_numPointsThe number of points to be distributed along the polyline.
[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.
Returns
a vector of the redistributed points along the interior of the polyline. It does NOT include the original first and last point.

Definition at line 171 of file MePolyRedistributePtsCurvature.cpp.

References CalculateCurvature(), DoSmoothing(), GetSignificantPoints(), m_open, NewPointsFromParamCurvs(), ShiftAndAggregateClosed(), and ShiftAndAggregateOpen().

Referenced by Redistribute().

◆ Redistribute()

VecPt3d xms::MePolyRedistributePtsCurvatureImpl::Redistribute ( const VecPt3d a_points,
double  a_featureSize,
double  a_meanSpacing,
double  a_minimumCurvature = 0.001,
bool  a_smooth = false 
)
virtual

Redistribute points according to curvature.

Parameters
[in]a_pointsPoints defining a closed polygon (if last point is the same as the first) or open polyline.
[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 straight 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.
Returns
a vector of the redistributed points.
Todo:
: Guarantee an even number of segments?

Definition at line 115 of file MePolyRedistributePtsCurvature.cpp.

References m_length, PlacePoints(), Setup(), and XM_ENSURE_TRUE.

Referenced by MePolyRedistributePtsCurvatureIntermediateTests::testCoastline(), and MePolyRedistributePtsCurvatureIntermediateTests::testIsland().

◆ Setup()


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