30#ifndef GEOMETRY_UTILS_H
31#define GEOMETRY_UTILS_H
36#include <math/vector2d.h>
110 const VECTOR2<T> absVec { std::abs( aVec.x ), std::abs( aVec.y ) };
112 if ( !only45 && absVec.x > absVec.y * 2 )
117 else if ( !only45 && absVec.y > absVec.x * 2 )
122 else if ( absVec.x > absVec.y )
125 newVec.y = std::copysign( aVec.x, aVec.y );
129 newVec.x = std::copysign( aVec.y, aVec.x );
149bool ClipLine(
const EDA_RECT *aClipBox,
int &x1,
int &y1,
int &x2,
int &y2 );
158 return std::max( 1.0, aLineWidth );
161constexpr double dash_gap_len(
double aLineWidth )
163 return 3.0 *
dot_mark_len( aLineWidth ) + ( 2.0 * aLineWidth );
166constexpr double dash_mark_len(
double aLineWidth )
168 return std::max( dash_gap_len( aLineWidth ), 5.0 *
dot_mark_len( aLineWidth ) );
When creating polygons to create a clearance polygonal area, the polygon must be same or bigger than ...
Definition geometry_utils.h:78
Define a general 2D-vector/point.
Definition vector2d.h:72
int GetCircleToPolyCorrection(int aMaxError)
Definition geometry_utils.cpp:106
int CircleToEndSegmentDeltaRadius(int aInnerCircleRadius, int aSegCount)
Definition geometry_utils.cpp:67
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
Definition geometry_utils.h:45
constexpr double dot_mark_len(double aLineWidth)
Dashed and dotted line patterns.
Definition geometry_utils.h:156
VECTOR2< T > GetVectorSnapped45(const VECTOR2< T > &aVec, bool only45=false)
Snap a vector onto the nearest 0, 45 or 90 degree line.
Definition geometry_utils.h:107
int GetArcToSegmentCount(int aRadius, int aErrorMax, double aArcAngleDegree)
Definition geometry_utils.cpp:43
bool ClipLine(const EDA_RECT *aClipBox, int &x1, int &y1, int &x2, int &y2)
Test if any part of a line falls within the bounds of a rectangle.