X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fobject.cpp;h=7a23d11a04e4779ee13da5e094a80a059cc4f147;hb=26a8dbeae14c685c6aef1aad3aa75c6f1a75e458;hp=ba1810f913ebbc20a59a53c50aa7d8936cdfdd63;hpb=0b75458245997b9df6da47cc4534341c8426084b;p=r2c2.git diff --git a/source/libr2c2/object.cpp b/source/libr2c2/object.cpp index ba1810f..7a23d11 100644 --- a/source/libr2c2/object.cpp +++ b/source/libr2c2/object.cpp @@ -5,6 +5,11 @@ using namespace std; namespace R2C2 { +Object::Object(Layout &l): + layout(l), + shape(0) +{ } + Snap Object::get_snap_node(unsigned) const { throw out_of_range("Object::get_snap_node"); @@ -18,8 +23,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 *s = get_shape(); + if(!s) + return BoundingBox(); + + Transform trans = Transform::translation(position)* + Transform::rotation(rotation, Vector(0, 0, 1)); + return trans.transform(s->get_axis_aligned_bounding_box()); +} + } // namespace R2C2