28 #include "../common/exceptions/WOutOfBounds.h"
29 #include "../common/WAssert.h"
30 #include "../common/WColor.h"
31 #include "../common/math/linearAlgebra/WPosition.h"
33 #include "WDataSetPoints.h"
41 m_vertices( vertices ),
45 WAssert( vertices->size() % 3 == 0,
"Number of floats in the vertex array must be a multiple of 3" );
48 size_t numPoints = vertices->size() / 3;
49 WAssert( ( colors->size() / 4 == numPoints ) ||
50 ( colors->size() / 3 == numPoints ) ||
51 ( colors->size() / 1 == numPoints )
52 ,
"Number of floats in the color array must be 1,3, or 4 per vertex" );
60 m_vertices( vertices ),
63 WAssert( vertices->size() % 3 == 0,
"Number of floats in the vertex array must be a multiple of 3" );
66 size_t numPoints = vertices->size() / 3;
67 WAssert( ( colors->size() / 4 == numPoints ) ||
68 ( colors->size() / 3 == numPoints ) ||
69 ( colors->size() / 1 == numPoints )
70 ,
"Number of floats in the color array must be 1,3, or 4 per vertex" );
106 for(
size_t pointIdx = 3; pointIdx <
m_vertices->size(); pointIdx+=3 )
108 minX = std::min(
m_vertices->operator[]( pointIdx + 0 ), minX );
109 minY = std::min(
m_vertices->operator[]( pointIdx + 1 ), minY );
110 minZ = std::min(
m_vertices->operator[]( pointIdx + 2 ), minZ );
111 maxX = std::max(
m_vertices->operator[]( pointIdx + 0 ), maxX );
112 maxY = std::max(
m_vertices->operator[]( pointIdx + 1 ), maxY );
113 maxZ = std::max(
m_vertices->operator[]( pointIdx + 2 ), maxZ );
135 return "WDataSetPoints";
140 return "Dataset which contains points without any topological relation.";
172 throw WOutOfBounds(
"The specified index is invalid." );
189 throw WOutOfBounds(
"The specified index is invalid." );
195 return WColor(
m_colors->operator[]( pointIdx * 1 + 0 ),
196 m_colors->operator[]( pointIdx * 1 + 0 ),
197 m_colors->operator[]( pointIdx * 1 + 0 ),
200 return WColor(
m_colors->operator[]( pointIdx * 3 + 0 ),
201 m_colors->operator[]( pointIdx * 3 + 1 ),
202 m_colors->operator[]( pointIdx * 3 + 2 ),
205 return WColor(
m_colors->operator[]( pointIdx * 4 + 0 ),
206 m_colors->operator[]( pointIdx * 4 + 1 ),
207 m_colors->operator[]( pointIdx * 4 + 2 ),
208 m_colors->operator[]( pointIdx * 4 + 3 ) );
210 return WColor( 1.0, 1.0, 1.0, 1.0 );
216 return ( pointIdx < m_vertices->
size() / 3 );