MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / calculate

Method calculate

dep/agg/src/agg_vcgen_smooth_poly1.cpp:80–98  ·  view source on GitHub ↗

------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

78
79 //------------------------------------------------------------------------
80 void vcgen_smooth_poly1::calculate(const vertex_dist& v0,
81 const vertex_dist& v1,
82 const vertex_dist& v2,
83 const vertex_dist& v3)
84 {
85
86 double k1 = v0.dist / (v0.dist + v1.dist);
87 double k2 = v1.dist / (v1.dist + v2.dist);
88
89 double xm1 = v0.x + (v2.x - v0.x) * k1;
90 double ym1 = v0.y + (v2.y - v0.y) * k1;
91 double xm2 = v1.x + (v3.x - v1.x) * k2;
92 double ym2 = v1.y + (v3.y - v1.y) * k2;
93
94 m_ctrl1_x = v1.x + m_smooth_value * (v2.x - xm1);
95 m_ctrl1_y = v1.y + m_smooth_value * (v2.y - ym1);
96 m_ctrl2_x = v2.x + m_smooth_value * (v1.x - xm2);
97 m_ctrl2_y = v2.y + m_smooth_value * (v1.y - ym2);
98 }
99
100
101 //------------------------------------------------------------------------

Callers 1

imageFilterMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected