Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
agg::path_base< VertexContainer > Class Template Reference

#include <src/agg/agg_path_storage.h>

Public Types

typedef VertexContainer container_type
 
typedef path_base< VertexContainer > self_type
 

Public Member Functions

 path_base ()
 
void remove_all ()
 
void free_all ()
 
unsigned start_new_path ()
 
void move_to (double x, double y)
 
void move_rel (double dx, double dy)
 
void line_to (double x, double y)
 
void line_rel (double dx, double dy)
 
void hline_to (double x)
 
void hline_rel (double dx)
 
void vline_to (double y)
 
void vline_rel (double dy)
 
void arc_to (double rx, double ry, double angle, bool large_arc_flag, bool sweep_flag, double x, double y)
 
void arc_rel (double rx, double ry, double angle, bool large_arc_flag, bool sweep_flag, double dx, double dy)
 
void curve3 (double x_ctrl, double y_ctrl, double x_to, double y_to)
 
void curve3_rel (double dx_ctrl, double dy_ctrl, double dx_to, double dy_to)
 
void curve3 (double x_to, double y_to)
 
void curve3_rel (double dx_to, double dy_to)
 
void curve4 (double x_ctrl1, double y_ctrl1, double x_ctrl2, double y_ctrl2, double x_to, double y_to)
 
void curve4_rel (double dx_ctrl1, double dy_ctrl1, double dx_ctrl2, double dy_ctrl2, double dx_to, double dy_to)
 
void curve4 (double x_ctrl2, double y_ctrl2, double x_to, double y_to)
 
void curve4_rel (double x_ctrl2, double y_ctrl2, double x_to, double y_to)
 
void end_poly (unsigned flags=path_flags_close)
 
void close_polygon (unsigned flags=path_flags_none)
 
const container_typevertices () const
 
container_typevertices ()
 
unsigned total_vertices () const
 
void rel_to_abs (double *x, double *y) const
 
unsigned last_vertex (double *x, double *y) const
 
unsigned prev_vertex (double *x, double *y) const
 
double last_x () const
 
double last_y () const
 
unsigned vertex (unsigned idx, double *x, double *y) const
 
unsigned command (unsigned idx) const
 
void modify_vertex (unsigned idx, double x, double y)
 
void modify_vertex (unsigned idx, double x, double y, unsigned cmd)
 
void modify_command (unsigned idx, unsigned cmd)
 
void rewind (unsigned path_id)
 
unsigned vertex (double *x, double *y)
 
unsigned arrange_polygon_orientation (unsigned start, path_flags_e orientation)
 
unsigned arrange_orientations (unsigned path_id, path_flags_e orientation)
 
void arrange_orientations_all_paths (path_flags_e orientation)
 
void invert_polygon (unsigned start)
 
void flip_x (double x1, double x2)
 
void flip_y (double y1, double y2)
 
template<class VertexSource >
void concat_path (VertexSource &vs, unsigned path_id=0)
 
template<class VertexSource >
void join_path (VertexSource &vs, unsigned path_id=0)
 
template<class T >
void concat_poly (const T *data, unsigned num_points, bool closed)
 
template<class T >
void join_poly (const T *data, unsigned num_points, bool closed)
 
void translate (double dx, double dy, unsigned path_id=0)
 
void translate_all_paths (double dx, double dy)
 
template<class Trans >
void transform (const Trans &trans, unsigned path_id=0)
 
template<class Trans >
void transform_all_paths (const Trans &trans)
 
unsigned align_path (unsigned idx=0)
 
void align_all_paths ()
 

Private Member Functions

unsigned perceive_polygon_orientation (unsigned start, unsigned end)
 
void invert_polygon (unsigned start, unsigned end)
 

Private Attributes

VertexContainer m_vertices
 
unsigned m_iterator
 

Detailed Description

template<class VertexContainer>
class agg::path_base< VertexContainer >

Member Typedef Documentation

◆ container_type

template<class VertexContainer >
typedef VertexContainer agg::path_base< VertexContainer >::container_type

◆ self_type

template<class VertexContainer >
typedef path_base<VertexContainer> agg::path_base< VertexContainer >::self_type

Constructor & Destructor Documentation

◆ path_base()

template<class VertexContainer >
agg::path_base< VertexContainer >::path_base ( )
inline
615: m_vertices(), m_iterator(0) {}
unsigned m_iterator
Definition agg_path_storage.h:881
VertexContainer m_vertices
Definition agg_path_storage.h:880

Member Function Documentation

◆ align_all_paths()

template<class VertexContainer >
void agg::path_base< VertexContainer >::align_all_paths ( )
inline
871 {
872 for (unsigned i = 0; i < total_vertices(); i = align_path(i));
873 }
unsigned align_path(unsigned idx=0)
Definition agg_path_storage.h:842
unsigned total_vertices() const
Definition agg_path_storage.h:1167

