A line is an ordered sequence of WPositions. More...
#include <WLine.h>
Public Member Functions | |
WLine (const std::vector< WPosition > &points) | |
Generates a new line out of a sequence of points. | |
WLine () | |
Creates an empty line. | |
void | resampleByNumberOfPoints (size_t numPoints) |
Resample this line so it has a number of given points afterwards. | |
void | resampleBySegmentLength (double newSegementLength) |
void | reverseOrder () |
Reverses the order of the points. | |
void | removeAdjacentDuplicates () |
Collapse samplepoints which are equal and neighboured. | |
void | unifyDirectionBy (const WLine &other) |
Put the line into reverse ordering if the reverse ordering would have a similar direction to the given line. |
A line is an ordered sequence of WPositions.
Definition at line 43 of file WLine.h.
WLine::WLine | ( | const std::vector< WPosition > & | points | ) | [explicit] |
void WLine::removeAdjacentDuplicates | ( | ) |
Collapse samplepoints which are equal and neighboured.
Definition at line 123 of file WLine.cpp.
References WMixinVector< ValueT >::back(), WMixinVector< WPosition >::begin(), wlimits::DBL_EPS, WMixinVector< WPosition >::empty(), WMixinVector< WPosition >::end(), WMixinVector< WPosition >::front(), WMixinVector< WPosition >::operator=(), WMixinVector< ValueT >::push_back(), WMixinVector< ValueT >::reserve(), and WMixinVector< WPosition >::size().
Referenced by resampleBySegmentLength(), and WLineTest::testRemoveAdjacentDuplicates().
void WLine::resampleByNumberOfPoints | ( | size_t | numPoints | ) |
Resample this line so it has a number of given points afterwards.
numPoints | Number of sampling points. |
Definition at line 77 of file WLine.cpp.
References WMixinVector< WPosition >::at(), WMixinVector< WPosition >::front(), WMixinVector< WPosition >::operator=(), WMixinVector< ValueT >::push_back(), WMixinVector< ValueT >::reserve(), and WMixinVector< WPosition >::size().
Referenced by WLineTest::testDownSampleLine(), WLineTest::testManySampelsInBetweenOfTwoOldPoints(), WLineTest::testNumericalStabilityOfResampling(), WLineTest::testSamplingPointsAreExactlyInTheOldSegmentCenterAndCorners(), and WLineTest::testSamplingWithSameNumberOfPoints().
void WLine::resampleBySegmentLength | ( | double | newSegementLength | ) |
newSegementLength |
Definition at line 145 of file WLine.cpp.
References WMixinVector< ValueT >::back(), WMixinVector< WPosition >::empty(), WMixinVector< WPosition >::front(), WMixinVector< WPosition >::operator=(), WMixinVector< ValueT >::push_back(), removeAdjacentDuplicates(), and WMixinVector< WPosition >::size().
Referenced by WLineTest::testResamplingByNewSegementLengthOldSegmentLengthBiggerAsNewSegmentLength(), WLineTest::testResamplingByNewSegementLengthRemainderGreaterAsHalfOfNewSegmentLength(), WLineTest::testResamplingByNewSegementLengthTravelingOutOfTheCircle(), WLineTest::testResamplingByNewSegementLengthWithLineHavingJustOnePoint(), and WLineTest::testResamplingByNewSegmentLengthWithZeroLine().
void WLine::reverseOrder | ( | ) |
Reverses the order of the points.
(mirroring)
Definition at line 61 of file WLine.cpp.
References WMixinVector< WPosition >::begin(), and WMixinVector< WPosition >::end().
Referenced by WLineTest::testReverseOrdering(), and unifyDirectionBy().
void WLine::unifyDirectionBy | ( | const WLine & | other | ) |
Put the line into reverse ordering if the reverse ordering would have a similar direction to the given line.
That means if the start point (or multiple selected sample points) of the given line will better match to end point (or multiple selected sample points) of this line (in term of direction) the line is reordered.
other | The line giving the direction to align this line to. |
Definition at line 249 of file WLine.cpp.
References WMixinVector< WPosition >::at(), WMixinVector< ValueT >::at(), reverseOrder(), WMixinVector< WPosition >::size(), and WMixinVector< ValueT >::size().