MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / getSqDistanceToPoint

Method getSqDistanceToPoint

Engine/source/math/mRect.h:335–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

333}
334
335inline F32 RectF::getSqDistanceToPoint( const Point2F &refPt ) const
336{
337 const Point2F maxPoint( point + extent );
338
339 F32 sqDist = 0.0f;
340
341 for ( U32 i=0; i < 2; i++ )
342 {
343 const F32 v = refPt[i];
344 if ( v < point[i] )
345 sqDist += mSquared( point[i] - v );
346 else if ( v > maxPoint[i] )
347 sqDist += mSquared( v - maxPoint[i] );
348 }
349
350 return sqDist;
351}
352
353inline bool RectF::intersect(const RectF& clipRect)
354{

Callers

nothing calls this directly

Calls 1

mSquaredFunction · 0.85

Tested by

no test coverage detected