Last change
on this file since 80 was
80,
checked in by Sam Hocevar, 12 years ago

 Adding the Golgotha source code. Not sure what's going to be interesting
in there, but since it's all public domain, there's certainly stuff to
pick up.


Property svn:keywords set to
Id

File size:
1.9 KB

Line  

1  /**********************************************************************


2  *<


3  FILE: box3.h


4 


5  DESCRIPTION: 3D Box class


6 


7  CREATED BY: Dan Silva


8 


9  HISTORY:


10 


11  *> Copyright (c) 1994, All Rights Reserved.


12  **********************************************************************/


13  #ifndef _BOX3_H


14 


15  #define _BOX3_H


16 


17  #include "point3.h"


18  #include "matrix3.h"


19 


20  class Box3 {


21  public:


22  Point3 pmin,pmax;


23  DllExport Box3();


24  Box3(const Point3& p, const Point3& q) { pmin = p; pmax = q;}


25  DllExport void Init();


26 


27  DllExport void MakeCube(const Point3& p, float side);


28 


29  // Access


30  Point3 Min() const { return pmin; }


31  Point3 Max() const { return pmax; }


32  Point3 Center() const { return(pmin+pmax)/(float)2.0; }


33  Point3 Width() const { return(pmaxpmin); }


34 


35  /* operator[] returns ith corner point: (i == (0..7) )


36  Mapping:


37  X Y Z


38  [0] : (min,min,min)


39  [1] : (max,min,min)


40  [2] : (min,max,min)


41  [3] : (max,max,min)


42  [4] : (min,min,max)


43  [5] : (max,min,max)


44  [6] : (min,max,max)


45  [7] : (max,max,max)


46  */


47  DllExport Point3 operator[](int i) const;


48 


49  // Modifiers


50  DllExport Box3& operator+=(const Point3& p); // expand this box to include Point3


51  DllExport Box3& operator+=(const Box3& b); // expand this box to include Box3


52 


53  DllExport void Scale(float s); // scale box about center


54  DllExport void Translate(const Point3 &p); // translate box


55  DllExport void EnlargeBy(float s); // enlarge by this amount on all sides


56 


57  // Returns a box that bounds the 8 transformed corners of the input box.


58  DllExport Box3 operator*(const Matrix3& tm) const;


59 


60  // Tests


61  DllExport int IsEmpty() const; // is this box empty?


62  DllExport int Contains(const Point3& p) const; // is point in this box?


63  DllExport int Contains(const Box3& b) const; // is box b totally in this box?


64 


65  };


66 


67 


68  #endif


Note: See
TracBrowser
for help on using the repository browser.