| 30 | |
| 31 | template< typename Base > |
| 32 | Point3F 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 |
no test coverage detected