16 this->varRadius()->setRange(0.0, 10.0);
22 this->varLocation()->attach(callback);
23 this->varScale()->attach(callback);
24 this->varRotation()->attach(callback);
26 this->varRadius()->attach(callback);
28 auto wireRender = std::make_shared<GLWireframeVisualModule>();
29 wireRender->setColor(
Color(0, 1, 0));
30 this->stateOutline()->connect(wireRender->inEdgeSet());
44 auto sampling_distance = this->varSamplingDistance()->getData();
45 if (sampling_distance <
EPSILON)
46 sampling_distance = 0.005;
48 auto center = this->varLocation()->getData();
49 auto scale = this->varScale()->getData();
52 auto r = this->varRadius()->getData();
54 std::vector<Coord> pos_list;
55 std::vector<Coord> vel_list;
57 Real velMag = this->varVelocityMagnitude()->getData();
68 for (
Real x = -a; x <= a; x += sampling_distance)
70 for (
Real z = -b; z <= b; z += sampling_distance)
72 if ((x * x * invA2 + z * z * invB2) < 1)
76 pos_list.push_back(tr * p);
77 vel_list.push_back(v0);
82 if (pos_list.size() > 0) {
98 std::vector<Coord> vertices;
99 std::vector<TopologyModule::Edge> edges;
101 auto center = this->varLocation()->getData();
102 auto scale = this->varScale()->getData();
105 auto r = this->varRadius()->getData();
110 Real deltaTheta = 2 *
M_PI / segNum;
112 for (
int i = 0; i < segNum; i++)
114 Real x = r *
sin(i * deltaTheta);
115 Real z = r *
cos(i * deltaTheta);
117 vertices.push_back(tr *
Coord(x, 0, z));
121 auto edgeTopo = this->stateOutline()->getDataPtr();
123 edgeTopo->setPoints(vertices);
124 edgeTopo->setEdges(edges);
void resetStates() override
DArray< Coord > mVelocity
DArray< Coord > mPosition