]> git.tdb.fi Git - r2c2.git/blobdiff - source/3d/layout.cpp
Make use of the geometry part of libmspmath
[r2c2.git] / source / 3d / layout.cpp
index d97dfe507472824aa5fdb91f7fa947a0d4b76063..69af0d4dbed6f525ecd122d9b9916ed331ef2999 100644 (file)
@@ -38,18 +38,13 @@ Layout3D::~Layout3D()
 
 void Layout3D::get_bounds(Vector &minp, Vector &maxp) const
 {
-       minp = maxp = Vector();
+       Geometry::BoundingBox<float, 3> bbox;
 
        for(TrackMap::const_iterator i=tracks.begin(); i!=tracks.end(); ++i)
-       {
-               Vector tmin;
-               Vector tmax;
-               i->second->get_bounds(Angle::zero(), tmin, tmax);
-               minp.x = min(minp.x, tmin.x);
-               minp.y = min(minp.y, tmin.y);
-               maxp.x = max(maxp.x, tmax.x);
-               maxp.y = max(maxp.y, tmax.y);
-       }
+               bbox = bbox|i->second->get_track().get_type().get_shape()->get_axis_aligned_bounding_box();
+
+       minp = bbox.get_minimum_point();
+       maxp = bbox.get_maximum_point();
 }
 
 void Layout3D::add_track(Track3D &t)