X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fobject.cpp;h=d7c7db25e68beaeac81923f5eb2e6258b10e2e7d;hb=4529bf980cf3558d86c07266de7d890d3f5e06a6;hp=1b48a862ae6b634c499fa49c094e54bc5c41cb05;hpb=b88d3630a0e3fdd763db018bbe5dbfe3180a95f2;p=r2c2.git diff --git a/source/libr2c2/object.cpp b/source/libr2c2/object.cpp index 1b48a86..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