OpenWalnut
1.4.0
|
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) |
Resample this line so there are only segements of the given length. | |
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. |
WLine::WLine | ( | const std::vector< WPosition > & | points | ) | [explicit] |
WLine::WLine | ( | ) |
void WLine::removeAdjacentDuplicates | ( | ) |
Collapse samplepoints which are equal and neighboured.
Definition at line 124 of file WLine.cpp.
References WMixinVector< ValueT >::back(), wlimits::DBL_EPS, WMixinVector< WPosition >::empty(), 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 78 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 | ) |
Resample this line so there are only segements of the given length.
newSegementLength |
Definition at line 147 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::testResamplingByNewSegementLengthTravelingOutOfTheCircle(), WLineTest::testResamplingByNewSegementLengthWithLineHavingJustOnePoint(), and WLineTest::testResamplingByNewSegmentLengthWithZeroLine().
void WLine::reverseOrder | ( | ) |
Reverses the order of the points.
(mirroring)
Definition at line 62 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 243 of file WLine.cpp.
References WMixinVector< ValueT >::at(), WMixinVector< WPosition >::at(), reverseOrder(), WMixinVector< ValueT >::size(), and WMixinVector< WPosition >::size().