コード例 #1
0
Sphere EncloseSphere ( OrientedBox const & shape )
{
	float x = shape.getExtentX();
	float y = shape.getExtentY();
	float z = shape.getExtentZ();

	float radius = sqrt( x*x + y*y + z*z );

	return Sphere( shape.getCenter(), radius );
}
コード例 #2
0
Range ProjectAxis ( Line3d const & L, OrientedBox const & B )
{
	Vector const & N = L.getNormal();

	real x = std::abs( Collision3d::ComponentAlong( B.getAxisX(), N ) ) * B.getExtentX();
	real y = std::abs( Collision3d::ComponentAlong( B.getAxisY(), N ) ) * B.getExtentY();
	real z = std::abs( Collision3d::ComponentAlong( B.getAxisZ(), N ) ) * B.getExtentZ();

	real d = x + y + z;

	real c = ProjectAxis( L, B.getCenter() );

	return Range( c - d, c + d );
}