16 this->varWidth()->setRange(0.01, 10.0f);
17 this->varHeight()->setRange(0.01, 10.0f);
19 this->varSamplingDistance()->setValue(0.008f);
25 this->varLocation()->attach(callback);
26 this->varScale()->attach(callback);
27 this->varRotation()->attach(callback);
29 this->varWidth()->attach(callback);
30 this->varHeight()->attach(callback);
32 mPlane = std::make_shared< PoissonPlane<TDataType>>();
34 auto wireRender = std::make_shared<GLWireframeVisualModule>();
35 wireRender->setColor(
Color(0, 1, 0));
36 this->stateOutline()->connect(wireRender->inEdgeSet());
51 uint delayStart = this->varDelayStart()->getValue();
63 std::vector<Vec2f> temp_points =
mPlane->getPoints();
65 auto sampling_distance = this->varSamplingDistance()->getData();
67 if (sampling_distance <
EPSILON)
68 sampling_distance =
Real(0.005);
70 auto center = this->varLocation()->getData();
71 auto scale = this->varScale()->getData();
77 std::vector<Coord> pos_list;
78 std::vector<Coord> vel_list;
80 Coord v0 = this->varVelocityMagnitude()->getData()*
quat.rotate(
Vec3f(0, -1, 0));
82 auto w = 0.5 * this->varWidth()->getData();
83 auto h = 0.5 * this->varHeight()->getData();
90 if (this->varEmitterShape()->getData() == EmitterShape::Round)
92 Real radius = w < h ? w : h;
94 mPlane->varUpper()->setValue(
Vec2f(radius, radius));
95 mPlane->varLower()->setValue(
Vec2f(-radius, -radius));
97 mPlane->varSamplingDistance()->setValue(this->varSamplingDistance()->getValue());
100 for (
int i = 0; i < temp_points.size(); i++)
102 if (
sqrt(temp_points[i][0] * temp_points[i][0] + temp_points[i][1] * temp_points[i][1]) < radius)
104 Coord pos_temp =
Coord(temp_points[i][0], 0.0, temp_points[i][1]);
105 pos_list.push_back(tr * pos_temp);
106 vel_list.push_back(v0);
116 mPlane->varSamplingDistance()->setValue(this->varSamplingDistance()->getValue());
119 for (
int i = 0; i < temp_points.size(); i++)
121 Coord pos_temp =
Coord(temp_points[i][0], 0.0, temp_points[i][1]);
122 pos_list.push_back(tr * pos_temp);
123 vel_list.push_back(v0);
127 if (pos_list.size() > 0)
144 std::vector<Coord> vertices;
145 std::vector<TopologyModule::Edge> edges;
147 auto center = this->varLocation()->getData();
148 auto scale = this->varScale()->getData();
152 auto w = this->varWidth()->getData();
153 auto h = this->varHeight()->getData();
157 auto Nx = tr *
Coord(0.5 * w, 0, 0);
158 auto Nz = tr *
Coord(0, 0, 0.5 * h);
160 vertices.push_back(center + Nx + Nz);
161 vertices.push_back(center + Nx - Nz);
162 vertices.push_back(center - Nx - Nz);
163 vertices.push_back(center - Nx + Nz);
170 auto edgeTopo = this->stateOutline()->getDataPtr();
172 edgeTopo->setPoints(vertices);
173 edgeTopo->setEdges(edges);
DArray< Coord > mVelocity
DArray< Coord > mPosition