25 #ifndef HERMES_GEOMETRY_SPHERE_H
26 #define HERMES_GEOMETRY_SPHERE_H
28 #include <hermes/geometry/parametric_surface.h>
29 #include <hermes/geometry/shape.h>
38 this->type = ShapeType::SPHERE;
55 real_t angle = t * Constants::two_pi;
56 return this->c + this->r *
vec2(cosf(angle), sinf(angle));
68 return c + r *
vec2(this->closestNormal(p));
76 bbox2 boundingBox()
const override {
return bbox2(c - r, c + r); }
77 void closestIntersection(
const Ray2 &r,
82 double signedDistance(
const point2 &p)
const override {
98 return c + r *
vec3(this->closestNormal(p));
106 bbox3 boundingBox()
const override {
return bbox3(c - r, c + r); }
107 void closestIntersection(
const Ray3 &r,
124 return c + r *
vec3(this->closestNormal(p));
132 bbox3 boundingBox()
const override {
return bbox3(c - r, c + r); }
133 void closestIntersection(
const Ray3 &r,
138 double signedDistance(
const point3 &p)
const override {
150 b = make_union(b, (*t)(center +
hermes::vec2(po.r, 0)));
151 b = make_union(b, (*t)(center +
hermes::vec2(-po.r, 0)));
152 b = make_union(b, (*t)(center +
hermes::vec2(0, po.r)));
153 b = make_union(b, (*t)(center +
hermes::vec2(0, -po.r)));
point2 operator()(real_t t) const override
Definition: sphere.h:54
Definition: parametric_surface.h:34
T x
0-th component
Definition: vector.h:155
T y
1-th component
Definition: vector.h:156
T x
0-th component
Definition: vector.h:415
T z
2-th component
Definition: vector.h:417
T y
1-th component
Definition: vector.h:416
#define HERMES_UNUSED_VARIABLE(x)
Specifies that variable is not used in this scope.
Definition: debug.h:62
float real_t
default floating point type
Definition: defs.h:75
HERMES_DEVICE_CALLABLE Normal3< T > normalize(const Normal3< T > &normal)
Computes normalized copy.
Definition: normal.h:201
HERMES_DEVICE_CALLABLE real_t distance(const Point2< T > &a, const Point2< T > &b)
Computes the Euclidean distance between two points.
Definition: point.h:295