Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://coin3d.github.io
https://www.kongsberg.com/en/kogt/
SbTri3f.h
1#ifndef COIN_SBTRI3F_H
2#define COIN_SBTRI3F_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 <Inventor/SbVec3f.h>
37#include <Inventor/SbBox3f.h>
38
39class SbTri3fP;
40
41class SbTri3f {
42public:
43 SbTri3f(void);
44 SbTri3f(const SbTri3f & t);
45 SbTri3f(const SbVec3f & a, const SbVec3f & b, const SbVec3f & c);
46 ~SbTri3f(void);
47
48 SbTri3f & setValue(const SbTri3f & t);
49 SbTri3f & setValue(const SbVec3f & a, const SbVec3f & b, const SbVec3f & c);
50 void getValue(SbTri3f & t) const;
51 void getValue(SbVec3f & a, SbVec3f & b, SbVec3f & c) const;
52 SbVec3f getNormal() const;
53 float getDistance(const SbTri3f & t) const;
54 static float getDistance(const SbVec3f & p,
55 const SbVec3f & p1, const SbVec3f & p2);
56 float getDistance(const SbVec3f & p) const;
57 float getDistance(const SbVec3f & p1, const SbVec3f & p2) const;
58 static float sqrDistance(const SbVec3f & a1, const SbVec3f & a2,
59 const SbVec3f & b1, const SbVec3f & b2,
60 float * linP0, float * linP1);
61 float sqrDistance(const SbVec3f & p1,
62 float * pfSParam = NULL, float * pfTParam = NULL) const;
63
64 SbTri3f & operator = (const SbTri3f & t);
65
66 SbBool intersect(const SbTri3f & triangle) const;
67 SbBool intersect(const SbTri3f & triangle, float epsilon) const;
68
69 const SbBox3f getBoundingBox(void) const;
70
71private:
72 // FIXME: get rid of this -- a triangle is too simple a class to
73 // have a private implementation. 20030328 mortene.
74 SbTri3fP * const pimpl;
75};
76
77#endif // !COIN_SBTRI3F_H
The SbBox3f class is an abstraction for an axis aligned 3 dimensional box.
Definition SbBox3f.h:46
A class that at this point in time has one purpose - figuring out if two triangles intersect each oth...
Definition SbTri3f.h:41
const SbBox3f getBoundingBox(void) const
Definition SbTri3f.cpp:1517
static float sqrDistance(const SbVec3f &a1, const SbVec3f &a2, const SbVec3f &b1, const SbVec3f &b2, float *linP0, float *linP1)
Definition SbTri3f.cpp:898
float getDistance(const SbTri3f &t) const
Definition SbTri3f.cpp:1222
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition SbVec3f.h:51