References agg::path_base< VertexContainer >::align_path(), and agg::path_base< VertexContainer >::total_vertices().

+ Here is the call graph for this function:

◆ align_path()

template<class VertexContainer >
unsigned agg::path_base< VertexContainer >::align_path ( unsigned  idx = 0)
inline
843 {
844 if (idx >= total_vertices() || !is_move_to(command(idx)))
845 {
846 return total_vertices();
847 }
848
849 double start_x, start_y;
850 for (; idx < total_vertices() && is_move_to(command(idx)); ++idx)
851 {
852 vertex(idx, &start_x, &start_y);
853 }
854 while (idx < total_vertices() && is_drawing(command(idx)))
855 ++idx;
856
857 double x, y;
858 if (is_drawing(vertex(idx - 1, &x, &y)) &&
859 is_equal_eps(x, start_x, 1e-8) &&
860 is_equal_eps(y, start_y, 1e-8))
861 {
862 modify_vertex(idx - 1, start_x, start_y);
863 }
864
865 while (idx < total_vertices() && !is_move_to(command(idx)))
866 ++idx;
867 return idx;
868 }
unsigned vertex(unsigned idx, double *x, double *y) const
Definition agg_path_storage.h:1202
void modify_vertex(unsigned idx, double x, double y)
Definition agg_path_storage.h:1216
const Scalar & y
Definition MathFunctions.h:552
bool is_equal_eps(T v1, T v2, T epsilon)
Definition agg_basics.h:552
bool is_drawing(unsigned c)
Definition agg_basics.h:399
bool is_move_to(unsigned c)
Definition agg_basics.h:411
TCoord< P > x(const P &p)
Definition geometry_traits.hpp:297
Definition term.c:39

References agg::is_drawing(), agg::is_equal_eps(), agg::is_move_to(), agg::path_base< VertexContainer >::modify_vertex(), agg::path_base< VertexContainer >::total_vertices(), and agg::path_base< VertexContainer >::vertex().

Referenced by agg::path_base< VertexContainer >::align_all_paths().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ arc_rel()

template<class VC >
void agg::path_base< VC >::arc_rel ( double  rx,
double  ry,
double  angle,
bool  large_arc_flag,
bool  sweep_flag,
double  dx,
double  dy 
)
1029 {
1030 rel_to_abs(&dx, &dy);
1031 arc_to(rx, ry, angle, large_arc_flag, sweep_flag, dx, dy);
1032 }
void arc_to(double rx, double ry, double angle, bool large_arc_flag, bool sweep_flag, double x, double y)
Definition agg_path_storage.h:976
void rel_to_abs(double *x, double *y) const
Definition agg_path_storage.h:898

◆ arc_to()

template<class VC >
void agg::path_base< VC >::arc_to ( double  rx,
double  ry,
double  angle,
bool  large_arc_flag,
bool  sweep_flag,
double  x,
double  y 
)
981 {
982 if(m_vertices.total_vertices() && is_vertex(m_vertices.last_command()))
983 {
984 const double epsilon = 1e-30;
985 double x0 = 0.0;
986 double y0 = 0.0;
987 m_vertices.last_vertex(&x0, &y0);
988
989 rx = fabs(rx);
990 ry = fabs(ry);
991
992 // Ensure radii are valid
993 //-------------------------
994 if(rx < epsilon || ry < epsilon)
995 {
996 line_to(x, y);
997 return;
998 }
999
1000 if(calc_distance(x0, y0, x, y) < epsilon)
1001 {
1002 // If the endpoints (x, y) and (x0, y0) are identical, then this
1003 // is equivalent to omitting the elliptical arc segment entirely.
1004 return;
1005 }
1006 bezier_arc_svg a(x0, y0, rx, ry, angle, large_arc_flag, sweep_flag, x, y);
1007 if(a.radii_ok())
1008 {
1009 join_path(a);
1010 }
1011 else
1012 {
1013 line_to(x, y);
1014 }
1015 }
1016 else
1017 {
1018 move_to(x, y);
1019 }
1020 }
void join_path(VertexSource &vs, unsigned path_id=0)
Definition agg_path_storage.h:736
void line_to(double x, double y)
Definition agg_path_storage.h:929
void move_to(double x, double y)
Definition agg_path_storage.h:914
constexpr double epsilon()
Definition DoubleSlider.hpp:28
bool is_vertex(unsigned c)
Definition agg_basics.h:393
AGG_INLINE double calc_distance(double x1, double y1, double x2, double y2)
Definition agg_math.h:57

References agg::calc_distance(), and agg::is_vertex().

+ Here is the call graph for this function:

◆ arrange_orientations()

