0024001: Stereographic rendering support
[occt.git] / src / OpenGl / OpenGl_AABB.hxx
CommitLineData
e276548b 1// Created on: 2013-08-27
2// Created by: Denis BOGOLEPOV
3// Copyright (c) 2013 OPEN CASCADE SAS
4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
e276548b 6//
973c2be1 7// This library is free software; you can redistribute it and / or modify it
8// under the terms of the GNU Lesser General Public version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
e276548b 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
e276548b 15
16#ifndef _OpenGl_AABB_Header
17#define _OpenGl_AABB_Header
18
19#include <OpenGl_RaytraceTypes.hxx>
20
21
22//! Axis aligned bounding box (AABB).
23class OpenGl_AABB
24{
25public:
26
27 //! Creates default (invalid) bounding volume.
28 OpenGl_AABB();
29
30 //! Creates bounding volume of given point.
31 OpenGl_AABB (const OpenGl_RTVec4f& thePoint);
32
33 //! Creates copy of another bounding volume.
34 OpenGl_AABB (const OpenGl_AABB& theVolume);
35
36 //! Creates bounding volume from min and max points.
37 OpenGl_AABB (const OpenGl_RTVec4f& theMinPoint,
38 const OpenGl_RTVec4f& theMaxPoint);
39
40 //! Is object represents uninitialized volume?
41 bool IsVoid() const { return !myIsValid; }
42
43 //! Appends new point to the volume.
44 void Add (const OpenGl_RTVec4f& theVector);
45 //! Combines the volume with another volume.
46 void Combine (const OpenGl_AABB& theVolume);
47
48 //! Returns new volume created by appending a point to current volume.
49 OpenGl_AABB Added (const OpenGl_RTVec4f& thePoint) const;
50 //! Returns new volume created by combining with specified volume.
51 OpenGl_AABB Combined (const OpenGl_AABB& theVolume) const;
52
53 //! Clears bounding volume (makes object invalid).
54 void Clear();
55
56 //! Evaluates surface area of bounding volume.
57 float Area() const;
58
59 //! Return diagonal of bounding volume.
60 OpenGl_RTVec4f Size() const;
61
62 //! Returns minimum point of bounding volume.
63 const OpenGl_RTVec4f& CornerMin() const { return myMinPoint; }
64 //! Returns maximum point of bounding volume.
65 const OpenGl_RTVec4f& CornerMax() const { return myMaxPoint; }
66
67 //! Returns minimum point of bounding volume.
68 OpenGl_RTVec4f& CornerMin() { return myMinPoint; }
69 //! Returns maximum point of bounding volume.
70 OpenGl_RTVec4f& CornerMax() { return myMaxPoint; }
71
72private:
73
74 //! Minimum point of bounding volume.
75 OpenGl_RTVec4f myMinPoint;
76 //! Maximum point of bounding volume.
77 OpenGl_RTVec4f myMaxPoint;
78
79 //! Is bounding volume valid (up to date)?
80 bool myIsValid;
81};
82
83#endif