MCPcopy Create free account
hub / github.com/Profactor/cv-plot / step

Method step

CvPlot/examples/DoublePendulum.h:9–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7class DoublePendulum {
8public:
9 void step() {
10 double dt1 = 6 / (m*l*l)*(2 * p1 - 3 * cos(t1 - t2)*p2) / (16 - 9 * cos(t1 - t2)*cos(t1 - t2));
11 double dt2 = 6 / (m*l*l)*(8 * p2 - 3 * cos(t1 - t2)*p1) / (16 - 9 * cos(t1 - t2)*cos(t1 - t2));
12 double dp1 = -.5*m*l*l*(dt1*dt2*sin(t1 - t2) + 3 * g / l * sin(t1));
13 double dp2 = -.5*m*l*l*(-dt1 * dt2*sin(t1 - t2) + g / l * sin(t2));
14 t1 += dt1 * dt;
15 t2 += dt2 * dt;
16 p1 += dp1 * dt;
17 p2 += dp2 * dt;
18 traceVec.push_back(point2());
19 if (traceVec.size() > maxTraceSize) {
20 traceVec.erase(traceVec.begin());
21 }
22 }
23 cv::Point2d point1() const {
24 return { l * sin(t1), l * -cos(t1) };
25 }

Callers 1

examples_gui.cppFile · 0.80

Calls 2

sizeMethod · 0.80
beginMethod · 0.45

Tested by

no test coverage detected