template<class VC >
unsigned agg::path_base< VC >::arrange_orientations ( unsigned  path_id,
path_flags_e  orientation 
)
1358 {
1359 if(orientation != path_flags_none)
1360 {
1361 while(start < m_vertices.total_vertices())
1362 {
1363 start = arrange_polygon_orientation(start, orientation);
1364 if(is_stop(m_vertices.command(start)))
1365 {
1366 ++start;
1367 break;
1368 }
1369 }
1370 }
1371 return start;
1372 }
unsigned arrange_polygon_orientation(unsigned start, path_flags_e orientation)
Definition agg_path_storage.h:1318
@ path_flags_none
Definition agg_basics.h:385
bool is_stop(unsigned c)
Definition agg_basics.h:405

References agg::is_stop(), and agg::path_flags_none.

+ Here is the call graph for this function:

◆ arrange_orientations_all_paths()

template<class VC >
void agg::path_base< VC >::arrange_orientations_all_paths ( path_flags_e  orientation)
1377 {
1378 if(orientation != path_flags_none)
1379 {
1380 unsigned start = 0;
1381 while(start < m_vertices.total_vertices())
1382 {
1383 start = arrange_orientations(start, orientation);
1384 }
1385 }
1386 }
unsigned arrange_orientations(unsigned path_id, path_flags_e orientation)
Definition agg_path_storage.h:1356

References agg::path_flags_none.

◆ arrange_polygon_orientation()

template<class VC >
unsigned agg::path_base< VC >::arrange_polygon_orientation ( unsigned  start,
path_flags_e  orientation 
)
1320 {
1321 if(orientation == path_flags_none) return start;
1322
1323 // Skip all non-vertices at the beginning
1324 while(start < m_vertices.total_vertices() &&
1325 !is_vertex(m_vertices.command(start))) ++start;
1326
1327 // Skip all insignificant move_to
1328 while(start+1 < m_vertices.total_vertices() &&
1329 is_move_to(m_vertices.command(start)) &&
1330 is_move_to(m_vertices.command(start+1))) ++start;
1331
1332 // Find the last vertex
1333 unsigned end = start + 1;
1334 while(end < m_vertices.total_vertices() &&
1335 !is_next_poly(m_vertices.command(end))) ++end;
1336
1337 if(end - start > 2)
1338 {
1339 if(perceive_polygon_orientation(start, end) != unsigned(orientation))
1340 {
1341 // Invert polygon, set orientation flag, and skip all end_poly
1342 invert_polygon(start, end);
1343 unsigned cmd;
1344 while(end < m_vertices.total_vertices() &&
1345 is_end_poly(cmd = m_vertices.command(end)))
1346 {
1347 m_vertices.modify_command(end++, set_orientation(cmd, orientation));
1348 }
1349 }
1350 }
1351 return end;
1352 }
unsigned perceive_polygon_orientation(unsigned start, unsigned end)
Definition agg_path_storage.h:1252
void invert_polygon(unsigned start)
Definition agg_path_storage.h:1297
bool is_next_poly(unsigned c)
Definition agg_basics.h:454
bool is_end_poly(unsigned c)
Definition agg_basics.h:441
unsigned set_orientation(unsigned c, unsigned o)
Definition agg_basics.h:502
S::iterator end(S &sh, const PathTag &)
Definition geometry_traits.hpp:620
struct command cmd[]
Definition term.c:94

References cmd, agg::is_end_poly(), agg::is_move_to(), agg::is_next_poly(), agg::is_vertex(), agg::path_flags_none, and agg::set_orientation().

+ Here is the call graph for this function:

◆ close_polygon()

template<class VC >
void agg::path_base< VC >::close_polygon ( unsigned  flags = path_flags_none)
inline
1161 {
1162 end_poly(path_flags_close | flags);
1163 }
void end_poly(unsigned flags=path_flags_close)
Definition agg_path_storage.h:1150
@ path_flags_close
Definition agg_basics.h:388

References agg::path_flags_close.

◆ command()

template<class VC >
unsigned agg::path_base< VC >::command ( unsigned  idx) const
inline
1210 {
1211 return m_vertices.command(idx);
1212 }

◆ concat_path()

template<class VertexContainer >
template<class VertexSource >
void agg::path_base< VertexContainer >::concat_path ( VertexSource &  vs,
unsigned  path_id = 0 
)
inline
722 {
723 double x, y;
724 unsigned cmd;
725 vs.rewind(path_id);
726 while(!is_stop(cmd = vs.vertex(&x, &y)))
727 {
728 m_vertices.add_vertex(x, y, cmd);
729 }
730 }

References cmd, agg::is_stop(), and agg::path_base< VertexContainer >::m_vertices.

