KiCad PCB EDA Suite
bezier_curves.h File Reference
#include <vector>
#include <wx/gdicmn.h>

Go to the source code of this file.

Functions

std::vector< wxPointBezier2Poly (wxPoint c1, wxPoint c2, wxPoint c3)
 Function Bezier2Poly convert a Bezier curve to a polyline. More...
 
std::vector< wxPointBezier2Poly (int x1, int y1, int x2, int y2, int x3, int y3)
 
std::vector< wxPointBezier2Poly (wxPoint c1, wxPoint c2, wxPoint c3, wxPoint c4)
 Function Bezier2Poly convert a Bezier curve to a polyline. More...
 
std::vector< wxPointBezier2Poly (int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
 

Function Documentation

std::vector<wxPoint> Bezier2Poly ( wxPoint  c1,
wxPoint  c2,
wxPoint  c3 
)

Function Bezier2Poly convert a Bezier curve to a polyline.

Parameters
c1- First point to convert.
c2- Second point to convert.
c3- Third point to convert.
Returns
a std::vector<wxPoint> containing the points of the polyline

Definition at line 69 of file bezier_curves.cpp.

References Bezier2Poly(), wxPoint::x, and wxPoint::y.

70 {
71  return Bezier2Poly( c1.x, c1.y, c2.x, c2.y, c3.x, c3.y );
72 }
std::vector< wxPoint > Bezier2Poly(wxPoint c1, wxPoint c2, wxPoint c3, wxPoint c4)
Function Bezier2Poly convert a Bezier curve to a polyline.
std::vector<wxPoint> Bezier2Poly ( int  x1,
int  y1,
int  x2,
int  y2,
int  x3,
int  y3 
)

Definition at line 89 of file bezier_curves.cpp.

References bezier_approximation_scale, bezier_distance_tolerance_square, recursive_bezier(), and s_bezier_Points_Buffer.

90 {
91  s_bezier_Points_Buffer.clear();
92 
95  s_bezier_Points_Buffer.push_back( wxPoint( x1, y1 ) );
96  recursive_bezier( x1, y1, x2, y2, x3, y3, 0 );
97  s_bezier_Points_Buffer.push_back( wxPoint( x3, y3 ) );
98 
99  wxLogDebug( wxT( "Bezier Conversion - End (%d vertex)" ), s_bezier_Points_Buffer.size() );
100  return s_bezier_Points_Buffer;
101 }
static double bezier_approximation_scale
static std::vector< wxPoint > s_bezier_Points_Buffer
static double bezier_distance_tolerance_square
static void recursive_bezier(int x1, int y1, int x2, int y2, int x3, int y3, int level)
std::vector<wxPoint> Bezier2Poly ( wxPoint  c1,
wxPoint  c2,
wxPoint  c3,
wxPoint  c4 
)

Function Bezier2Poly convert a Bezier curve to a polyline.

Returns
a std::vector<wxPoint> containing the points of the polyline
Parameters
c1- First point to convert.
c2- Second point to convert.
c3- Third point to convert.
c4- Fourth point to convert.
Returns
a std::vector<wxPoint> containing the points of the polyline

Definition at line 63 of file bezier_curves.cpp.

References Bezier2Poly(), wxPoint::x, and wxPoint::y.

Referenced by CPolyLine::AppendBezier(), Bezier2Poly(), DRAWSEGMENT::Draw(), LIB_BEZIER::drawGraphic(), and GRBezier().

64 {
65  return Bezier2Poly( c1.x, c1.y, c2.x, c2.y, c3.x, c3.y, c4.x, c4.y );
66 }
std::vector< wxPoint > Bezier2Poly(wxPoint c1, wxPoint c2, wxPoint c3, wxPoint c4)
Function Bezier2Poly convert a Bezier curve to a polyline.
std::vector<wxPoint> Bezier2Poly ( int  x1,
int  y1,
int  x2,
int  y2,
int  x3,
int  y3,
int  x4,
int  y4 
)

Definition at line 104 of file bezier_curves.cpp.

References bezier_approximation_scale, bezier_distance_tolerance_square, recursive_bezier(), and s_bezier_Points_Buffer.

105 {
106  s_bezier_Points_Buffer.clear();
109 
110  s_bezier_Points_Buffer.push_back( wxPoint( x1, y1 ) );
111  recursive_bezier( x1, y1, x2, y2, x3, y3, x4, y4, 0 );
112  s_bezier_Points_Buffer.push_back( wxPoint( x4, y4 ) );
113  wxLogDebug( wxT( "Bezier Conversion - End (%d vertex)" ), s_bezier_Points_Buffer.size() );
114  return s_bezier_Points_Buffer;
115 }
static double bezier_approximation_scale
static std::vector< wxPoint > s_bezier_Points_Buffer
static double bezier_distance_tolerance_square
static void recursive_bezier(int x1, int y1, int x2, int y2, int x3, int y3, int level)