Hermes
queries.h
Go to the documentation of this file.
1 
28 #ifndef HERMES_GEOMETRY_QUERIES_H
29 #define HERMES_GEOMETRY_QUERIES_H
30 
31 #include <hermes/geometry/bbox.h>
32 #include <hermes/geometry/ray.h>
34 #include <hermes/geometry/utils.h>
35 #include <hermes/geometry/vector.h>
36 #include <hermes/geometry/line.h>
37 #include <hermes/geometry/plane.h>
38 #include <hermes/geometry/sphere.h>
39 #include <hermes/common/result.h>
40 
41 namespace hermes {
42 
48  static point3 closestPoint(const bbox3 &box, const point3 &p);
54  static bool intersect(const Plane &pl, const Line &l, point3 &p);
66  static bool intersect(const Sphere &s, const Line &l, point3 &p1, point3 &p2);
82  static bool intersect(const bbox2 &box, const Ray2 &ray, real_t &hit1,
83  real_t &hit2, real_t *normal = nullptr);
98  [[deprecated]] static bool intersect(const bbox3 &box, const Ray3 &ray, real_t &hit1,
99  real_t &hit2);
112  static bool intersect(const bbox3 &box, const Ray3 &ray, real_t &hit1);
117  static bool intersect(const hermes::Line2& line, const ray2& ray);
118 };
119 
120 // *********************************************************************************************************************
121 // GeometricPredicates
122 // *********************************************************************************************************************
129  static Result<real_t> intersect(const hermes::Line2& line, const ray2& ray);
137  static Result<real_t> intersect(const hermes::bbox3 &bounds,
138  const ray3 &ray,
139  const hermes::vec3 &inv_dir,
140  const i32 dir_is_neg[3],
141  real_t max_t = Constants::real_infinity);
147  static Result<real_t> intersect(const hermes::bbox3 &bounds,
148  const ray3 &ray, real_t *second_hit = nullptr);
149 
161  static Result<real_t> intersect(const point3 &p1, const point3 &p2,
162  const point3 &p3, const Ray3 &ray,
163  real_t *b1 = nullptr, real_t *b2 = nullptr);
168  static Result<real_t> intersect(const Plane& plane, const Ray3& ray);
169 };
170 
171 } // namespace hermes
172 
173 #endif // HERMES_GEOMETRY_QUERIES_H
Definition: bbox.h:84
Definition: bbox.h:187
Represents a 2D line by a point and a vector.
Definition: line.h:37
Represents a line by a point and a vector.
Definition: line.h:87
Definition: plane.h:39
Definition: ray.h:39
Definition: ray.h:70
Holds a valid object or an error.
Definition: result.h:56
Definition: sphere.h:90
float real_t
default floating point type
Definition: defs.h:75
int32_t i32
32 bit size integer type
Definition: defs.h:83
Set of geometric predicates.
Definition: queries.h:124
static Result< real_t > intersect(const hermes::Line2 &line, const ray2 &ray)
Intersects a line by a ray.
Definition: queries.cpp:171
static Result< real_t > intersect(const hermes::bbox3 &bounds, const ray3 &ray, const hermes::vec3 &inv_dir, const i32 dir_is_neg[3], real_t max_t=Constants::real_infinity)
Definition: queries.h:43
static bool intersect(const Plane &pl, const Line &l, point3 &p)
Definition: queries.cpp:47
static point3 closestPoint(const bbox3 &box, const point3 &p)
Definition: queries.cpp:41
Geometric transform classes.
Geometric vector classes.