#include "munga.h" #pragma hdrstop #include "sphere.h" // //########################################################################### //########################################################################### // Logical Sphere::Contains(const Point3D &A_Point) const { Vector3D diff; diff.Subtract(center,A_Point); return radius*radius >= diff.LengthSquared(); } // //########################################################################### //########################################################################### // Logical Sphere::Intersects(const Sphere &sphere) const { Vector3D temp; Scalar r; r = radius + sphere.radius; temp.Subtract(center, sphere.center); return temp.LengthSquared() <= r*r; } // //########################################################################### //########################################################################### // std::ostream& operator<<(std::ostream& Stream, const Sphere &A_Sphere) { Stream << "\n\tSphere Centerpoint: " << A_Sphere.center; return Stream << "\n\tRadius: " << A_Sphere.radius; }