Coin: SbXfBox3f.h Source File

| Coin3D is Free Software, published under the BSD 3-clause license. | https://coin3d.github.io https://www.kongsberg.com/en/kogt/

SbXfBox3f.h
1#ifndef COIN_SBXFBOX3F_H
2#define COIN_SBXFBOX3F_H
3
4/**************************************************************************\
5 * Copyright (c) Kongsberg Oil & Gas Technologies AS
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * Neither the name of the copyright holder nor the names of its
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34\**************************************************************************/
35
36#include <cstdio>
37#include <Inventor/SbBox3f.h>
38#include <Inventor/SbMatrix.h>
39
40 class COIN_DLL_API SbXfBox3f : public SbBox3f {
41 typedef SbBox3f inherited;
42
43public:
44 SbXfBox3f(void);
45 SbXfBox3f(const SbVec3f & boxmin, const SbVec3f & boxmax);
46 SbXfBox3f(const SbBox3f & box);
47 ~SbXfBox3f();
48
49 void setTransform(const SbMatrix & m);
50 const SbMatrix & getTransform(void) const;
51 const SbMatrix & getInverse(void) const;
52 SbVec3f getCenter(void) const;
53 void extendBy(const SbVec3f & pt);
54 void extendBy(const SbBox3f & bb);
55 void extendBy(const SbXfBox3f & bb);
56 SbBool intersect(const SbVec3f & pt) const;
57 SbBool intersect(const SbBox3f & bb) const;
58 SbBool intersect(const SbXfBox3f & bb) const;
59 void getSpan(const SbVec3f & direction, float & dMin, float & dMax) const;
60 SbBox3f project(void) const;
61 friend COIN_DLL_API int operator ==(const SbXfBox3f & b1, const SbXfBox3f & b2);
62 friend COIN_DLL_API int operator !=(const SbXfBox3f & b1, const SbXfBox3f & b2);
63 // Must override the transform() method from SbBox3f, as the box and
64 // the transform matrix are supposed to be kept separate in
65 // SbXfBox3f. --mortene
66 void transform(const SbMatrix & m);
67 // Overridden from SbBox3f
68 float getVolume(void) const;
69
70 void print(FILE * file) const;
71
72private:
73 // incorrect for SbXfBox3f. Hide them
74 const SbVec3f & getMin(void) const {return SbBox3f::getMin(); }
75 const SbVec3f & getMax(void) const { return SbBox3f::getMax(); }
76
77 void calcInverse(void) const;
78 void makeInvInvalid(void);
79
80 SbMatrix matrix, invertedmatrix;
81};
82
83COIN_DLL_API int operator ==(const SbXfBox3f & b1, const SbXfBox3f & b2);
84COIN_DLL_API int operator !=(const SbXfBox3f & b1, const SbXfBox3f & b2);
85
86#endif // !COIN_SBXFBOX3F_H
SbBox3f::getCenter
SbVec3f getCenter(void) const
Definition SbBox3f.h:90
SbBox3f::operator!=
int operator!=(const SbBox3f &b1, const SbBox3f &b2)
Definition SbBox3f.h:115
SbBox3f::getMax
const SbVec3f & getMax(void) const
Definition SbBox3f.h:72
SbBox3f::getSpan
void getSpan(const SbVec3f &dir, float &dmin, float &dmax) const
Definition SbBox3f.cpp:382
SbBox3f::getVolume
float getVolume(void) const
Definition SbBox3f.h:82
SbBox3f::operator==
int operator==(const SbBox3f &b1, const SbBox3f &b2)
Definition SbBox3f.h:111
SbBox3f::SbBox3f
SbBox3f(void)
Definition SbBox3f.h:48
SbBox3f::intersect
SbBool intersect(const SbVec3f &pt) const
Definition SbBox3f.cpp:275
SbBox3f::getMin
const SbVec3f & getMin(void) const
Definition SbBox3f.h:70
SbBox3f::print
void print(FILE *file) const
Definition SbBox3f.cpp:460
SbBox3f::transform
void transform(const SbMatrix &matrix)
Definition SbBox3f.cpp:430
SbBox3f::extendBy
void extendBy(const SbVec3f &pt)
Definition SbBox3f.cpp:235
SbMatrix
The SbMatrix class is a 4x4 dimensional representation of a matrix.
Definition SbMatrix.h:47
SbVec3f
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition SbVec3f.h:51
SbXfBox3f
The SbXfBox3f class is a 3 dimensional box with floating point coordinates and an attached transforma...
Definition SbXfBox3f.h:40
SbXfBox3f::project
SbBox3f project(void) const
Definition SbXfBox3f.cpp:659
SbXfBox3f::SbXfBox3f
SbXfBox3f(void)
Definition SbXfBox3f.cpp:83
SbXfBox3f::setTransform
void setTransform(const SbMatrix &m)
Definition SbXfBox3f.cpp:135
SbXfBox3f::getTransform
const SbMatrix & getTransform(void) const
Definition SbXfBox3f.cpp:145
SbXfBox3f::getInverse
const SbMatrix & getInverse(void) const
Definition SbXfBox3f.cpp:154