Referenced by agg::path_base< VertexContainer >::concat_poly().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ concat_poly()

template<class VertexContainer >
template<class T >
void agg::path_base< VertexContainer >::concat_poly ( const T *  data,
unsigned  num_points,
bool  closed 
)
inline
783 {
784 poly_plain_adaptor<T> poly(data, num_points, closed);
785 concat_path(poly);
786 }
void concat_path(VertexSource &vs, unsigned path_id=0)
Definition agg_path_storage.h:721

References agg::path_base< VertexContainer >::concat_path().

+ Here is the call graph for this function:

◆ curve3() [1/2]

template<class VC >
void agg::path_base< VC >::curve3 ( double  x_ctrl,
double  y_ctrl,
double  x_to,
double  y_to 
)
1038 {
1039 m_vertices.add_vertex(x_ctrl, y_ctrl, path_cmd_curve3);
1040 m_vertices.add_vertex(x_to, y_to, path_cmd_curve3);
1041 }
@ path_cmd_curve3
Definition agg_basics.h:373

References agg::path_cmd_curve3.

◆ curve3() [2/2]

template<class VC >
void agg::path_base< VC >::curve3 ( double  x_to,
double  y_to 
)
1057 {
1058 double x0;
1059 double y0;
1060 if(is_vertex(m_vertices.last_vertex(&x0, &y0)))
1061 {
1062 double x_ctrl;
1063 double y_ctrl;
1064 unsigned cmd = m_vertices.prev_vertex(&x_ctrl, &y_ctrl);
1065 if(is_curve(cmd))
1066 {
1067 x_ctrl = x0 + x0 - x_ctrl;
1068 y_ctrl = y0 + y0 - y_ctrl;
1069 }
1070 else
1071 {
1072 x_ctrl = x0;
1073 y_ctrl = y0;
1074 }
1075 curve3(x_ctrl, y_ctrl, x_to, y_to);
1076 }
1077 }
void curve3(double x_ctrl, double y_ctrl, double x_to, double y_to)
Definition agg_path_storage.h:1036
bool is_curve(unsigned c)
Definition agg_basics.h:423

References cmd, agg::is_curve(), and agg::is_vertex().

+ Here is the call graph for this function:

◆ curve3_rel() [1/2]

template<class VC >
void agg::path_base< VC >::curve3_rel ( double  dx_ctrl,
double  dy_ctrl,
double  dx_to,
double  dy_to 
)
1047 {
1048 rel_to_abs(&dx_ctrl, &dy_ctrl);
1049 rel_to_abs(&dx_to, &dy_to);
1050 m_vertices.add_vertex(dx_ctrl, dy_ctrl, path_cmd_curve3);
1051 m_vertices.add_vertex(dx_to, dy_to, path_cmd_curve3);
1052 }

References agg::path_cmd_curve3.

◆ curve3_rel() [2/2]

template<class VC >
void agg::path_base< VC >::curve3_rel ( double  dx_to,
double  dy_to 
)
1082 {
1083 rel_to_abs(&dx_to, &dy_to);
1084 curve3(dx_to, dy_to);
1085 }

◆ curve4() [1/2]

template<class VC >
void agg::path_base< VC >::curve4 ( double  x_ctrl1,
double  y_ctrl1,
double  x_ctrl2,
double  y_ctrl2,
double  x_to,
double  y_to 
)
1092 {
1093 m_vertices.add_vertex(x_ctrl1, y_ctrl1, path_cmd_curve4);
1094 m_vertices.add_vertex(x_ctrl2, y_ctrl2, path_cmd_curve4);
1095 m_vertices.add_vertex(x_to, y_to, path_cmd_curve4);
1096 }
@ path_cmd_curve4
Definition agg_basics.h:374

References agg::path_cmd_curve4.

◆ curve4() [2/2]

template<class VC >
void agg::path_base< VC >::curve4 ( double  x_ctrl2,
double  y_ctrl2,
double  x_to,
double  y_to 
)
1116 {
1117 double x0;
1118 double y0;
1119 if(is_vertex(last_vertex(&x0, &y0)))
1120 {
1121 double x_ctrl1;
1122 double y_ctrl1;
1123 unsigned cmd = prev_vertex(&x_ctrl1, &y_ctrl1);
1124 if(is_curve(cmd))
1125 {
1126 x_ctrl1 = x0 + x0 - x_ctrl1;
1127 y_ctrl1 = y0 + y0 - y_ctrl1;
1128 }
1129 else
1130 {
1131 x_ctrl1 = x0;
1132 y_ctrl1 = y0;
1133 }
1134 curve4(x_ctrl1, y_ctrl1, x_ctrl2, y_ctrl2, x_to, y_to);
1135 }
1136 }
unsigned last_vertex(double *x, double *y) const
Definition agg_path_storage.h:1174
void curve4(double x_ctrl1, double y_ctrl1, double x_ctrl2, double y_ctrl2, double x_to, double y_to)
Definition agg_path_storage.h:1089
unsigned prev_vertex(double *x, double *y) const
Definition agg_path_storage.h:1181

