KiCad PCB EDA Suite
Loading...
Searching...
No Matches
bezier_curves.cpp File Reference
#include <bezier_curves.h>
#include <geometry/ellipse.h>
#include <trigo.h>
#include <math/vector2d.h>
#include <wx/debug.h>
#include <wx/log.h>

Go to the source code of this file.

Macros

#define BEZIER_DBG   "bezier"
 

Functions

static double approx_int (double x)
 
static double approx_inv_int (double x)
 
template<typename T >
void TransformEllipseToBeziers (const ELLIPSE< T > &aEllipse, std::vector< BEZIER< T > > &aBeziers)
 Transforms an ellipse or elliptical arc into a set of quadratic Bezier curves that approximate it.
 
template void TransformEllipseToBeziers (const ELLIPSE< double > &aEllipse, std::vector< BEZIER< double > > &aBeziers)
 
template void TransformEllipseToBeziers (const ELLIPSE< int > &aEllipse, std::vector< BEZIER< int > > &aBeziers)
 

Macro Definition Documentation

◆ BEZIER_DBG

#define BEZIER_DBG   "bezier"

Definition at line 86 of file bezier_curves.cpp.

Function Documentation

◆ approx_int()

static double approx_int ( double  x)
static

Definition at line 176 of file bezier_curves.cpp.

Referenced by BEZIER_POLY::getQuadPoly().

◆ approx_inv_int()

static double approx_inv_int ( double  x)
static

Definition at line 183 of file bezier_curves.cpp.

Referenced by BEZIER_POLY::getQuadPoly().

◆ TransformEllipseToBeziers() [1/3]

template void TransformEllipseToBeziers ( const ELLIPSE< double > &  aEllipse,
std::vector< BEZIER< double > > &  aBeziers 
)

◆ TransformEllipseToBeziers() [2/3]

template void TransformEllipseToBeziers ( const ELLIPSE< int > &  aEllipse,
std::vector< BEZIER< int > > &  aBeziers 
)

◆ TransformEllipseToBeziers() [3/3]

template<typename T >
void TransformEllipseToBeziers ( const ELLIPSE< T > &  aEllipse,
std::vector< BEZIER< T > > &  aBeziers 
)

Transforms an ellipse or elliptical arc into a set of quadratic Bezier curves that approximate it.

Minimum number of Beziers to use for a full circle to keep error manageable.

The number of Beziers needed for the given arc

Angle occupied by each Bezier

Definition at line 600 of file bezier_curves.cpp.

References std::abs(), ANGLE_0, ANGLE_360, EDA_ANGLE::AsRadians(), BEZIER< NumericType >::C1, BEZIER< NumericType >::C2, ELLIPSE< NumericType >::Center, BEZIER< NumericType >::End, ELLIPSE< NumericType >::EndAngle, ELLIPSE< NumericType >::MajorRadius, ELLIPSE< NumericType >::MinorRadius, RADIANS_T, RotatePoint(), ELLIPSE< NumericType >::Rotation, BEZIER< NumericType >::Start, and ELLIPSE< NumericType >::StartAngle.

Referenced by DXF_IMPORT_PLUGIN::addEllipse(), SCH_IO_ALTIUM::ParseEllipse(), and SCH_IO_ALTIUM::ParseEllipticalArc().