Coin Logo http://www.sim.no
http://www.coin3d.org

SbBox3f.h
1 #ifndef COIN_SBBOX3F_H
2 #define COIN_SBBOX3F_H
3 
4 /**************************************************************************\
5  *
6  * This file is part of the Coin 3D visualization library.
7  * Copyright (C) 1998-2007 by Systems in Motion. All rights reserved.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * ("GPL") version 2 as published by the Free Software Foundation.
12  * See the file LICENSE.GPL at the root directory of this source
13  * distribution for additional information about the GNU GPL.
14  *
15  * For using Coin with software that can not be combined with the GNU
16  * GPL, and for taking advantage of the additional benefits of our
17  * support services, please contact Systems in Motion about acquiring
18  * a Coin Professional Edition License.
19  *
20  * See http://www.coin3d.org/ for more information.
21  *
22  * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
23  * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24  *
25 \**************************************************************************/
26 
27 #include <stdio.h>
28 
29 #include <Inventor/SbVec3f.h>
30 
31 class SbBox3d;
32 class SbBox3i32;
33 class SbBox3s;
34 
35 class SbMatrix;
36 
37 class COIN_DLL_API SbBox3f {
38 public:
39  SbBox3f(void);
40  SbBox3f(const float minx, const float miny, const float minz,
41  const float maxx, const float maxy, const float maxz);
42  SbBox3f(const SbVec3f & min, const SbVec3f & max);
43  explicit SbBox3f(const SbBox3d & box) { setBounds(box); }
44  explicit SbBox3f(const SbBox3s & box) { setBounds(box); }
45  explicit SbBox3f(const SbBox3i32 & box) { setBounds(box); }
46  ~SbBox3f();
47 
48  void setBounds(const float minx, const float miny, const float minz,
49  const float maxx, const float maxy, const float maxz);
50  void setBounds(const SbVec3f & min, const SbVec3f & max);
51  SbBox3f & setBounds(const SbBox3d & box);
52  SbBox3f & setBounds(const SbBox3s & box);
53  SbBox3f & setBounds(const SbBox3i32 & box);
54 
55  void getBounds(float & minx, float & miny, float & minz,
56  float & maxx, float & maxy, float & maxz) const;
57  void getBounds(SbVec3f & min, SbVec3f & max) const;
58 
59  const SbVec3f & getMin(void) const;
60  SbVec3f & getMin(void);
61  const SbVec3f & getMax(void) const;
62  SbVec3f & getMax(void);
63 
64  void extendBy(const SbVec3f & point);
65  void extendBy(const SbBox3f & box);
66  void transform(const SbMatrix & matrix);
67  void makeEmpty(void);
68  SbBool isEmpty(void) const;
69  SbBool hasVolume(void) const;
70  float getVolume(void) const;
71 
72  SbBool intersect(const SbVec3f & point) const;
73  SbBool intersect(const SbBox3f & box) const;
74  SbVec3f getClosestPoint(const SbVec3f & point) const;
75  SbBool outside(const SbMatrix & mvp, int & cullbits) const;
76 
77  SbVec3f getCenter(void) const;
78  void getOrigin(float & x0, float & y0, float & z0) const;
79  void getSize(float & dx, float & dy, float & dz) const;
80 
81  void getSpan(const SbVec3f & dir, float & dmin, float & dmax) const;
82 
83  friend COIN_DLL_API int operator ==(const SbBox3f & b1, const SbBox3f & b2);
84  friend COIN_DLL_API int operator !=(const SbBox3f & b1, const SbBox3f & b2);
85 
86  void print(FILE * file) const;
87 
88 private:
89  SbVec3f min, max;
90 };
91 
92 COIN_DLL_API int operator ==(const SbBox3f & b1, const SbBox3f & b2);
93 COIN_DLL_API int operator !=(const SbBox3f & b1, const SbBox3f & b2);
94 
95 #endif // !COIN_SBBOX3F_H
The SbBox3s class is a 3 dimensional box with short integer coordinates.This box class is used by oth...
Definition: SbBox3s.h:34
The SbBox3f class is an abstraction for an axis aligned 3 dimensional box.This box abstraction class ...
Definition: SbBox3f.h:37
SbBox3f(const SbBox3i32 &box)
Definition: SbBox3f.h:45
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition: SbVec3f.h:37
The SbMatrix class is a 4x4 dimensional representation of a matrix.SbMatrix is used by many other cla...
Definition: SbMatrix.h:37
The SbBox3d class is an abstraction for an axis aligned 3 dimensional box.This box abstraction class ...
Definition: SbBox3d.h:37
Definition: SbBox3i32.h:35
SbBox3f(const SbBox3s &box)
Definition: SbBox3f.h:44
SbBox3f(const SbBox3d &box)
Definition: SbBox3f.h:43

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Fri Feb 17 2017 for Coin by Doxygen. 1.8.13