References cmd, agg::is_curve(), and agg::is_vertex().

+ Here is the call graph for this function:

◆ curve4_rel() [1/2]

template<class VC >
void agg::path_base< VC >::curve4_rel ( double  dx_ctrl1,
double  dy_ctrl1,
double  dx_ctrl2,
double  dy_ctrl2,
double  dx_to,
double  dy_to 
)
1103 {
1104 rel_to_abs(&dx_ctrl1, &dy_ctrl1);
1105 rel_to_abs(&dx_ctrl2, &dy_ctrl2);
1106 rel_to_abs(&dx_to, &dy_to);
1107 m_vertices.add_vertex(dx_ctrl1, dy_ctrl1, path_cmd_curve4);
1108 m_vertices.add_vertex(dx_ctrl2, dy_ctrl2, path_cmd_curve4);
1109 m_vertices.add_vertex(dx_to, dy_to, path_cmd_curve4);
1110 }

References agg::path_cmd_curve4.

◆ curve4_rel() [2/2]

template<class VC >
void agg::path_base< VC >::curve4_rel ( double  x_ctrl2,
double  y_ctrl2,
double  x_to,
double  y_to 
)
1142 {
1143 rel_to_abs(&dx_ctrl2, &dy_ctrl2);
1144 rel_to_abs(&dx_to, &dy_to);
1145 curve4(dx_ctrl2, dy_ctrl2, dx_to, dy_to);
1146 }

◆ end_poly()

template<class VC >
void agg::path_base< VC >::end_poly ( unsigned  flags = path_flags_close)
inline
1151 {
1152 if(is_vertex(m_vertices.last_command()))
1153 {
1154 m_vertices.add_vertex(0.0, 0.0, path_cmd_end_poly | flags);
1155 }
1156 }
@ path_cmd_end_poly
Definition agg_basics.h:378

References agg::is_vertex(), and agg::path_cmd_end_poly.

+ Here is the call graph for this function:

◆ flip_x()

template<class VC >
void agg::path_base< VC >::flip_x ( double  x1,
double  x2 
)
1391 {
1392 unsigned i;
1393 double x, y;
1394 for(i = 0; i < m_vertices.total_vertices(); i++)
1395 {
1396 unsigned cmd = m_vertices.vertex(i, &x, &y);
1397 if(is_vertex(cmd))
1398 {
1399 m_vertices.modify_vertex(i, x2 - x + x1, y);
1400 }
1401 }
1402 }

References cmd, and agg::is_vertex().

Referenced by Slic3r::sla::AGGRaster< PixelRenderer, Renderer, Rasterizer, Scanline >::flipx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flip_y()

template<class VC >
void agg::path_base< VC >::flip_y ( double  y1,
double  y2 
)
1407 {
1408 unsigned i;
1409 double x, y;
1410 for(i = 0; i < m_vertices.total_vertices(); i++)
1411 {
1412 unsigned cmd = m_vertices.vertex(i, &x, &y);
1413 if(is_vertex(cmd))
1414 {
1415 m_vertices.modify_vertex(i, x, y2 - y + y1);
1416 }
1417 }
1418 }

References cmd, and agg::is_vertex().

Referenced by Slic3r::sla::AGGRaster< PixelRenderer, Renderer, Rasterizer, Scanline >::flipy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ free_all()

template<class VertexContainer >
void agg::path_base< VertexContainer >::free_all ( )
inline

◆ hline_rel()

template<class VC >
void agg::path_base< VC >::hline_rel ( double  dx)
inline
952 {
953 double dy = 0;
954 rel_to_abs(&dx, &dy);
955 m_vertices.add_vertex(dx, dy, path_cmd_line_to);
956 }
@ path_cmd_line_to
Definition agg_basics.h:372

References agg::path_cmd_line_to.

◆ hline_to()

template<class VC >
void agg::path_base< VC >::hline_to ( double  x)
inline
945 {
946 m_vertices.add_vertex(x, last_y(), path_cmd_line_to);
947 }
double last_y() const
Definition agg_path_storage.h:1195

References agg::path_cmd_line_to.

◆ invert_polygon() [1/2]

