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

Method arc_to

dep/agg/include/agg_path_storage.h:989–1037  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

987 //------------------------------------------------------------------------
988 template <class VC>
989 void path_base<VC>::arc_to(double rx,
990 double ry,
991 double angle,
992 bool large_arc_flag,
993 bool sweep_flag,
994 double x,
995 double y)
996 {
997 if (m_vertices.total_vertices() && is_vertex(m_vertices.last_command()))
998 {
999 const double epsilon = 1e-30;
1000 double x0 = 0.0;
1001 double y0 = 0.0;
1002 m_vertices.last_vertex(&x0, &y0);
1003
1004 rx = std::fabs(rx);
1005 ry = std::fabs(ry);
1006
1007 // Ensure radii are valid
1008 //-------------------------
1009 if (rx < epsilon || ry < epsilon)
1010 {
1011 line_to(x, y);
1012 return;
1013 }
1014
1015 if (calc_distance(x0, y0, x, y) < epsilon)
1016 {
1017 // If the endpoints (x, y) and (x0, y0) are identical, then this
1018 // is equivalent to omitting the elliptical arc segment
1019 // entirely.
1020 return;
1021 }
1022 bezier_arc_svg a(
1023 x0, y0, rx, ry, angle, large_arc_flag, sweep_flag, x, y);
1024 if (a.radii_ok())
1025 {
1026 join_path(a);
1027 }
1028 else
1029 {
1030 line_to(x, y);
1031 }
1032 }
1033 else
1034 {
1035 move_to(x, y);
1036 }
1037 }
1038
1039 //------------------------------------------------------------------------
1040 template <class VC>

Callers 1

arcToMethod · 0.80

Calls 6

is_vertexFunction · 0.85
calc_distanceFunction · 0.85
radii_okMethod · 0.80
total_verticesMethod · 0.45
last_commandMethod · 0.45
last_vertexMethod · 0.45

Tested by

no test coverage detected