1 #ifndef MSP_GEOMETRY_SHAPE_H_
2 #define MSP_GEOMETRY_SHAPE_H_
5 #include <msp/linal/vector.h>
10 template<typename T, unsigned D>
13 template<typename T, unsigned D>
16 template<typename T, unsigned D>
19 template<typename T, unsigned D>
27 virtual Shape *clone() const = 0;
29 virtual HyperBox<T, D> get_axis_aligned_bounding_box() const = 0;
30 virtual bool contains(const LinAl::Vector<T, D> &) const = 0;
31 virtual bool check_intersection(const Ray<T, D> &) const = 0;
32 virtual unsigned get_max_ray_intersections() const = 0;
33 virtual unsigned get_intersections(const Ray<T, D> &, SurfacePoint<T, D> *, unsigned) const = 0;
34 std::vector<SurfacePoint<T, D> > get_intersections(const Ray<T, D> &) const;
37 template<typename T, unsigned D>
38 std::vector<SurfacePoint<T, D> > Shape<T, D>::get_intersections(const Ray<T, D> &ray) const
40 unsigned max_isect = get_max_ray_intersections();
41 std::vector<SurfacePoint<T, D> > points(max_isect);
42 unsigned count = get_intersections(ray, &points[0], max_isect);
47 } // namespace Geometry