GteTetrahedronKey.h
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.0 (2016/06/19)
7 
8 #pragma once
9 
11 #include <array>
12 
13 namespace gte
14 {
15 
16 template <bool Ordered>
17 class TetrahedronKey : public FeatureKey<4, Ordered>
18 {
19 public:
20  // An ordered tetrahedron has V[0] = min(v0,v1,v2,v3). Let {u1,u2,u3} be
21  // the set of inputs excluding the one assigned to V[0] and define
22  // V[1] = min(u1,u2,u3). Choose (V[1],V[2],V[3]) to be a permutation of
23  // (u1,u2,u3) so that the final storage is one of
24  // (v0,v1,v2,v3), (v0,v2,v3,v1), (v0,v3,v1,v2)
25  // (v1,v3,v2,v0), (v1,v2,v0,v3), (v1,v0,v3,v2)
26  // (v2,v3,v0,v1), (v2,v0,v1,v3), (v2,v1,v3,v0)
27  // (v3,v1,v0,v2), (v3,v0,v2,v1), (v3,v2,v1,v0)
28  // The idea is that if v0 corresponds to (1,0,0,0), v1 corresponds to
29  // (0,1,0,0), v2 corresponds to (0,0,1,0), and v3 corresponds to
30  // (0,0,0,1), the ordering (v0,v1,v2,v3) corresponds to the 4x4 identity
31  // matrix I; the rows are the specified 4-tuples. The permutation
32  // (V[0],V[1],V[2],V[3]) induces a permutation of the rows of the identity
33  // matrix to form a permutation matrix P with det(P) = 1 = det(I).
34  //
35  // An unordered tetrahedron stores a permutation of (v0,v1,v2,v3) so that
36  // V[0] < V[1] < V[2] < V[3].
37  TetrahedronKey(int v0 = -1, int v1 = -1, int v2 = -1, int v3 = -1);
38 
39  // Indexing for the vertices of the triangle opposite a vertex. The
40  // triangle opposite vertex j is
41  // <oppositeFace[j][0], oppositeFace[j][1], oppositeFace[j][2]>
42  // and is listed in counterclockwise order when viewed from outside the
43  // tetrahedron.
44  static std::array<int, 3> const oppositeFace[4];
45 };
46 
47 #if !defined(__MSWINDOWS__)
48 // Apple LLVM 6.1.0 (clang-602.0.49) correctly requires these declarations
49 // to occur before the definition in GteTetrahedronKey.cpp. From the C++
50 // specification:
51 // An explicit specialization of a static data member of a template is
52 // a definition if the declaration includes an initializer; otherwise,
53 // it is a declaration.
54 // If these declarations are exposed for MSVS 2013, the compiler generates
55 // error C2086, claiming that this is a definition (rather than a declaration)
56 // and the cpp file has a redefinition.
57 template<> std::array<int, 3> const TetrahedronKey<false>::oppositeFace[4];
58 template<> std::array<int, 3> const TetrahedronKey<true>::oppositeFace[4];
59 #endif
60 
61 }
TetrahedronKey(int v0=-1, int v1=-1, int v2=-1, int v3=-1)
GLfloat GLfloat v1
Definition: glcorearb.h:812
GLfloat GLfloat GLfloat GLfloat v3
Definition: glcorearb.h:814
GLfloat v0
Definition: glcorearb.h:811
GLfloat GLfloat GLfloat v2
Definition: glcorearb.h:813
std::array< int, 3 > const oppositeFace[4]


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:00:01