176 return OppositeMap[
m_dir];
191 if( d == 1 || d == 7 )
193 else if( d == 2 || d == 6 )
195 else if( d == 3 || d == 5 )
218 return (
m_dir % 2 ) == 1;
238 bool aStartDiagonal =
false,
310 return 1 << ( (int)
m_dir );
329 if( aVec.
x == 0 && aVec.
y == 0 )
332 double mag = 360.0 - ( 180.0 /
M_PI * atan2( (
double) aVec.
y, (
double) aVec.
x ) ) + 90.0;
340 int dir = ( mag + 22.5 ) / 45.0;
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.
AngleType Angle(const DIRECTION_45 &aOther) const
Return the type of angle between directions (this) and aOther.
bool operator!=(const DIRECTION_45 &aOther) const
const DIRECTION_45 Left() const
Return the direction on the left side of this (i.e.
static int AllDirectionsMask()
const VECTOR2I ToVector() const
AngleType
Represent kind of angle formed by vectors heading in two DIRECTION_45s.
Directions
Available directions, there are 8 of them, as on a rectilinear map (north = up) + an extra undefined ...
DIRECTION_45(Directions aDir=UNDEFINED)
DIRECTION_45(const SEG &aSeg, bool a90=false)
bool IsDiagonal() const
Returns true if the direction is diagonal (e.g.
@ ROUNDED_90
H/V with filleted corners.
@ MITERED_90
H/V only (90-degree corners)
@ ROUNDED_45
H/V/45 with filleted corners.
@ MITERED_45
H/V/45 with mitered corners (default)
Directions m_dir
our actual direction
void construct_(const VECTOR2I &aVec)
Calculate the direction from a vector.
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.
const std::string Format() const
Format the direction in a human readable word.
DIRECTION_45(const VECTOR2I &aVec, bool a90=false)
bool IsObtuse(const DIRECTION_45 &aOther) const
bool m_90deg
Are we routing on 45 or 90 degree increments.
bool operator==(const DIRECTION_45 &aOther) const
DIRECTION_45 Opposite() const
Return a direction opposite (180 degree) to (this).
const VECTOR2I & GetP1() const
const VECTOR2I & GetP0() const
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
VECTOR2< int32_t > VECTOR2I