16 this->varScale()->setRange(0.001f, 10.0f);
21 this->statePointSet()->promoteOuput();
23 auto pointGlModule = std::make_shared<GLPointVisualModule>();
24 this->statePointSet()->connect(pointGlModule->inPointSet());
26 pointGlModule->varPointSize()->setValue(0.01);
28 auto wireframe = std::make_shared<GLWireframeVisualModule>();
29 this->stateEdgeSet()->connect(wireframe->inEdgeSet());
31 wireframe->setColor(
Color(1, 1, 0));
32 wireframe->varLineWidth()->setValue(0.1);
33 wireframe->varRenderMode()->setCurrentKey(1);
35 this->statePointSet()->promoteOuput();
36 auto curve = this->varCurve()->getValue();
37 curve.setUseSquard(
true);
38 this->varCurve()->setValue(curve);
42 this->varLocation()->attach(callback);
43 this->varScale()->attach(callback);
44 this->varRotation()->attach(callback);
46 this->varUniformScale()->attach(callback);
47 this->varCurve()->attach(callback);
61 auto center = this->varLocation()->getData();
62 auto rot = this->varRotation()->getData();
63 auto scale = this->varScale()->getData();
64 auto uniformScale = this->varUniformScale()->getData();
65 auto pointSet = this->statePointSet()->getDataPtr();
66 auto curve = this->varCurve()->getValue();
67 auto floatCoord = curve.getPoints();
68 int length = floatCoord.size();
69 std::vector<Coord> vertices;
75 for (
size_t i = 0; i < length; i++)
77 Location =
Coord(floatCoord[i].x, floatCoord[i].y, 0);
79 vertices.push_back(Location);
83 if (curve.curveClose && curve.resample ==
true && vertices.size()>=3)
86 vertices.erase(vertices.end() - 1);
97 return center + q2.
rotate(v - center);
100 int numpt = vertices.size();
102 for (
int i = 0; i < numpt; i++)
105 vertices[i] = RVt(vertices[i] * scale * uniformScale + RVt(center));
108 int s = vertices.size();
110 pointSet->setPoints(vertices);
118 std::vector<TopologyModule::Edge> edges;
121 auto edgeSet = this->stateEdgeSet()->getDataPtr();
123 int ptnum = vertices.size();
129 for (
int i = 0; i < ptnum - 1; i++)
137 if (curve.curveClose ==
true && vertices.size()>=3)
144 edgeSet->setPoints(vertices);
145 edgeSet->setEdges(edges);
DYN_FUNC Vector< Real, 3 > rotate(const Vector< Real, 3 > &v) const
Rotate a vector by the quaternion, guarantee the quaternion is normalized before rotating the vector.