Main Page | Class Hierarchy | Class List | File List | Class Members

boundingbox.h

00001 /* ************************************************************************* 00002 boundingbox.h - description 00003 ------------------- 00004 begin : Wed Oct 16 2002 00005 copyright : (C) 2002 by Micha Riser 00006 email : mriser@gmx.net 00007 00008 $Id: boundingbox_8h-source.html,v 1.1 2005/02/04 21:02:26 micha Exp $ 00009 00010 ************************************************************************* */ 00011 00012 /* ************************************************************************* 00013 * * 00014 * This program is free software; you can redistribute it and/or modify * 00015 * it under the terms of the GNU General Public License as published by * 00016 * the Free Software Foundation; either version 2 of the License, or * 00017 * (at your option) any later version. * 00018 * * 00019 ************************************************************************* */ 00020 00021 #ifndef BOUNDINGBOX_H 00022 #define BOUNDINGBOX_H 00023 00024 #include "vector.h" 00025 #include "transformatable.h" 00026 #include "statistics.h" 00027 00028 class TransparentTransformatable; 00029 00035 class BoundingBox { 00036 00037 public: // Constructors and destructor 00038 00043 BoundingBox(Vector3 edgemin, Vector3 edgemax): boxmin(edgemin), boxmax(edgemax) {} 00044 00045 public: // Methods that implement Transformatable 00046 00047 void translate(const Vector3& v) {boxmin.add(v); boxmax.add(v);} 00048 void scale(const Vector3& v); 00049 void rotateDeg(const Vector3& v); 00050 void rotateRad(const Vector3& v); 00051 void applyOrthogonalMatrix(const Matrix &m) {applyMatrix(m);} 00052 void applyMatrix(const Matrix &m); 00053 00054 public: // Methods that give access to min/max edge 00055 00059 Vector3 getBoxMin() const {return boxmin;} 00060 00064 Vector3 getBoxMax() const {return boxmax;} 00065 00066 public: // other methods 00067 00071 void transformate(const TransparentTransformatable &t); 00072 00078 DBL intersect(const Ray &r) const; 00079 00086 DBL intersect(const Ray &r, DBL tmax) const; 00087 00092 bool isInsideAt(const Vector3& a) const; 00093 00094 private: // Static members 00095 00098 static HitStatistics stat; 00099 00100 private: // Private attributes 00101 00104 Vector3 boxmin; 00107 Vector3 boxmax; 00108 00109 private: // Private methods 00110 void updateBoundingBoxPoints(Vector3& min, Vector3& max, const Matrix& rot, Vector3 test); 00111 00112 }; 00113 00114 #endif

Generated on Thu Jan 27 12:16:05 2005 for raytracer.kdevelop by doxygen 1.3.8