OpenWalnut
1.4.0
|
Dataset to store a bunch of points without order or topology. More...
#include <WDataSetPoints.h>
Public Types | |
enum | ColorType { GRAY = 1, RGB = 3, RGBA = 4 } |
The type of colors we have for each point. More... | |
typedef boost::shared_ptr < WDataSetPoints > | SPtr |
Pointer to dataset. | |
typedef boost::shared_ptr < const WDataSetPoints > | ConstSPtr |
Pointer to const dataset. | |
typedef boost::shared_ptr < std::vector< float > > | VertexArray |
List of vertex coordinates in term of components of vertices. | |
typedef boost::shared_ptr < std::vector< float > > | ColorArray |
Colors for each vertex in VertexArray. | |
Public Member Functions | |
WDataSetPoints (VertexArray vertices, ColorArray colors, WBoundingBox boundingBox) | |
Constructs a new set of points. | |
WDataSetPoints (VertexArray vertices, ColorArray colors) | |
Constructs a new set of points. | |
WDataSetPoints () | |
Constructs a new set of points. | |
virtual | ~WDataSetPoints () |
Destructor. | |
size_t | size () const |
Get number of points in this data set. | |
virtual bool | isTexture () const |
Determines whether this dataset can be used as a texture. | |
virtual const std::string | getName () const |
Gets the name of this prototype. | |
virtual const std::string | getDescription () const |
Gets the description for this prototype. | |
VertexArray | getVertices () const |
Getter for the point vertices. | |
ColorArray | getColors () const |
Getter for the point colors. | |
WBoundingBox | getBoundingBox () const |
Get the bounding box. | |
WPosition | operator[] (const size_t pointIdx) const |
Query coordinates of a given point. | |
WPosition | getPosition (const size_t pointIdx) const |
Query coordinates of a given point. | |
WColor | getColor (const size_t pointIdx) const |
The color of a given point. | |
bool | isValidPointIdx (const size_t pointIdx) const |
Is this a valid point index? | |
ColorType | getColorType () const |
Check the type of color. | |
Static Public Member Functions | |
static boost::shared_ptr < WPrototyped > | getPrototype () |
Returns a prototype instantiated with the true type of the deriving class. | |
Static Protected Attributes | |
static boost::shared_ptr < WPrototyped > | m_prototype = boost::shared_ptr< WPrototyped >() |
The prototype as singleton. | |
Private Member Functions | |
void | init (bool calcBB=false) |
Initialize arrays and bbox if needed. | |
Private Attributes | |
VertexArray | m_vertices |
Point vector for all points. | |
ColorArray | m_colors |
An array of the colors per vertex. | |
ColorType | m_colorType |
Which colortype do we use in m_colors. | |
WBoundingBox | m_bb |
Axis aligned bounding box for all point-vertices of this dataset. |
Dataset to store a bunch of points without order or topology.
Definition at line 40 of file WDataSetPoints.h.
typedef boost::shared_ptr< std::vector< float > > WDataSetPoints::ColorArray |
Colors for each vertex in VertexArray.
Definition at line 62 of file WDataSetPoints.h.
typedef boost::shared_ptr< const WDataSetPoints > WDataSetPoints::ConstSPtr |
Pointer to const dataset.
Reimplemented from WDataSet.
Definition at line 52 of file WDataSetPoints.h.
typedef boost::shared_ptr< WDataSetPoints > WDataSetPoints::SPtr |
typedef boost::shared_ptr< std::vector< float > > WDataSetPoints::VertexArray |
List of vertex coordinates in term of components of vertices.
Definition at line 57 of file WDataSetPoints.h.
The type of colors we have for each point.
Definition at line 194 of file WDataSetPoints.h.
WDataSetPoints::WDataSetPoints | ( | WDataSetPoints::VertexArray | vertices, |
WDataSetPoints::ColorArray | colors, | ||
WBoundingBox | boundingBox | ||
) |
Constructs a new set of points.
If no color is specified, white is used for all points.
vertices | the vertices of the points, stored in x1,y1,z1,x2,y2,z2, ..., xn,yn,zn scheme |
colors | the colors of each vertex. Can be NULL.. Stored as R1,G1,B1,A1, ... Rn,Gn,Bn,An |
boundingBox | The bounding box of the points (first minimum, second maximum). |
Definition at line 38 of file WDataSetPoints.cpp.
References init().
WDataSetPoints::WDataSetPoints | ( | WDataSetPoints::VertexArray | vertices, |
WDataSetPoints::ColorArray | colors | ||
) |
Constructs a new set of points.
The bounding box is calculated during construction. If no color is specified, white is used for all points.
vertices | the vertices of the points, stored in x1,y1,z1,x2,y2,z2, ..., xn,yn,zn scheme |
colors | the colors of each vertex. Can be NULL.. Stored as R1,[G1,B1,[A1,]] ... Rn,[Gn,Bn,[An]] |
Definition at line 58 of file WDataSetPoints.cpp.
References init().
Constructs a new set of points.
The constructed instance is empty..
Definition at line 76 of file WDataSetPoints.cpp.
Referenced by getPrototype().
WDataSetPoints::~WDataSetPoints | ( | ) | [virtual] |
Destructor.
Definition at line 81 of file WDataSetPoints.cpp.
WBoundingBox WDataSetPoints::getBoundingBox | ( | ) | const |
Get the bounding box.
Definition at line 163 of file WDataSetPoints.cpp.
References m_bb.
WColor WDataSetPoints::getColor | ( | const size_t | pointIdx | ) | const |
The color of a given point.
WOutOfBounds | if invalid index is used. |
pointIdx | the point index. |
Definition at line 185 of file WDataSetPoints.cpp.
References getColorType(), isValidPointIdx(), and m_colors.
Getter for the point colors.
Definition at line 158 of file WDataSetPoints.cpp.
References m_colors.
Check the type of color.
Definition at line 219 of file WDataSetPoints.cpp.
References m_colorType.
Referenced by getColor().
const std::string WDataSetPoints::getDescription | ( | ) | const [virtual] |
Gets the description for this prototype.
Reimplemented from WDataSet.
Definition at line 138 of file WDataSetPoints.cpp.
const std::string WDataSetPoints::getName | ( | ) | const [virtual] |
Gets the name of this prototype.
Reimplemented from WDataSet.
Definition at line 133 of file WDataSetPoints.cpp.
WPosition WDataSetPoints::getPosition | ( | const size_t | pointIdx | ) | const |
Query coordinates of a given point.
WOutOfBounds | if invalid index is used. |
pointIdx | the point index. |
Definition at line 180 of file WDataSetPoints.cpp.
References operator[]().
boost::shared_ptr< WPrototyped > WDataSetPoints::getPrototype | ( | ) | [static] |
Returns a prototype instantiated with the true type of the deriving class.
Reimplemented from WDataSet.
Definition at line 143 of file WDataSetPoints.cpp.
References m_prototype, and WDataSetPoints().
Getter for the point vertices.
Definition at line 153 of file WDataSetPoints.cpp.
References m_vertices.
void WDataSetPoints::init | ( | bool | calcBB = false | ) | [private] |
Initialize arrays and bbox if needed.
Used during construction.
calcBB | if true, the bounding box is calculated |
Definition at line 86 of file WDataSetPoints.cpp.
References m_bb, m_colors, m_colorType, and m_vertices.
Referenced by WDataSetPoints().
bool WDataSetPoints::isTexture | ( | ) | const [virtual] |
Determines whether this dataset can be used as a texture.
Reimplemented from WDataSet.
Definition at line 128 of file WDataSetPoints.cpp.
bool WDataSetPoints::isValidPointIdx | ( | const size_t | pointIdx | ) | const |
Is this a valid point index?
pointIdx | the index to check |
Definition at line 214 of file WDataSetPoints.cpp.
References size().
Referenced by getColor(), and operator[]().
Query coordinates of a given point.
WOutOfBounds | if invalid index is used. |
pointIdx | the point index. |
Definition at line 168 of file WDataSetPoints.cpp.
References isValidPointIdx(), and m_vertices.
Referenced by getPosition().
size_t WDataSetPoints::size | ( | ) | const |
Get number of points in this data set.
Definition at line 123 of file WDataSetPoints.cpp.
References m_vertices.
Referenced by isValidPointIdx().
WBoundingBox WDataSetPoints::m_bb [private] |
Axis aligned bounding box for all point-vertices of this dataset.
Definition at line 232 of file WDataSetPoints.h.
Referenced by getBoundingBox(), and init().
ColorArray WDataSetPoints::m_colors [private] |
An array of the colors per vertex.
Definition at line 222 of file WDataSetPoints.h.
Referenced by getColor(), getColors(), and init().
ColorType WDataSetPoints::m_colorType [private] |
Which colortype do we use in m_colors.
Definition at line 227 of file WDataSetPoints.h.
Referenced by getColorType(), and init().
boost::shared_ptr< WPrototyped > WDataSetPoints::m_prototype = boost::shared_ptr< WPrototyped >() [static, protected] |
The prototype as singleton.
Reimplemented from WDataSet.
Definition at line 211 of file WDataSetPoints.h.
Referenced by getPrototype().
VertexArray WDataSetPoints::m_vertices [private] |
Point vector for all points.
Definition at line 217 of file WDataSetPoints.h.
Referenced by getVertices(), init(), operator[](), and size().