template<class VC >
void agg::path_base< VC >::invert_polygon ( unsigned  start)
1298 {
1299 // Skip all non-vertices at the beginning
1300 while(start < m_vertices.total_vertices() &&
1301 !is_vertex(m_vertices.command(start))) ++start;
1302
1303 // Skip all insignificant move_to
1304 while(start+1 < m_vertices.total_vertices() &&
1305 is_move_to(m_vertices.command(start)) &&
1306 is_move_to(m_vertices.command(start+1))) ++start;
1307
1308 // Find the last vertex
1309 unsigned end = start + 1;
1310 while(end < m_vertices.total_vertices() &&
1311 !is_next_poly(m_vertices.command(end))) ++end;
1312
1313 invert_polygon(start, end);
1314 }

References agg::is_move_to(), agg::is_next_poly(), and agg::is_vertex().

+ Here is the call graph for this function:

◆ invert_polygon() [2/2]

template<class VC >
void agg::path_base< VC >::invert_polygon ( unsigned  start,
unsigned  end 
)
private
1273 {
1274 unsigned i;
1275 unsigned tmp_cmd = m_vertices.command(start);
1276
1277 --end; // Make "end" inclusive
1278
1279 // Shift all commands to one position
1280 for(i = start; i < end; i++)
1281 {
1282 m_vertices.modify_command(i, m_vertices.command(i + 1));
1283 }
1284
1285 // Assign starting command to the ending command
1286 m_vertices.modify_command(end, tmp_cmd);
1287
1288 // Reverse the polygon
1289 while(end > start)
1290 {
1291 m_vertices.swap_vertices(start++, end--);
1292 }
1293 }

◆ join_path()

template<class VertexContainer >
template<class VertexSource >
void agg::path_base< VertexContainer >::join_path ( VertexSource &  vs,
unsigned  path_id = 0 
)
inline
737 {
738 double x, y;
739 unsigned cmd;
740 vs.rewind(path_id);
741 cmd = vs.vertex(&x, &y);
742 if(!is_stop(cmd))
743 {
744 if(is_vertex(cmd))
745 {
746 double x0, y0;
747 unsigned cmd0 = last_vertex(&x0, &y0);
748 if(is_vertex(cmd0))
749 {
750 if(calc_distance(x, y, x0, y0) > vertex_dist_epsilon)
751 {
753 m_vertices.add_vertex(x, y, cmd);
754 }
755 }
756 else
757 {
758 if(is_stop(cmd0))
759 {
761 }
762 else
763 {
765 }
766 m_vertices.add_vertex(x, y, cmd);
767 }
768 }
769 while(!is_stop(cmd = vs.vertex(&x, &y)))
770 {
771 m_vertices.add_vertex(x, y, is_move_to(cmd) ?
772 unsigned(path_cmd_line_to) :
773 cmd);
774 }
775 }
776 }
const double vertex_dist_epsilon
Definition agg_math.h:30
@ path_cmd_move_to
Definition agg_basics.h:371

References agg::calc_distance(), cmd, agg::is_move_to(), agg::is_stop(), agg::is_vertex(), agg::path_base< VertexContainer >::last_vertex(), agg::path_base< VertexContainer >::m_vertices, agg::path_cmd_line_to, agg::path_cmd_move_to, and agg::vertex_dist_epsilon.

Referenced by agg::path_base< VertexContainer >::join_poly().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ join_poly()

template<class VertexContainer >
template<class T >
void agg::path_base< VertexContainer >::join_poly ( const T *  data,
unsigned  num_points,
bool  closed 
)
inline
793 {
794 poly_plain_adaptor<T> poly(data, num_points, closed);
795 join_path(poly);
796 }

References agg::path_base< VertexContainer >::join_path().

+ Here is the call graph for this function:

◆ last_vertex()

template<class VC >
unsigned agg::path_base< VC >::last_vertex ( double *  x,
double *  y 
) const
inline
1175 {
1176 return m_vertices.last_vertex(x, y);
1177 }

Referenced by agg::path_base< VertexContainer >::join_path().

+ Here is the caller graph for this function:

◆ last_x()

template<class VC >
double agg::path_base< VC >::last_x
inline
1189 {
1190 return m_vertices.last_x();
1191 }

◆ last_y()

template<class VC >
double agg::path_base< VC >::last_y
inline
1196 {
1197 return m_vertices.last_y();
1198 }

◆ line_rel()

template<class VC >
void agg::path_base< VC >::line_rel ( double  dx,
double  dy 
)
inline
937 {
938 rel_to_abs(&dx, &dy);
939 m_vertices.add_vertex(dx, dy, path_cmd_line_to);
940 }

References agg::path_cmd_line_to.

◆ line_to()

template<class VC >
void agg::path_base< VC >::line_to ( double  x,
double  y 
)
inline
930 {
931 m_vertices.add_vertex(x, y, path_cmd_line_to);
932 }

References agg::path_cmd_line_to.

