30 #ifndef GEOMETRY_UTILS_H 31 #define GEOMETRY_UTILS_H 100 const VECTOR2<T> absVec { std::abs( aVec.
x ), std::abs( aVec.
y ) };
102 if ( !only45 && absVec.x > absVec.y * 2 )
107 else if ( !only45 && absVec.y > absVec.x * 2 )
112 else if ( absVec.x > absVec.y )
115 newVec.y = std::copysign( aVec.
x, aVec.
y );
119 newVec.x = std::copysign( aVec.
y, aVec.
x );
139 bool ClipLine(
const EDA_RECT *aClipBox,
int &x1,
int &y1,
int &x2,
int &y2 );
149 #define DOT_WIDTH_MILS 0.0254 151 #define DOT_MARK_LEN( aLineWidth ) \ 152 ( std::max( 1.0, IU_PER_MILS * DOT_WIDTH_MILS - aLineWidth ) ) 154 #define DASH_GAP_LEN( aLineWidth ) \ 155 ( 3.0 * DOT_MARK_LEN( aLineWidth ) + ( 2.0 * aLineWidth ) ) 157 #define DASH_MARK_LEN( aLineWidth ) \ 158 ( std::max( DASH_GAP_LEN( aLineWidth ), 5.0 * DOT_MARK_LEN( aLineWidth ) ) ) 162 #endif // #ifndef GEOMETRY_UTILS_H
VECTOR2< T > GetVectorSnapped45(const VECTOR2< T > &aVec, bool only45=false)
Snap a vector onto the nearest 0, 45 or 90 degree line.
Define a general 2D-vector/point.
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.
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
~DISABLE_ARC_RADIUS_CORRECTION()
int GetCircleToPolyCorrection(int aMaxError)
DISABLE_ARC_RADIUS_CORRECTION()
When creating polygons to create a clearance polygonal area, the polygon must be same or bigger than ...
Handle the component boundary box.
int GetArcToSegmentCount(int aRadius, int aErrorMax, double aArcAngleDegree)