예제 #1
0
파일: OBB.cpp 프로젝트: Ilikia/naali
Sphere OBB::MinimalEnclosingSphere() const
{
    Sphere s;
    s.pos = pos;
    s.r = HalfDiagonal().Length();
    return s;
}
예제 #2
0
파일: AABB.cpp 프로젝트: katik/naali
void AABB::ProjectToAxis(const float3 &axis, float &dMin, float &dMax) const
{
	float3 c = CenterPoint();
	float3 e = HalfDiagonal();

	// Compute the projection interval radius of the AABB onto L(t) = aabb.center + t * plane.normal;
	float r = e[0]*Abs(axis[0]) + e[1]*Abs(axis[1]) + e[2]*Abs(axis[2]);
	// Compute the distance of the box center from plane.
	float s = Dot(axis, c);
	dMin = s - r;
	dMax = s + r;
	if (dMin > dMax)
		Swap(dMin, dMax);
}
예제 #3
0
파일: OBB.cpp 프로젝트: Ilikia/naali
float3 OBB::Diagonal() const
{
    return 2.f * HalfDiagonal();
}