OpenWalnut
1.5.0dev
|
An iterator for iterating the points of a fiber. More...
#include <WDataSetFibers.h>
Public Member Functions | |
WFiberPointsIterator () | |
Default contructor. More... | |
WFiberPointsIterator (WDataSetFibers const *fibers, std::size_t fbIdx, std::size_t idx, bool reverse=false) | |
Constructor. More... | |
WFiberPointsIterator (WFiberPointsIterator const &iter) | |
Copy constructor. More... | |
~WFiberPointsIterator () | |
Destructor. More... | |
WFiberPointsIterator & | operator= (WFiberPointsIterator const &iter) |
Copy operator. More... | |
WFiberPointsIterator & | operator++ () |
Increment operator. More... | |
WFiberPointsIterator & | operator-- () |
Decrement operator. More... | |
WFiberPointsIterator | operator++ (int) |
Increment operator. More... | |
WFiberPointsIterator | operator-- (int) |
Decrement operator. More... | |
WFiberPointsIterator | operator+ (size_t n) |
Plus operator. More... | |
WFiberPointsIterator | operator- (size_t n) |
Minus operator. More... | |
bool | operator== (WFiberPointsIterator const &rhs) const |
Compare to another point iterator. More... | |
bool | operator!= (WFiberPointsIterator const &rhs) const |
Compare to another point iterator. More... | |
WIteratorRangeUnpacker< WFiberPointsIterator > | operator, (WFiberPointsIterator &other) |
Creates a temporary object that is used to unpack an iterator range to two iterators. More... | |
operator bool () const | |
Converts to a bool that indicates whether the current iterator is valid, i.e. More... | |
WPosition | operator* () const |
Returns the coordinates of the point currently pointed to. More... | |
double | getParameter (double def=0.0, size_t parameterIndex=0) const |
Returns the parameter specified in the vertex parameter array of the dataset. More... | |
WPosition | getTangent () const |
The tangent of the point. More... | |
WColor | getColor () const |
Return the color of the point. More... | |
WColor | getColor (std::size_t idx) const |
Return the color of the point. More... | |
WColor | getColor (std::string name) const |
Return the color of the point. More... | |
WColor | getColor (const std::shared_ptr< WDataSetFibers::ColorScheme > scheme) const |
Return the color of the point. More... | |
Protected Member Functions | |
std::size_t | getBaseIndex () const |
Calculates the index of this point in the dataset arrays. More... | |
Private Attributes | |
WDataSetFibers const * | m_fibers |
The pointer to the fibers. More... | |
std::size_t | m_fiberIndex |
The index of the fiber. More... | |
std::size_t | m_index |
The index of the current point. More... | |
bool | m_reverse |
Whether to iterate backwards. More... | |
An iterator for iterating the points of a fiber.
Allows for both forward and backward iteration of points.
There are two ways to use the iterator. First:
Second:
Dereferencing the iterator provides the 3D position of the point. Other information can be gained via the various member functions.
You can check whether an iterator points to a valid point of a fiber by:
Definition at line 911 of file WDataSetFibers.h.
WFiberPointsIterator::WFiberPointsIterator | ( | ) |
Default contructor.
Creates an invalid iterator.
Definition at line 655 of file WDataSetFibers.cpp.
Referenced by operator+(), and operator-().
WFiberPointsIterator::WFiberPointsIterator | ( | WDataSetFibers const * | fibers, |
std::size_t | fbIdx, | ||
std::size_t | idx, | ||
bool | reverse = false |
||
) |
Constructor.
Creates an iterator pointing to a certain point of a fiber.
fibers | The pointer to the fiber data. |
fbIdx | The index of the fiber in the fiber dataset. |
idx | The index of the point of the current fiber. |
reverse | Whether to iterate backwards. |
Definition at line 663 of file WDataSetFibers.cpp.
WFiberPointsIterator::WFiberPointsIterator | ( | WFiberPointsIterator const & | iter | ) |
Copy constructor.
iter | The iterator to copy from. |
Definition at line 671 of file WDataSetFibers.cpp.
WFiberPointsIterator::~WFiberPointsIterator | ( | ) |
Destructor.
Definition at line 679 of file WDataSetFibers.cpp.
|
protected |
Calculates the index of this point in the dataset arrays.
But be aware that this index works vertex-wise. This mens, getting the y coordinate of the vertex in the dataset vertex array, use 3 * getBaseIndex() + 1. This depends on the type of array you like to query.
Definition at line 734 of file WDataSetFibers.cpp.
References WDataSetFibers::getLengthOfLine(), WDataSetFibers::getStartIndex(), m_fiberIndex, m_fibers, m_index, and m_reverse.
Referenced by getColor(), and getParameter().
WColor WFiberPointsIterator::getColor | ( | ) | const |
Return the color of the point.
Definition at line 835 of file WDataSetFibers.cpp.
References WDataSetFibers::getColorScheme(), and m_fibers.
Referenced by getColor().
WColor WFiberPointsIterator::getColor | ( | const std::shared_ptr< WDataSetFibers::ColorScheme > | scheme | ) | const |
Return the color of the point.
scheme | the colorscheme to use. |
WDHNoSuchDataSet | if the colorscheme does not exist. |
Definition at line 799 of file WDataSetFibers.cpp.
References getBaseIndex(), WDataSetFibers::ColorScheme::GRAY, WDataSetFibers::ColorScheme::RGB, and WDataSetFibers::ColorScheme::RGBA.
WColor WFiberPointsIterator::getColor | ( | std::size_t | idx | ) | const |
Return the color of the point.
idx | the index of the colorscheme to use. |
WDHNoSuchDataSet | if the colorscheme does not exist. |
Definition at line 840 of file WDataSetFibers.cpp.
References getColor(), WDataSetFibers::getColorScheme(), and m_fibers.
WColor WFiberPointsIterator::getColor | ( | std::string | name | ) | const |
Return the color of the point.
name | the name of the colorscheme to use. |
WDHNoSuchDataSet | if the colorscheme does not exist. |
Definition at line 845 of file WDataSetFibers.cpp.
References getColor(), WDataSetFibers::getColorScheme(), and m_fibers.
double WFiberPointsIterator::getParameter | ( | double | def = 0.0 , |
size_t | parameterIndex = 0 |
||
) | const |
Returns the parameter specified in the vertex parameter array of the dataset.
If no such array was set, the specified default will be returned.
def | the default value which will be returned if no vertex parameter array was defined. |
parameterIndex | the parameter to get. |
Definition at line 782 of file WDataSetFibers.cpp.
References getBaseIndex(), WDataSetFibers::getVertexParameters(), and m_fibers.
WPosition WFiberPointsIterator::getTangent | ( | ) | const |
The tangent of the point.
Definition at line 792 of file WDataSetFibers.cpp.
References WDataSetFibers::getLengthOfLine(), WDataSetFibers::getTangent(), m_fiberIndex, m_fibers, m_index, and m_reverse.
WFiberPointsIterator::operator bool | ( | ) | const |
Converts to a bool that indicates whether the current iterator is valid, i.e.
it points to a valid point and it is safe to dereference or use functions such as getTangent().
Definition at line 777 of file WDataSetFibers.cpp.
bool WFiberPointsIterator::operator!= | ( | WFiberPointsIterator const & | rhs | ) | const |
Compare to another point iterator.
rhs | The second point iterator. |
Definition at line 767 of file WDataSetFibers.cpp.
References operator==().
WPosition WFiberPointsIterator::operator* | ( | ) | const |
Returns the coordinates of the point currently pointed to.
Definition at line 748 of file WDataSetFibers.cpp.
References WDataSetFibers::getLengthOfLine(), WDataSetFibers::getPosition(), m_fiberIndex, m_fibers, m_index, and m_reverse.
WFiberPointsIterator WFiberPointsIterator::operator+ | ( | size_t | n | ) |
Plus operator.
Increments the iterator
n | times. |
Definition at line 724 of file WDataSetFibers.cpp.
References m_fiberIndex, m_fibers, m_index, m_reverse, and WFiberPointsIterator().
WFiberPointsIterator & WFiberPointsIterator::operator++ | ( | ) |
Increment operator.
Makes the iterator point to the next point.
Definition at line 698 of file WDataSetFibers.cpp.
References m_index.
WFiberPointsIterator WFiberPointsIterator::operator++ | ( | int | ) |
Increment operator.
Makes the iterator point to the next point.
Definition at line 704 of file WDataSetFibers.cpp.
References m_fiberIndex, m_fibers, m_index, and m_reverse.
WIteratorRangeUnpacker< WFiberPointsIterator > WFiberPointsIterator::operator, | ( | WFiberPointsIterator & | other | ) |
Creates a temporary object that is used to unpack an iterator range to two iterators.
The first of these target iterators is *this, the second is the parameter of the operator.
other | The iterator to assign the end iterator of the range to. |
Definition at line 772 of file WDataSetFibers.cpp.
WFiberPointsIterator WFiberPointsIterator::operator- | ( | size_t | n | ) |
Minus operator.
Decrements the iterator
n | times. |
Definition at line 729 of file WDataSetFibers.cpp.
References m_fiberIndex, m_fibers, m_index, m_reverse, and WFiberPointsIterator().
WFiberPointsIterator & WFiberPointsIterator::operator-- | ( | ) |
Decrement operator.
Makes the iterator point to the previous point. 3
Definition at line 711 of file WDataSetFibers.cpp.
References m_index.
WFiberPointsIterator WFiberPointsIterator::operator-- | ( | int | ) |
Decrement operator.
Makes the iterator point to the previous point.
Definition at line 717 of file WDataSetFibers.cpp.
References m_fiberIndex, m_fibers, m_index, and m_reverse.
WFiberPointsIterator & WFiberPointsIterator::operator= | ( | WFiberPointsIterator const & | iter | ) |
Copy operator.
iter | The iterator to copy from. |
Definition at line 683 of file WDataSetFibers.cpp.
References m_fiberIndex, m_fibers, m_index, and m_reverse.
bool WFiberPointsIterator::operator== | ( | WFiberPointsIterator const & | rhs | ) | const |
Compare to another point iterator.
rhs | The second point iterator. |
Definition at line 757 of file WDataSetFibers.cpp.
References m_fiberIndex, m_fibers, m_index, m_reverse, and wlog::warn().
Referenced by operator!=().
|
private |
The index of the fiber.
Definition at line 1106 of file WDataSetFibers.h.
Referenced by getBaseIndex(), getTangent(), operator*(), operator+(), operator++(), operator-(), operator--(), operator=(), and operator==().
|
private |
The pointer to the fibers.
Definition at line 1103 of file WDataSetFibers.h.
Referenced by getBaseIndex(), getColor(), getParameter(), getTangent(), operator*(), operator+(), operator++(), operator-(), operator--(), operator=(), and operator==().
|
private |
The index of the current point.
Definition at line 1109 of file WDataSetFibers.h.
Referenced by getBaseIndex(), getTangent(), operator*(), operator+(), operator++(), operator-(), operator--(), operator=(), and operator==().
|
private |
Whether to iterate backwards.
Definition at line 1112 of file WDataSetFibers.h.
Referenced by getBaseIndex(), getTangent(), operator*(), operator+(), operator++(), operator-(), operator--(), operator=(), and operator==().