27 #include "WDataCreatorFiberRandom.h"
43 size_t numVertsPerFiber,
52 std::uniform_real_distribution< double > unif( 0.0, 1.0 );
53 std::default_random_engine re;
56 for(
size_t fidx = 0; fidx < numFibers; ++fidx )
58 double x1 = unif( re ) * size.x();
59 double y1 = unif( re ) * size.y();
60 double z1 = unif( re ) * size.z();
61 double x2 = unif( re ) * size.x();
62 double y2 = unif( re ) * size.y();
63 double z2 = unif( re ) * size.z();
68 WVector3d ray = ( v2 - v1 ) / numVertsPerFiber;
70 fibIdx->push_back( fidx * numVertsPerFiber );
71 lengths->push_back( numVertsPerFiber );
73 for(
size_t vidx = 0; vidx < numVertsPerFiber; ++vidx )
77 vertices->push_back( origin.x() + v1.
x() + vec.
x() );
78 vertices->push_back( origin.y() + v1.
y() + vec.
y() );
79 vertices->push_back( origin.z() + v1.
z() + vec.
z() );
81 colors->push_back( color.x() );
82 colors->push_back( color.y() );
83 colors->push_back( color.z() );
84 fibIdxVertexMap->push_back( fidx );
virtual ~WDataCreatorFiberRandom()
Destructor.
WDataCreatorFiberRandom()
Default constructor.
virtual void operator()(int seed, WProgress::SPtr progress, const WColor &color, size_t numFibers, size_t numVertsPerFiber, const WPosition &origin, const WPosition &size, WDataSetFibers::VertexArray vertices, WDataSetFibers::IndexArray fibIdx, WDataSetFibers::LengthArray lengths, WDataSetFibers::IndexArray fibIdxVertexMap, WDataSetFibers::ColorArray colors)
Create the dataset.
Define the interface which is injected into an WObjectNDIP.
std::shared_ptr< std::vector< size_t > > IndexArray
Index list indexing fibers in VertexArray in terms of vertex numbers.
std::shared_ptr< std::vector< float > > ColorArray
Colors for each vertex in VertexArray.
std::shared_ptr< std::vector< size_t > > LengthArray
Lengths of fibers in terms of vertices.
std::shared_ptr< std::vector< float > > VertexArray
List of vertex coordinates in term of components of vertices.
ValueT & z()
Access z element of vector.
ValueT & y()
Access y element of vector.
ValueT & x()
Access x element of vector.
This is a base class for everything which has a Name,Description,Icon and Properties (=NDIP).
This only is a 3d double vector.
std::shared_ptr< WProgress > SPtr
Shared pointer on a WProgress.