xmsmesh
1.0
|
Redistributes the point locations on a polyline or polygon based on curvature. More...
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< MePolyRedistributePtsCurvature > | New () |
Creates an instance of this class. More... | |
Protected Member Functions inherited from xms::MePolyRedistributePtsCurvature | |
MePolyRedistributePtsCurvature () | |
constructor | |
Redistributes the point locations on a polyline or polygon based on curvature.
Definition at line 45 of file MePolyRedistributePtsCurvature.cpp.
void xms::MePolyRedistributePtsCurvatureImpl::CalculateCurvature | ( | double | a_featureSize, |
double | a_minimumCurvature | ||
) |
Calculates the curvature at the points where it has not yet been calculated.
[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_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. |
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().
void xms::MePolyRedistributePtsCurvatureImpl::DoSmoothing | ( | bool | a_smooth | ) |
Shifts half an interval and aggregates the curvature data in closed polygon.
[in] | a_smooth | flag 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().
double xms::MePolyRedistributePtsCurvatureImpl::GetCurvatureFromParameter | ( | double | a_param, |
double | a_interval | ||
) |
Redistribute points according to curvature.
[in] | a_param | Point, in parameterized station form, where the curvature will be calculated. |
[in] | a_interval | Parameterized form of the feature_size. Determines the two other points used to calculate the curvature at tc |
Definition at line 267 of file MePolyRedistributePtsCurvature.cpp.
References GetParameterIFM(), GetPointFromParameter(), gmCircumcircleWithTol(), and m_tol.
Referenced by CalculateCurvature().
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.
[in] | a_param | A parameterized station [0,1] of the central point. |
[in] | a_interval | A parameterized form of the feature size. Determines the two other points used to calculate the curvature at tc. |
[out] | a_ti | Parameter of the initial point. |
[out] | a_tm | Parameter of the mid point. |
[out] | a_tf | Parameter of the final point. |
Definition at line 326 of file MePolyRedistributePtsCurvature.cpp.
References m_open.
Referenced by GetCurvatureFromParameter().
Pt3d xms::MePolyRedistributePtsCurvatureImpl::GetPointFromParameter | ( | double | a_param | ) |
Get location based on parametric value a_param.
[in] | a_param | The parameterized position between [0, 1] along the curve. |
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().
void xms::MePolyRedistributePtsCurvatureImpl::GetSignificantPoints | ( | double | a_featureSize | ) |
Redistribute points according to curvature.
[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. |
Definition at line 228 of file MePolyRedistributePtsCurvature.cpp.
References m_accumulatedSegmentLengths, m_curvature, m_length, m_parametricDistance, m_points, m_segmentLengths, and XM_ASSERT.
Referenced by PlacePoints(), MePolyRedistributePtsCurvatureUnitTests::testCalculateCurvature(), MePolyRedistributePtsCurvatureUnitTests::testDoSmoothing(), MePolyRedistributePtsCurvatureUnitTests::testGetSignificantPoints(), MePolyRedistributePtsCurvatureUnitTests::testNewPointsFromParamCurvs(), MePolyRedistributePtsCurvatureUnitTests::testShiftAndAggregateClosed(), and MePolyRedistributePtsCurvatureUnitTests::testShiftAndAggregateOpen().
VecPt3d xms::MePolyRedistributePtsCurvatureImpl::NewPointsFromParamCurvs | ( | int | a_numPoints | ) |
Shifts half an interval and aggregates the curvature data in closed polygon.
[in] | a_numPoints | the number of desired points |
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().
VecPt3d xms::MePolyRedistributePtsCurvatureImpl::PlacePoints | ( | double | a_featureSize, |
int | a_numPoints, | ||
double | a_minimumCurvature, | ||
bool | a_smooth | ||
) |
Redistribute points according to curvature.
[in] | a_featureSize | The 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_numPoints | The number of points to be distributed along the polyline. |
[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 171 of file MePolyRedistributePtsCurvature.cpp.
References CalculateCurvature(), DoSmoothing(), GetSignificantPoints(), m_open, NewPointsFromParamCurvs(), ShiftAndAggregateClosed(), and ShiftAndAggregateOpen().
Referenced by Redistribute().
|
virtual |
Redistribute points according to curvature.
[in] | a_points | Points defining a closed polygon (if last point is the same as the first) or open polyline. |
[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 straight 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 115 of file MePolyRedistributePtsCurvature.cpp.
References m_length, PlacePoints(), Setup(), and XM_ENSURE_TRUE.
Referenced by MePolyRedistributePtsCurvatureIntermediateTests::testCoastline(), and MePolyRedistributePtsCurvatureIntermediateTests::testIsland().
void xms::MePolyRedistributePtsCurvatureImpl::Setup | ( | const VecPt3d & | a_points | ) |
sets up the class to do a Redistribute operation
[in] | a_points | The locations of the input polyline or polygon |
Definition at line 133 of file MePolyRedistributePtsCurvature.cpp.
References gmExtents2D(), m_accumulatedSegmentLengths, m_curvature, m_length, m_open, m_parametricDistance, m_points, m_segmentLengths, m_tol, Mdist(), xms::Pt3< T >::x, and xms::Pt3< T >::y.
Referenced by Redistribute(), MePolyRedistributePtsCurvatureUnitTests::testCalculateCurvature(), MePolyRedistributePtsCurvatureUnitTests::testDoSmoothing(), MePolyRedistributePtsCurvatureUnitTests::testGetSignificantPoints(), MePolyRedistributePtsCurvatureUnitTests::testNewPointsFromParamCurvs(), MePolyRedistributePtsCurvatureUnitTests::testSetup(), MePolyRedistributePtsCurvatureUnitTests::testShiftAndAggregateClosed(), and MePolyRedistributePtsCurvatureUnitTests::testShiftAndAggregateOpen().