// DebugSphere.cpp: implementation of the DebugSphere class.
//
//////////////////////////////////////////////////////////////////////

#include "DebugSphere.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

DebugSphere::DebugSphere()
{

}

DebugSphere::~DebugSphere()
{

}

double DebugSphere::closest_signed_distance(const Point &from, Point &closest_surface_pt)
{
	const Point center(0,0,0);
	const double radius = DEBUG_SPHERE_RADIUS;

	Vector delta = from - center;
	delta[3] = 0.0;

	const double dist_from_center = delta.Magnitude();
	Vector center_to_from_dir = delta;
	center_to_from_dir.Normalize();

	closest_surface_pt = center + (center_to_from_dir * (float)radius);
	
	return radius - dist_from_center;
}