MCPcopy Create free account
hub / github.com/carbonengine/trinity / GetCenterOfAnchors

Function GetCenterOfAnchors

trinity/Eve/VirtualCamera/EveVirtualCamera.cpp:28–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26static const float DEBUG_BORDER_SIZE = 0.1f;
27
28Vector3 GetCenterOfAnchors( const PIEveSpaceObject2Vector& anchors )
29{
30 if( anchors.size() == 0 )
31 {
32 return Vector3( 0, 0, 0 );
33 }
34 else
35 {
36 Vector3d center = Vector3d( 0, 0, 0 ); // using doubles because precision.
37 for( auto it = anchors.begin(); it != anchors.end(); ++it )
38 {
39 Vector3 out;
40 ( *it )->GetModelCenterWorldPosition( out );
41 center += out;
42 }
43 center /= (double)anchors.size();
44 return Vector3( (float)center.x, (float)center.y, (float)center.z );
45 }
46}
47
48float GetAnchorsBoundingSphereRadius( const PIEveSpaceObject2Vector& anchors, const Vector3& center )
49{

Callers 1

UpdateMethod · 0.85

Calls 6

sizeMethod · 0.80
Vector3Class · 0.50
Vector3dClass · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected