KiCad PCB EDA Suite
|
Bezier curves to polygon converter. More...
#include <bezier_curves.h>
Public Member Functions | |
BEZIER_POLY (const VECTOR2I &aStart, const VECTOR2I &aCtrl1, const VECTOR2I &aCtrl2, const VECTOR2I &aEnd) | |
BEZIER_POLY (const std::vector< VECTOR2I > &aControlPoints) | |
BEZIER_POLY (const std::vector< VECTOR2D > &aControlPoints) | |
void | GetPoly (std::vector< VECTOR2I > &aOutput, int aMaxError=10) |
Convert a Bezier curve to a polygon. | |
void | GetPoly (std::vector< VECTOR2D > &aOutput, double aMaxError=10.0) |
Private Member Functions | |
void | getQuadPoly (std::vector< VECTOR2D > &aOutput, double aMaxError) |
void | getCubicPoly (std::vector< VECTOR2D > &aOutput, double aMaxError) |
int | findInflectionPoints (double &aT1, double &aT2) |
int | numberOfInflectionPoints () |
double | thirdControlPointDeviation () |
void | subdivide (double aT, BEZIER_POLY &aLeft, BEZIER_POLY &aRight) |
void | recursiveSegmentation (std::vector< VECTOR2D > &aOutput, double aMaxError) |
void | cubicParabolicApprox (std::vector< VECTOR2D > &aOutput, double aMaxError) |
bool | isNaN () const |
bool | isFlat (double aMaxError) const |
VECTOR2D | eval (double t) |
Private Attributes | |
double | m_minSegLen |
Control points. | |
std::vector< VECTOR2D > | m_ctrlPts |
Bezier curves to polygon converter.
Only quadratic and cubic Bezier curves are handled
Definition at line 37 of file bezier_curves.h.
BEZIER_POLY::BEZIER_POLY | ( | const VECTOR2I & | aStart, |
const VECTOR2I & | aCtrl1, | ||
const VECTOR2I & | aCtrl2, | ||
const VECTOR2I & | aEnd | ||
) |
Definition at line 88 of file bezier_curves.cpp.
References m_ctrlPts, and m_minSegLen.
BEZIER_POLY::BEZIER_POLY | ( | const std::vector< VECTOR2I > & | aControlPoints | ) |
Definition at line 100 of file bezier_curves.cpp.
References m_ctrlPts, and m_minSegLen.
|
inline |
Definition at line 45 of file bezier_curves.h.
References m_minSegLen.
|
private |
Definition at line 436 of file bezier_curves.cpp.
References BEZIER_DBG, isFlat(), isNaN(), m_ctrlPts, recursiveSegmentation(), subdivide(), and thirdControlPointDeviation().
Referenced by getCubicPoly().
|
private |
Definition at line 190 of file bezier_curves.cpp.
References m_ctrlPts.
Referenced by getQuadPoly(), and subdivide().
|
private |
Definition at line 367 of file bezier_curves.cpp.
References BEZIER_DBG, and m_ctrlPts.
Referenced by getCubicPoly().
|
private |
Definition at line 510 of file bezier_curves.cpp.
References BEZIER_DBG, cubicParabolicApprox(), findInflectionPoints(), m_ctrlPts, numberOfInflectionPoints(), recursiveSegmentation(), and subdivide().
Referenced by GetPoly().
void BEZIER_POLY::GetPoly | ( | std::vector< VECTOR2D > & | aOutput, |
double | aMaxError = 10.0 |
||
) |
Definition at line 577 of file bezier_curves.cpp.
References BEZIER_DBG, getCubicPoly(), getQuadPoly(), and m_ctrlPts.
void BEZIER_POLY::GetPoly | ( | std::vector< VECTOR2I > & | aOutput, |
int | aMaxError = 10 |
||
) |
Convert a Bezier curve to a polygon.
aOutput | will be used as an output vector storing polygon points. |
aMaxError | maximum error in IU between the curve and the polygon. |
Definition at line 164 of file bezier_curves.cpp.
References GetPoly(), and KiROUND().
Referenced by PCB_IO_IPC2581::addShape(), PLOTTER::BezierCurve(), EDA_SHAPE::buildBezierToSegmentsPointsList(), TEARDROP_MANAGER::computeCurvedForRectShape(), TEARDROP_MANAGER::computeCurvedForRoundShape(), KIFONT::OUTLINE_DECOMPOSER::cubicTo(), KIGFX::PCB_PAINTER::draw(), KIGFX::OPENGL_GAL::DrawCurve(), GetPoly(), EDA_SHAPE::hitTest(), SCH_IO_ALTIUM::ParseBezier(), PCB_IO_EASYEDAPRO_PARSER::ParseContour(), EASYEDA_PARSER_BASE::ParseLineChains(), and EDA_SHAPE::TransformShapeToPolygon().
|
private |
Definition at line 214 of file bezier_curves.cpp.
References std::abs(), approx_int(), approx_inv_int(), eval(), m_ctrlPts, scale, and v2.
Referenced by GetPoly().
|
private |
Definition at line 123 of file bezier_curves.cpp.
References delta, VECTOR2< T >::Dot(), m_ctrlPts, and VECTOR2< T >::SquaredEuclideanNorm().
Referenced by cubicParabolicApprox(), and recursiveSegmentation().
|
private |
Definition at line 111 of file bezier_curves.cpp.
References m_ctrlPts.
Referenced by cubicParabolicApprox().
|
private |
Definition at line 249 of file bezier_curves.cpp.
References BEZIER_DBG, VECTOR2< T >::Cross(), VECTOR2< T >::Dot(), and m_ctrlPts.
Referenced by getCubicPoly().
|
private |
Definition at line 330 of file bezier_curves.cpp.
References BEZIER_DBG, isFlat(), left, m_ctrlPts, right, and subdivide().
Referenced by cubicParabolicApprox(), and getCubicPoly().
|
private |
Definition at line 292 of file bezier_curves.cpp.
References eval(), and m_ctrlPts.
Referenced by cubicParabolicApprox(), getCubicPoly(), and recursiveSegmentation().
|
private |
Definition at line 275 of file bezier_curves.cpp.
References std::abs(), delta, and m_ctrlPts.
Referenced by cubicParabolicApprox().
|
private |
Definition at line 84 of file bezier_curves.h.
Referenced by BEZIER_POLY(), cubicParabolicApprox(), eval(), findInflectionPoints(), getCubicPoly(), GetPoly(), getQuadPoly(), isFlat(), isNaN(), numberOfInflectionPoints(), recursiveSegmentation(), subdivide(), and thirdControlPointDeviation().
|
private |