39 wxASSERT( aRadius > 0.0f );
77 const float qd = qx * aSegRay.
m_Dir.x + qy * aSegRay.
m_Dir.y;
78 const float qq = qx * qx + qy * qy;
85 if( discriminantsqr < FLT_EPSILON )
90 const float discriminant = sqrt( discriminantsqr );
91 const float t1 = ( -qd - discriminant );
92 const float t2 = ( -qd + discriminant );
95 if( ( t1 > 0.0f ) && ( t1 < aSegRay.
m_Length ) )
101 if( ( t2 > 0.0f ) && ( t2 < aSegRay.
m_Length ) )
107 wxASSERT( ( t > 0.0f ) && ( t <= aSegRay.
m_Length ) );
113 const SFVEC2F hitPoint = aSegRay.
at( t );
125 return INTERSECTION_RESULT::MISSES;
136 s[0] = v[0].x * v[0].x + v[0].y * v[0].y;
137 s[1] = v[1].x * v[1].x + v[1].y * v[1].y;
138 s[2] = v[2].x * v[2].x + v[2].y * v[2].y;
139 s[3] = v[3].x * v[3].x + v[3].y * v[3].y;
149 if( isInside[0] && isInside[1] && isInside[2] && isInside[3] )
150 return INTERSECTION_RESULT::FULL_INSIDE;
153 if( isInside[0] || isInside[1] || isInside[2] || isInside[3] )
154 return INTERSECTION_RESULT::INTERSECTS;
156 return INTERSECTION_RESULT::MISSES;
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
bool Overlaps(const BBOX_2D &aBBox) const override
Test if the box overlaps the object.
bool IsPointInside(const SFVEC2F &aPoint) const override
INTERSECTION_RESULT IsBBoxInside(const BBOX_2D &aBBox) const override
Test this object if it's completely outside, intersects, or is completely inside aBBox.
bool Intersects(const BBOX_2D &aBBox) const override
a.Intersects(b) ⇔ !a.Disjoint(b) ⇔ !(a ∩ b = ∅)
bool Intersect(const RAYSEG2D &aSegRay, float *aOutT, SFVEC2F *aNormalOut) const override
FILLED_CIRCLE_2D(const SFVEC2F &aCenter, float aRadius, const BOARD_ITEM &aBoardItem)
Manage a bounding box defined by two SFVEC2F min max points.
SFVEC2F GetCenter() const
bool Intersects(const BBOX_2D &aBBox) const
Test if a bounding box intersects this box.
bool IsInitialized() const
Check if this bounding box is already initialized.
const SFVEC2F & Min() const
void Reset()
Reset the bounding box to zero and uninitialize it.
const SFVEC2F & Max() const
void Set(const SFVEC2F &aPbMin, const SFVEC2F &aPbMax)
Set bounding box with new parameters.
void ScaleNextUp()
Scale a bounding box to the next float representation making it larger.
SFVEC2F at(float t) const