const Shape<T, D-1> &get_base() const { return *base; }
T get_length() const { return length; }
- virtual HyperBox<T, D> get_axis_aligned_bounding_box() const;
+ virtual BoundingBox<T, D> get_axis_aligned_bounding_box() const;
virtual bool contains(const LinAl::Vector<T, D> &) const;
- virtual bool check_intersection(const Ray<T, D> &) const;
virtual unsigned get_max_ray_intersections() const;
virtual unsigned get_intersections(const Ray<T, D> &, SurfacePoint<T, D> *, unsigned) const;
};
}
template<typename T, unsigned D>
-inline HyperBox<T, D> ExtrudedShape<T, D>::get_axis_aligned_bounding_box() const
+inline BoundingBox<T, D> ExtrudedShape<T, D>::get_axis_aligned_bounding_box() const
{
- HyperBox<T, D-1> base_bbox = base->get_axis_aligned_bounding_box();
- return HyperBox<T, D>(LinAl::Vector<T, D>(base_bbox.get_dimensions(), length));
+ BoundingBox<T, D-1> base_bbox = base->get_axis_aligned_bounding_box();
+ T half_length = length/T(2);
+ return BoundingBox<T, D>(LinAl::Vector<T, D>(base_bbox.get_minimum_point(), -half_length),
+ LinAl::Vector<T, D>(base_bbox.get_maximum_point(), half_length));
}
template<typename T, unsigned D>
return base->contains(LinAl::Vector<T, D-1>(point));
}
-template<typename T, unsigned D>
-inline bool ExtrudedShape<T, D>::check_intersection(const Ray<T, D> &ray) const
-{
- return get_intersections(ray, 0, 1);
-}
-
template<typename T, unsigned D>
inline unsigned ExtrudedShape<T, D>::get_max_ray_intersections() const
{