173 return OppositeMap[
m_dir];
188 if( d == 1 || d == 7 )
190 else if( d == 2 || d == 6 )
192 else if( d == 3 || d == 5 )
215 return (
m_dir % 2 ) == 1;
235 bool aStartDiagonal =
false,
236 CORNER_MODE aMode = CORNER_MODE::MITERED_45 )
const;
258 r.m_dir = static_cast<Directions>( (
m_dir + 2 ) %
LAST );
260 r.m_dir = static_cast<Directions>( (
m_dir + 1 ) %
LAST );
307 return 1 << ( (int)
m_dir );
321 if( aVec.
x == 0 && aVec.
y == 0 )
324 double mag = 360.0 - ( 180.0 / M_PI * atan2( (
double) aVec.
y, (
double) aVec.
x ) ) + 90.0;
332 int dir = ( mag + 22.5 ) / 45.0;
352 #endif // DIRECTION45_H Directions
Available directions, there are 8 of them, as on a rectilinear map (north = up) + an extra undefined ...
DIRECTION_45(const SEG &aSeg, bool a90=false)
const std::string Format() const
Format the direction in a human readable word.
const VECTOR2I ToVector() const
const SHAPE_LINE_CHAIN BuildInitialTrace(const VECTOR2I &aP0, const VECTOR2I &aP1, bool aStartDiagonal=false, CORNER_MODE aMode=CORNER_MODE::MITERED_45) const
Build a 2-segment line chain between points aP0 and aP1 and following 45-degree routing regime.
const DIRECTION_45 Left() const
Return the direction on the left side of this (i.e.
bool operator!=(const DIRECTION_45 &aOther) const
DIRECTION_45(const VECTOR2I &aVec, bool a90=false)
const DIRECTION_45 Right() const
Return the direction on the right side of this (i.e.
DIRECTION_45(const SHAPE_ARC &aArc, bool a90=false)
Create a DIRECTION_45 from the endpoints of a given arc.
DIRECTION_45(Directions aDir=UNDEFINED)
AngleType Angle(const DIRECTION_45 &aOther) const
Return the type of angle between directions (this) and aOther.
Represent route directions & corner angles in a 45-degree metric.
const VECTOR2I & GetP0() const
H/V with filleted corners.
DIRECTION_45 Opposite() const
Return a direction opposite (180 degree) to (this).
bool IsDiagonal() const
Returns true if the direction is diagonal (e.g.
bool operator==(const DIRECTION_45 &aOther) const
H/V/45 with mitered corners (default)
H/V/45 with filleted corners.
AngleType
Represent kind of angle formed by vectors heading in two DIRECTION_45s.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
H/V only (90-degree corners)
Directions m_dir
Are we routing on 45 or 90 degree increments.
void construct_(const VECTOR2I &aVec)
Calculate the direction from a vector.
const VECTOR2I & GetP1() const
bool IsObtuse(const DIRECTION_45 &aOther) const