Failed hack for collision detection with a sphere.
[hair] / src / object.cc
1 #include "object.h"
2
3 CollSphere::CollSphere()
4 {
5         radius = 1.0;
6 }
7
8 bool CollSphere::contains(const Vec3 &v) const
9 {
10         return length_sq(v - center) <= radius * radius;
11 }
12
13 Vec3 CollSphere::project_surf(const Vec3 &v) const
14 {
15         return center + normalize(v - center) * radius;
16 }