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

Method getCenterPoint

Engine/source/math/mPolyhedron.impl.h:32–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30
31template< typename Base >
32Point3F PolyhedronImpl< Base >::getCenterPoint() const
33{
34 const U32 numPoints = this->getNumPoints();
35 if( numPoints == 0 )
36 return Point3F( 0.f, 0.f, 0.f );
37
38 const typename Base::PointType* pointList = this->getPoints();
39 Point3F center( pointList[ 0 ] );
40
41 for( U32 i = 1; i < numPoints; ++ i )
42 center += pointList[ i ];
43
44 center /= ( F32 ) numPoints;
45 return center;
46}
47
48//-----------------------------------------------------------------------------
49

Callers 1

Calls 3

Point3FClass · 0.70
getNumPointsMethod · 0.45
getPointsMethod · 0.45

Tested by

no test coverage detected