1 /*******************************************************************************
2  * boxes.h
3  *
4  * This module contains all defines, typedefs, and prototypes for BOXES.CPP.
5  *
6  * ---------------------------------------------------------------------------
7  * Persistence of Vision Ray Tracer ('POV-Ray') version 3.7.
8  * Copyright 1991-2013 Persistence of Vision Raytracer Pty. Ltd.
9  *
10  * POV-Ray is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Affero General Public License as
12  * published by the Free Software Foundation, either version 3 of the
13  * License, or (at your option) any later version.
14  *
15  * POV-Ray is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Affero General Public License for more details.
19  *
20  * You should have received a copy of the GNU Affero General Public License
21  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22  * ---------------------------------------------------------------------------
23  * POV-Ray is based on the popular DKB raytracer version 2.12.
24  * DKBTrace was originally written by David K. Buck.
25  * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
26  * ---------------------------------------------------------------------------
27  * $File: //depot/public/povray/3.x/source/backend/shape/boxes.h $
28  * $Revision: #1 $
29  * $Change: 6069 $
30  * $DateTime: 2013/11/06 11:59:40 $
31  * $Author: chrisc $
32  *******************************************************************************/
33 
34 #ifndef BOXES_H
35 #define BOXES_H
36 
37 namespace pov
38 {
39 
40 /*****************************************************************************
41 * Global preprocessor defines
42 ******************************************************************************/
43 
44 #define BOX_OBJECT (BASIC_OBJECT)
45 
46 
47 
48 /*****************************************************************************
49 * Global typedefs
50 ******************************************************************************/
51 
52 class Box : public ObjectBase
53 {
54 	public:
55 		VECTOR bounds[2];
56 
57 		Box();
58 		virtual ~Box();
59 
60 		virtual ObjectPtr Copy();
61 
62 		virtual bool All_Intersections(const Ray&, IStack&, TraceThreadData *);
63 		virtual bool Inside(const VECTOR, TraceThreadData *) const;
64 		virtual void Normal(VECTOR, Intersection *, TraceThreadData *) const;
65 		virtual void UVCoord(UV_VECT, const Intersection *, TraceThreadData *) const;
66 		virtual void Translate(const VECTOR, const TRANSFORM *);
67 		virtual void Rotate(const VECTOR, const TRANSFORM *);
68 		virtual void Scale(const VECTOR, const TRANSFORM *);
69 		virtual void Transform(const TRANSFORM *);
70 		virtual void Invert();
71 		virtual void Compute_BBox();
72 		virtual bool Intersect_BBox(BBoxDirection, const BBOX_VECT&, const BBOX_VECT&, BBOX_VAL) const;
73 
74 		static bool Intersect(const Ray& ray, const TRANSFORM *Trans, const VECTOR Corner1, const VECTOR Corner2, DBL *Depth1, DBL *Depth2, int *Side1, int  *Side2);
75 };
76 
77 }
78 
79 #endif
80