X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fobject.cpp;h=d7c7db25e68beaeac81923f5eb2e6258b10e2e7d;hb=18c529dfdd34e07f4f6021151ddce29fa85437bc;hp=ba1810f913ebbc20a59a53c50aa7d8936cdfdd63;hpb=0b75458245997b9df6da47cc4534341c8426084b;p=r2c2.git diff --git a/source/libr2c2/object.cpp b/source/libr2c2/object.cpp index ba1810f..d7c7db2 100644 --- a/source/libr2c2/object.cpp +++ b/source/libr2c2/object.cpp @@ -18,8 +18,8 @@ bool Object::snap(Snap &sn, float limit, SnapType what) const for(unsigned i=0; icheck_intersection(reverse_trans.transform(ray)); +} + +BoundingBox Object::get_bounding_box() const +{ + const Shape *shape = get_type().get_shape(); + if(!shape) + return BoundingBox(); + + Transform trans = Transform::translation(position)* + Transform::rotation(rotation, Vector(0, 0, 1)); + return trans.transform(shape->get_axis_aligned_bounding_box()); +} + } // namespace R2C2