16 this->varWidth()->setRange(0.01, 10.0f);
17 this->varHeight()->setRange(0.01, 10.0f);
23 this->varLocation()->attach(callback);
24 this->varScale()->attach(callback);
25 this->varRotation()->attach(callback);
27 this->varWidth()->attach(callback);
28 this->varHeight()->attach(callback);
30 auto wireRender = std::make_shared<GLWireframeVisualModule>();
31 wireRender->setColor(
Color(0, 1, 0));
32 this->stateOutline()->connect(wireRender->inEdgeSet());
44 auto sampling_distance = this->varSamplingDistance()->getData();
46 if (sampling_distance <
EPSILON)
47 sampling_distance =
Real(0.005);
49 auto center = this->varLocation()->getData();
50 auto scale = this->varScale()->getData();
56 std::vector<Coord> pos_list;
57 std::vector<Coord> vel_list;
59 Coord v0 = this->varVelocityMagnitude()->getData()*
quat.rotate(
Vec3f(0, -1, 0));
61 auto w = 0.5 * this->varWidth()->getData();
62 auto h = 0.5 * this->varHeight()->getData();
64 for (
Real x = -w; x <= w; x += sampling_distance)
66 for (
Real z = -h; z <= h; z += sampling_distance)
71 pos_list.push_back(tr * p);
72 vel_list.push_back(v0);
77 if (pos_list.size() > 0)
94 std::vector<Coord> vertices;
95 std::vector<TopologyModule::Edge> edges;
97 auto center = this->varLocation()->getData();
98 auto scale = this->varScale()->getData();
102 auto w = this->varWidth()->getData();
103 auto h = this->varHeight()->getData();
107 auto Nx = tr *
Coord(0.5 * w, 0, 0);
108 auto Nz = tr *
Coord(0, 0, 0.5 * h);
110 vertices.push_back(center + Nx + Nz);
111 vertices.push_back(center + Nx - Nz);
112 vertices.push_back(center - Nx - Nz);
113 vertices.push_back(center - Nx + Nz);
120 auto edgeTopo = this->stateOutline()->getDataPtr();
122 edgeTopo->setPoints(vertices);
123 edgeTopo->setEdges(edges);
void resetStates() override
DArray< Coord > mVelocity
DArray< Coord > mPosition