38 m_objectA( aObjectA ),
39 m_objectB( aObjectB ),
97 currentRayPos = aSegRay.
atNormalized( tmpRayDist + 0.003f );
105 for(
unsigned int l = 0; l < (
m_objectB->size() * 2 ); ++l )
107 bool wasCrossedSubVol =
false;
110 for(
unsigned int i = 0; i <
m_objectB->size(); ++i )
120 ->Intersect( currentRay, &hitDist, &tmpNormal ) )
123 wxASSERT( hitDist <= 1.0f );
125 if( hitDist > FLT_EPSILON )
127 wasCrossedSubVol =
true;
130 currentRay.
atNormalized( glm::min( hitDist + 0.0001f, 1.0f ) );
134 currentNormal = tmpNormal * -1.0f;
139 if( !wasCrossedSubVol )
145 *aNormalOut = currentNormal;
149 glm::max( glm::length( currentRayPos - aSegRay.
m_Start ) / aSegRay.
m_Length, 0.0f ),
161 return INTERSECTION_RESULT::MISSES;
173 for(
unsigned int i = 0; i <
m_objectB->size(); i++ )
Defines math related functions.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
bool IsPointInside(const SFVEC2F &aPoint) const override
bool Intersects(const BBOX_2D &aBBox) const override
a.Intersects(b) ⇔ !a.Disjoint(b) ⇔ !(a ∩ b = ∅)
const OBJECT_2D * m_objectA
bool Intersect(const RAYSEG2D &aSegRay, float *aOutT, SFVEC2F *aNormalOut) const override
LAYER_ITEM_2D(const OBJECT_2D *aObjectA, std::vector< const OBJECT_2D * > *aObjectB, const OBJECT_2D *aObjectC, const BOARD_ITEM &aBoardItem)
INTERSECTION_RESULT IsBBoxInside(const BBOX_2D &aBBox) const override
Test this object if it's completely outside, intersects, or is completely inside aBBox.
bool Overlaps(const BBOX_2D &aBBox) const override
Test if the box overlaps the object.
std::vector< const OBJECT_2D * > * m_objectB
const BBOX_2D & GetBBox() const
virtual bool Intersect(const RAYSEG2D &aSegRay, float *aOutT, SFVEC2F *aNormalOut) const =0
OBJECT_2D_TYPE GetObjectType() const
virtual bool IsPointInside(const SFVEC2F &aPoint) const =0
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.
void Reset()
Reset the bounding box to zero and uninitialize it.
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 atNormalized(float t) const
Return the position at t.