PeriDyno 0.9.2
Loading...
Searching...
No Matches
CubeSampler.cpp
Go to the documentation of this file.
1#include "CubeSampler.h"
2
4
5namespace dyno
6{
7 template<typename TDataType>
10 {
11 this->varSamplingDistance()->setRange(0.001, 1.0);
12 }
13
14 template<typename TDataType>
16 {
17 auto box = this->inCube()->getData();
18
19 Coord u = box.u;
20 Coord v = box.v;
21 Coord w = box.w;
22
23 Coord ext = box.extent;
24 Coord center = box.center;
25
26 Real s = std::max(Real(0.001), this->varSamplingDistance()->getData());
27
28 int nx = ext[0] / s;
29 int ny = ext[1] / s;
30 int nz = ext[2] / s;
31
32 std::vector<Coord> points;
33 for (int i = -nx; i <= nx; i++)
34 {
35 for (int j = -ny; j <= ny; j++)
36 {
37 for (int k = -nz; k <= nz; k++)
38 {
39 Coord p = center + (i * s) * u + (j * s) * v + (k * s) * w;
40 points.push_back(p);
41 }
42 }
43 }
44
45 auto ptSet = this->statePointSet()->getDataPtr();
46
47 ptSet->setPoints(points);
48
49 points.clear();
50 }
51
53}
#define DEFINE_CLASS(name)
Definition Object.h:140
QWindow * w
Definition QtImGui.cpp:152
double Real
Definition Typedef.inl:23
void resetStates() override
TDataType::Real Real
Definition CubeSampler.h:28
TDataType::Coord Coord
Definition CubeSampler.h:29
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:24
ArrayMap< T, DeviceType::GPU > DArrayMap
Definition ArrayMap.inl:80