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

Method AdjustBounds

trinity/Utilities/Tr2MaterialBoundsAdjustment.cpp:7–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5
6
7CcpMath::AxisAlignedBox Tr2MaterialBoundsAdjustment::AdjustBounds( const CcpMath::AxisAlignedBox& box ) const
8{
9 auto bounds = box;
10 bounds.Scale( maxLocalScale );
11 bounds.Grow( maxLocalDisplacement );
12 if( rotatesVertices )
13 {
14 float radius = 0;
15 bounds.EnumerateVertices( [&radius]( const Vector3& vtx ) {
16 radius = std::max( radius, LengthSq( vtx ) );
17 } );
18 radius = sqrt( radius );
19 bounds = CcpMath::AxisAlignedBox( CcpMath::Sphere( Vector3( 0, 0, 0 ), radius ) );
20 }
21 return bounds;
22}
23
24
25#if BLUE_WITH_PYTHON

Callers 3

GetBoundsMethod · 0.80
GetAreaBoundsMethod · 0.80
CacheBoundsMethod · 0.80

Calls 4

LengthSqFunction · 0.85
GrowMethod · 0.80
Vector3Class · 0.50
ScaleMethod · 0.45

Tested by

no test coverage detected