30 #ifndef GEOMETRY_UTILS_H
31 #define GEOMETRY_UTILS_H
33 #include <math/vector2d.h>
74 const VECTOR2<T> absVec { std::abs( aVec.x ), std::abs( aVec.y ) };
76 if ( absVec.x > absVec.y * 2 )
81 else if ( absVec.y > absVec.x * 2 )
86 else if ( absVec.x > absVec.y )
89 newVec.y = std::copysign( aVec.x, aVec.y );
93 newVec.x = std::copysign( aVec.y, aVec.x );
107 #define DOT_WIDTH_MILS 0.0254
109 #define DOT_MARK_LEN( aLineWidth ) \
110 ( std::max( 1.0, IU_PER_MILS * DOT_WIDTH_MILS - aLineWidth ) )
112 #define DASH_GAP_LEN( aLineWidth ) \
113 ( 3.0 * DOT_MARK_LEN( aLineWidth ) + ( 2.0 * aLineWidth ) )
115 #define DASH_MARK_LEN( aLineWidth ) \
116 ( std::max( DASH_GAP_LEN( aLineWidth ), 5.0 * DOT_MARK_LEN( aLineWidth ) ) )
Class VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:76
VECTOR2< T > GetVectorSnapped45(const VECTOR2< T > &aVec)
Snap a vector onto the nearest 0, 45 or 90 degree line.
Definition: geometry_utils.h:71
int GetArcToSegmentCount(int aRadius, int aErrorMax, double aArcAngleDegree)
Definition: geometry_utils.cpp:35
double GetCircletoPolyCorrectionFactor(int aSegCountforCircle)
Definition: geometry_utils.cpp:56