KiCad PCB EDA Suite
Loading...
Searching...
No Matches
svg_import_plugin.cpp File Reference
#include "svg_import_plugin.h"
#include <nanosvg.h>
#include <algorithm>
#include <cmath>
#include <locale_io.h>
#include <eda_item.h>
#include "graphics_importer.h"

Go to the source code of this file.

Functions

static VECTOR2D calculateBezierBoundingBoxExtremity (const float *aCurvePoints, std::function< const float &(const float &, const float &) > comparator)
 
static float calculateBezierSegmentationThreshold (const float *aCurvePoints)
 
static void segmentBezierCurve (const VECTOR2D &aStart, const VECTOR2D &aEnd, float aOffset, float aStep, const float *aCurvePoints, float aSegmentationThreshold, std::vector< VECTOR2D > &aGeneratedPoints)
 
static void createNewBezierCurveSegments (const VECTOR2D &aStart, const VECTOR2D &aMiddle, const VECTOR2D &aEnd, float aOffset, float aStep, const float *aCurvePoints, float aSegmentationThreshold, std::vector< VECTOR2D > &aGeneratedPoints)
 
static VECTOR2D getBezierPoint (const float *aCurvePoints, float aStep)
 
static VECTOR2D getPoint (const float *aPointCoordinates)
 
static VECTOR2D getPointInLine (const VECTOR2D &aLineStart, const VECTOR2D &aLineEnd, float aDistance)
 
static float distanceFromPointToLine (const VECTOR2D &aPoint, const VECTOR2D &aLineStart, const VECTOR2D &aLineEnd)
 

Variables

static const int SVG_DPI = 96
 

Function Documentation

◆ calculateBezierBoundingBoxExtremity()

static VECTOR2D calculateBezierBoundingBoxExtremity ( const float *  aCurvePoints,
std::function< const float &(const float &, const float &) >  comparator 
)
static

Definition at line 368 of file svg_import_plugin.cpp.

Referenced by calculateBezierSegmentationThreshold().

◆ calculateBezierSegmentationThreshold()

static float calculateBezierSegmentationThreshold ( const float *  aCurvePoints)
static

◆ createNewBezierCurveSegments()

static void createNewBezierCurveSegments ( const VECTOR2D aStart,
const VECTOR2D aMiddle,
const VECTOR2D aEnd,
float  aOffset,
float  aStep,
const float *  aCurvePoints,
float  aSegmentationThreshold,
std::vector< VECTOR2D > &  aGeneratedPoints 
)
static

Definition at line 400 of file svg_import_plugin.cpp.

References segmentBezierCurve().

Referenced by segmentBezierCurve().

◆ distanceFromPointToLine()

static float distanceFromPointToLine ( const VECTOR2D aPoint,
const VECTOR2D aLineStart,
const VECTOR2D aLineEnd 
)
static

◆ getBezierPoint()

static VECTOR2D getBezierPoint ( const float *  aCurvePoints,
float  aStep 
)
static

◆ getPoint()

static VECTOR2D getPoint ( const float *  aPointCoordinates)
static

Definition at line 320 of file svg_import_plugin.cpp.

Referenced by getBezierPoint().

◆ getPointInLine()

static VECTOR2D getPointInLine ( const VECTOR2D aLineStart,
const VECTOR2D aLineEnd,
float  aDistance 
)
static

Definition at line 346 of file svg_import_plugin.cpp.

Referenced by getBezierPoint().

◆ segmentBezierCurve()

static void segmentBezierCurve ( const VECTOR2D aStart,
const VECTOR2D aEnd,
float  aOffset,
float  aStep,
const float *  aCurvePoints,
float  aSegmentationThreshold,
std::vector< VECTOR2D > &  aGeneratedPoints 
)
static

Variable Documentation

◆ SVG_DPI