// // C++ Interface: BoundingBox // // Description: // // // Authors: Dalla Corte Ludovic (C) 2011 // Phan Laurent // Etudiants Infographie Groupe 1 2010-2011 // // Copyright: See COPYING file that comes with this distribution // // /** * Bounding Box : * * 4-----5 * /| /| * 7-----6 | * | | | | * | 3---|-2 * |-----|/ * 0 1 */ #ifndef BOUNDINGBOX_H_ #define BOUNDINGBOX_H_ #include "models.h" #include "meshmodel.h" #include "modelsList.h" #include "ray.h" #include class Face { public: std::vector points; point_t min; point_t max; Face(std::vector pointsValue, point_t minValue, point_t maxValue) : points(pointsValue), min(minValue),max(maxValue) {} }; class BoundingBox { public: BoundingBox(Gmodel*); BoundingBox(BoundingBox*, BoundingBox*); virtual ~BoundingBox() {} void sphereBB(Gsphere*); void discBB(Gdisc*); void meshModelBB(Gmeshmodel*); Gmodel* getModel() { return model; } std::vector getCornerPoints() { return cornerPoints; } std::vector getFaces() { return faces; } point_t getBBoxCenter() { return center; } void setModel(Gmodel* newModel) { model = newModel; } void setCornerPoints(std::vector newCornerPoints) { cornerPoints = newCornerPoints; } void setFaces(std::vector newFaces) { faces = newFaces; } void setBBoxCenter(point_t newCenter) { center = newCenter; } bool intersect(ray*); private: Gmodel* model; std::vector cornerPoints; std::vector faces; point_t center; double getMinCoordinateX(std::vector); double getMinCoordinateY(std::vector); double getMinCoordinateZ(std::vector); double getMaxCoordinateX(std::vector); double getMaxCoordinateY(std::vector); double getMaxCoordinateZ(std::vector); bool intersectionX(Face, ray*); bool intersectionY(Face, ray*); bool intersectionZ(Face, ray*); void initFaces(); }; #endif /* BOUNDINGBOX_H_ */