X-Git-Url: https://eleni.mutantstargoat.com/git/?p=hair;a=blobdiff_plain;f=src%2Fobject.cc;fp=src%2Fobject.cc;h=ae33bb15bca07c9f8460c145684c038fe21a952d;hp=0000000000000000000000000000000000000000;hb=a65a977df6fa8fee831c91cdc754d62e023b6630;hpb=b07896ffc92093a3e8adb4953d22927a5874e43d diff --git a/src/object.cc b/src/object.cc new file mode 100644 index 0000000..ae33bb1 --- /dev/null +++ b/src/object.cc @@ -0,0 +1,16 @@ +#include "object.h" + +CollSphere::CollSphere() +{ + radius = 1.0; +} + +bool CollSphere::contains(const Vec3 &v) const +{ + return length_sq(v - center) <= radius * radius; +} + +Vec3 CollSphere::project_surf(const Vec3 &v) const +{ + return center + normalize(v - center) * radius; +}