KiCad PCB EDA Suite
Loading...
Searching...
No Matches
BEZIER_POLY Class Reference

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 aMinSegLen=0, int aMaxSegCount=32)
 Convert a Bezier curve to a polygon. More...
 
void GetPoly (std::vector< VECTOR2D > &aOutput, double aMinSegLen=0.0, int aMaxSegCount=32)
 

Private Attributes

double m_minSegLen
 Control points. More...
 
std::vector< VECTOR2Dm_ctrlPts
 

Detailed Description

Bezier curves to polygon converter.

Only quadratic and cubic Bezier curves are handled

Definition at line 37 of file bezier_curves.h.

Constructor & Destructor Documentation

◆ BEZIER_POLY() [1/3]

BEZIER_POLY::BEZIER_POLY ( const VECTOR2I aStart,
const VECTOR2I aCtrl1,
const VECTOR2I aCtrl2,
const VECTOR2I aEnd 
)

Definition at line 35 of file bezier_curves.cpp.

References m_ctrlPts, and m_minSegLen.

◆ BEZIER_POLY() [2/3]

BEZIER_POLY::BEZIER_POLY ( const std::vector< VECTOR2I > &  aControlPoints)

Definition at line 47 of file bezier_curves.cpp.

References m_ctrlPts, and m_minSegLen.

◆ BEZIER_POLY() [3/3]

BEZIER_POLY::BEZIER_POLY ( const std::vector< VECTOR2D > &  aControlPoints)
inline

Definition at line 45 of file bezier_curves.h.

References m_minSegLen.

Member Function Documentation

◆ GetPoly() [1/2]

void BEZIER_POLY::GetPoly ( std::vector< VECTOR2D > &  aOutput,
double  aMinSegLen = 0.0,
int  aMaxSegCount = 32 
)

Definition at line 71 of file bezier_curves.cpp.

References delta, and m_ctrlPts.

◆ GetPoly() [2/2]

void BEZIER_POLY::GetPoly ( std::vector< VECTOR2I > &  aOutput,
int  aMinSegLen = 0,
int  aMaxSegCount = 32 
)

Convert a Bezier curve to a polygon.

Parameters
aOutputwill be used as an output vector storing polygon points.
aMinSegLenis the min dist between 2 successive points. It can be used to reduce the number of points. (the last point is always generated) aMaxSegCount is the max number of segments created

Definition at line 58 of file bezier_curves.cpp.

References GetPoly().

Referenced by PCB_IO_IPC2581::addShape(), KIFONT::OUTLINE_DECOMPOSER::approximateCubicBezierCurve(), PLOTTER::BezierCurve(), EDA_SHAPE::buildBezierToSegmentsPointsList(), TEARDROP_MANAGER::computeCurvedForRectShape(), TEARDROP_MANAGER::computeCurvedForRoundShape(), KIGFX::PCB_PAINTER::draw(), KIGFX::OPENGL_GAL::DrawCurve(), EDA_SHAPE::flip(), GetPoly(), SCH_IO_ALTIUM::ParseBezier(), PCB_IO_EASYEDAPRO_PARSER::ParseContour(), EASYEDA_PARSER_BASE::ParseLineChains(), and EDA_SHAPE::TransformShapeToPolygon().

Member Data Documentation

◆ m_ctrlPts

std::vector<VECTOR2D> BEZIER_POLY::m_ctrlPts
private

Definition at line 67 of file bezier_curves.h.

Referenced by BEZIER_POLY(), and GetPoly().

◆ m_minSegLen

double BEZIER_POLY::m_minSegLen
private

Control points.

Definition at line 64 of file bezier_curves.h.

Referenced by BEZIER_POLY().


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