Referenced by Slic3r::sla::AGGRaster< PixelRenderer, Renderer, Rasterizer, Scanline >::_to_path(), Slic3r::sla::AGGRaster< PixelRenderer, Renderer, Rasterizer, Scanline >::_to_path_flpxy(), and Slic3r::rasterize_polygons().

+ Here is the caller graph for this function:

◆ modify_command()

template<class VC >
void agg::path_base< VC >::modify_command ( unsigned  idx,
unsigned  cmd 
)
1231 {
1232 m_vertices.modify_command(idx, cmd);
1233 }

References cmd.

◆ modify_vertex() [1/2]

template<class VC >
void agg::path_base< VC >::modify_vertex ( unsigned  idx,
double  x,
double  y 
)
1217 {
1218 m_vertices.modify_vertex(idx, x, y);
1219 }

Referenced by agg::path_base< VertexContainer >::align_path().

+ Here is the caller graph for this function:

◆ modify_vertex() [2/2]

template<class VC >
void agg::path_base< VC >::modify_vertex ( unsigned  idx,
double  x,
double  y,
unsigned  cmd 
)
1224 {
1225 m_vertices.modify_vertex(idx, x, y, cmd);
1226 }

References cmd.

◆ move_rel()

template<class VC >
void agg::path_base< VC >::move_rel ( double  dx,
double  dy 
)
inline
922 {
923 rel_to_abs(&dx, &dy);
924 m_vertices.add_vertex(dx, dy, path_cmd_move_to);
925 }

References agg::path_cmd_move_to.

◆ move_to()

template<class VC >
void agg::path_base< VC >::move_to ( double  x,
double  y 
)
inline
915 {
916 m_vertices.add_vertex(x, y, path_cmd_move_to);
917 }

References agg::path_cmd_move_to.

Referenced by Slic3r::sla::AGGRaster< PixelRenderer, Renderer, Rasterizer, Scanline >::_to_path(), Slic3r::sla::AGGRaster< PixelRenderer, Renderer, Rasterizer, Scanline >::_to_path_flpxy(), and Slic3r::rasterize_polygons().

+ Here is the caller graph for this function:

◆ perceive_polygon_orientation()

template<class VC >
unsigned agg::path_base< VC >::perceive_polygon_orientation ( unsigned  start,
unsigned  end 
)
private
1254 {
1255 // Calculate signed area (double area to be exact)
1256 //---------------------
1257 unsigned np = end - start;
1258 double area = 0.0;
1259 unsigned i;
1260 for(i = 0; i < np; i++)
1261 {
1262 double x1, y1, x2, y2;
1263 m_vertices.vertex(start + i, &x1, &y1);
1264 m_vertices.vertex(start + (i + 1) % np, &x2, &y2);
1265 area += x1 * y2 - y1 * x2;
1266 }
1267 return (area < 0.0) ? path_flags_cw : path_flags_ccw;
1268 }
@ path_flags_cw
Definition agg_basics.h:387
@ path_flags_ccw
Definition agg_basics.h:386
Unit area(const Cntr &poly, const PathTag &)
Definition geometry_traits.hpp:971

References agg::path_flags_ccw, and agg::path_flags_cw.

◆ prev_vertex()

template<class VC >
unsigned agg::path_base< VC >::prev_vertex ( double *  x,
double *  y 
) const
inline
1182 {
1183 return m_vertices.prev_vertex(x, y);
1184 }

◆ rel_to_abs()

template<class VC >
void agg::path_base< VC >::rel_to_abs ( double *  x,
double *  y 
) const
inline
899 {
900 if(m_vertices.total_vertices())
901 {
902 double x2;
903 double y2;
904 if(is_vertex(m_vertices.last_vertex(&x2, &y2)))
905 {
906 *x += x2;
907 *y += y2;
908 }
909 }
910 }

References agg::is_vertex().

+ Here is the call graph for this function:

◆ remove_all()

template<class VertexContainer >
void agg::path_base< VertexContainer >::remove_all ( )
inline

◆ rewind()

template<class VC >
void agg::path_base< VC >::rewind ( unsigned  path_id)
inline
1238 {
1239 m_iterator = path_id;
1240 }

◆ start_new_path()

template<class VC >
unsigned agg::path_base< VC >::start_new_path
887 {
888 if(!is_stop(m_vertices.last_command()))
889 {
890 m_vertices.add_vertex(0.0, 0.0, path_cmd_stop);
891 }
892 return m_vertices.total_vertices();
893 }
@ path_cmd_stop
Definition agg_basics.h:370

References agg::is_stop(), and agg::path_cmd_stop.

+ Here is the call graph for this function:

◆ total_vertices()

template<class VC >
unsigned agg::path_base< VC >::total_vertices
inline
1168 {
1169 return m_vertices.total_vertices();
1170 }

Referenced by agg::path_base< VertexContainer >::align_all_paths(), and agg::path_base< VertexContainer >::align_path().

