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

Method init

dep/agg/src/agg_curves.cpp:44–83  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

42
43 //------------------------------------------------------------------------
44 void curve3_inc::init(double x1, double y1,
45 double x2, double y2,
46 double x3, double y3)
47 {
48 m_start_x = x1;
49 m_start_y = y1;
50 m_end_x = x3;
51 m_end_y = y3;
52
53 double dx1 = x2 - x1;
54 double dy1 = y2 - y1;
55 double dx2 = x3 - x2;
56 double dy2 = y3 - y2;
57
58 double len = std::sqrt(dx1 * dx1 + dy1 * dy1) + std::sqrt(dx2 * dx2 + dy2 * dy2);
59
60 m_num_steps = uround(len * 0.25 * m_scale);
61
62 if(m_num_steps < 4)
63 {
64 m_num_steps = 4;
65 }
66
67 double subdivide_step = 1.0 / m_num_steps;
68 double subdivide_step2 = subdivide_step * subdivide_step;
69
70 double tmpx = (x1 - x2 * 2.0 + x3) * subdivide_step2;
71 double tmpy = (y1 - y2 * 2.0 + y3) * subdivide_step2;
72
73 m_saved_fx = m_fx = x1;
74 m_saved_fy = m_fy = y1;
75
76 m_saved_dfx = m_dfx = tmpx + (x2 - x1) * (2.0 * subdivide_step);
77 m_saved_dfy = m_dfy = tmpy + (y2 - y1) * (2.0 * subdivide_step);
78
79 m_ddfx = tmpx * 2.0;
80 m_ddfy = tmpy * 2.0;
81
82 m_step = m_num_steps;
83 }
84
85 //------------------------------------------------------------------------
86 void curve3_inc::rewind(unsigned)

Callers

nothing calls this directly

Calls 3

uroundFunction · 0.85
MSC60_fix_ICEFunction · 0.85
remove_allMethod · 0.45

Tested by

no test coverage detected