X-Git-Url: http://git.tdb.fi/?p=libs%2Fmath.git;a=blobdiff_plain;f=source%2Fgeometry%2Fextrudedshape.h;h=de582e3d26bf278139600aca6c3cc1d15609a798;hp=83933b0808a02f32d8febcce5eee8c8a23ad85d0;hb=09cc3a8648dd20e9a07d669b353c4a120b67c1c4;hpb=f7dcf3f0be55316bf20ac0c318dd90cb78a75c80 diff --git a/source/geometry/extrudedshape.h b/source/geometry/extrudedshape.h index 83933b0..de582e3 100644 --- a/source/geometry/extrudedshape.h +++ b/source/geometry/extrudedshape.h @@ -31,7 +31,7 @@ public: const Shape &get_base() const { return *base; } T get_length() const { return length; } - virtual HyperBox get_axis_aligned_bounding_box() const; + virtual BoundingBox get_axis_aligned_bounding_box() const; virtual bool contains(const LinAl::Vector &) const; virtual unsigned get_max_ray_intersections() const; virtual unsigned get_intersections(const Ray &, SurfacePoint *, unsigned) const; @@ -74,10 +74,12 @@ inline ExtrudedShape *ExtrudedShape::clone() const } template -inline HyperBox ExtrudedShape::get_axis_aligned_bounding_box() const +inline BoundingBox ExtrudedShape::get_axis_aligned_bounding_box() const { - HyperBox base_bbox = base->get_axis_aligned_bounding_box(); - return HyperBox(LinAl::Vector(base_bbox.get_dimensions(), length)); + BoundingBox base_bbox = base->get_axis_aligned_bounding_box(); + T half_length = length/T(2); + return BoundingBox(LinAl::Vector(base_bbox.get_minimum_point(), -half_length), + LinAl::Vector(base_bbox.get_maximum_point(), half_length)); } template