/* * © Copyright 2014 – Urheberrechtshinweis * Alle Rechte vorbehalten / All Rights Reserved * * Programmcode ist urheberrechtlich geschuetzt. * Das Urheberrecht liegt, soweit nicht ausdruecklich anders gekennzeichnet, bei Frank Ebner. * Keine Verwendung ohne explizite Genehmigung. * (vgl. § 106 ff UrhG / § 97 UrhG) */ #ifndef BOUNDINGVOLUMEAABB2_H #define BOUNDINGVOLUMEAABB2_H #include #include "BoundingVolume.h" #include "../BBox2.h" class BoundingVolumeAABB2 : public BBox2 { public: BoundingVolumeAABB2() {;} BoundingVolumeAABB2(const BBox2& bb) : BBox2(bb) {;} float getVolumeSize() const { const float dx = getMax().x - getMin().x; const float dy = getMax().y - getMin().y; return (dx*dy); } /** construct a volume around the given point-set */ static BoundingVolumeAABB2 fromVertices(const std::vector& verts) { BoundingVolumeAABB2 bvs; for (const Point2 p : verts) {bvs.add(p);} return bvs; } static BoundingVolumeAABB2 join(const BoundingVolumeAABB2 a, const BoundingVolumeAABB2 b) { return BoundingVolumeAABB2(BBox2::join(a, b)); } }; #endif // BOUNDINGVOLUMEAABB2_H