+ Here is the caller graph for this function:

◆ transform()

template<class VertexContainer >
template<class Trans >
void agg::path_base< VertexContainer >::transform ( const Trans &  trans,
unsigned  path_id = 0 
)
inline
805 {
806 unsigned num_ver = m_vertices.total_vertices();
807 for(; path_id < num_ver; path_id++)
808 {
809 double x, y;
810 unsigned cmd = m_vertices.vertex(path_id, &x, &y);
811 if(is_stop(cmd)) break;
812 if(is_vertex(cmd))
813 {
814 trans.transform(&x, &y);
815 m_vertices.modify_vertex(path_id, x, y);
816 }
817 }
818 }

References cmd, agg::is_stop(), agg::is_vertex(), and agg::path_base< VertexContainer >::m_vertices.

+ Here is the call graph for this function:

◆ transform_all_paths()

template<class VertexContainer >
template<class Trans >
void agg::path_base< VertexContainer >::transform_all_paths ( const Trans &  trans)
inline
823 {
824 unsigned idx;
825 unsigned num_ver = m_vertices.total_vertices();
826 for(idx = 0; idx < num_ver; idx++)
827 {
828 double x, y;
829 if(is_vertex(m_vertices.vertex(idx, &x, &y)))
830 {
831 trans.transform(&x, &y);
832 m_vertices.modify_vertex(idx, x, y);
833 }
834 }
835 }

References agg::is_vertex(), and agg::path_base< VertexContainer >::m_vertices.

+ Here is the call graph for this function:

◆ translate()

template<class VC >
void agg::path_base< VC >::translate ( double  dx,
double  dy,
unsigned  path_id = 0 
)
1423 {
1424 unsigned num_ver = m_vertices.total_vertices();
1425 for(; path_id < num_ver; path_id++)
1426 {
1427 double x, y;
1428 unsigned cmd = m_vertices.vertex(path_id, &x, &y);
1429 if(is_stop(cmd)) break;
1430 if(is_vertex(cmd))
1431 {
1432 x += dx;
1433 y += dy;
1434 m_vertices.modify_vertex(path_id, x, y);
1435 }
1436 }
1437 }

References cmd, agg::is_stop(), and agg::is_vertex().

+ Here is the call graph for this function:

◆ translate_all_paths()

template<class VC >
void agg::path_base< VC >::translate_all_paths ( double  dx,
double  dy 
)
1442 {
1443 unsigned idx;
1444 unsigned num_ver = m_vertices.total_vertices();
1445 for(idx = 0; idx < num_ver; idx++)
1446 {
1447 double x, y;
1448 if(is_vertex(m_vertices.vertex(idx, &x, &y)))
1449 {
1450 x += dx;
1451 y += dy;
1452 m_vertices.modify_vertex(idx, x, y);
1453 }
1454 }
1455 }

References agg::is_vertex().

+ Here is the call graph for this function:

◆ vertex() [1/2]

template<class VC >
unsigned agg::path_base< VC >::vertex ( double *  x,
double *  y 
)
inline
1245 {
1246 if(m_iterator >= m_vertices.total_vertices()) return path_cmd_stop;
1247 return m_vertices.vertex(m_iterator++, x, y);
1248 }

References agg::path_cmd_stop.

◆ vertex() [2/2]

template<class VC >
unsigned agg::path_base< VC >::vertex ( unsigned  idx,
double *  x,
double *  y 
) const
inline
1203 {
1204 return m_vertices.vertex(idx, x, y);
1205 }

Referenced by agg::path_base< VertexContainer >::align_path().

+ Here is the caller graph for this function:

◆ vertices() [1/2]

template<class VertexContainer >
container_type & agg::path_base< VertexContainer >::vertices ( )
inline

◆ vertices() [2/2]

template<class VertexContainer >
const container_type & agg::path_base< VertexContainer >::vertices ( ) const
inline

◆ vline_rel()

template<class VC >
void agg::path_base< VC >::vline_rel ( double  dy)
inline
968 {
969 double dx = 0;
970 rel_to_abs(&dx, &dy);
971 m_vertices.add_vertex(dx, dy, path_cmd_line_to);
972 }

References agg::path_cmd_line_to.

◆ vline_to()

template<class VC >
void agg::path_base< VC >::vline_to ( double  y)
inline
961 {
962 m_vertices.add_vertex(last_x(), y, path_cmd_line_to);
963 }
double last_x() const
Definition agg_path_storage.h:1188

References agg::path_cmd_line_to.

Member Data Documentation

◆ m_iterator

template<class VertexContainer >
unsigned agg::path_base< VertexContainer >::m_iterator
private

◆ m_vertices


The documentation for this class was generated from the following file: