Blender  V2.93
Projections.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #ifndef __PROJECTIONS_H__
18 #define __PROJECTIONS_H__
19 
20 #include <stdio.h>
21 #include <stdlib.h>
22 
23 #define CONTAINS_INDEX
24 #define GRID_DIMENSION 20
25 
26 #if defined(_WIN32) && !(_MSC_VER >= 1900)
27 # define isnan(n) _isnan(n)
28 # define LONG __int64
29 # define int64_t __int64
30 #else
31 # include <stdint.h>
32 #endif
33 
41 extern const int vertmap[8][3];
42 extern const int centmap[3][3][3][2];
43 extern const int edgemap[12][2];
44 extern const int facemap[6][4];
45 
46 /* Axes:
47  * 0, 1, 2: cube face normals
48  *
49  * 3: triangle normal
50  *
51  * 4, 5, 6,
52  * 7, 8, 9,
53  * 10, 11, 12: cross of each triangle edge vector with each cube
54  * face normal
55  */
56 #define NUM_AXES 13
57 
64 
66  double norm[3];
67 
69  int index;
70 };
71 
72 /* This is a projection for the cube against a single projection
73  axis, see CubeTriangleIsect.cubeProj */
78 };
79 
84  public:
87 
90 
91  public:
93  {
94  }
95 
99  CubeTriangleIsect(int64_t cube[2][3], int64_t trig[3][3], int64_t error, int triind);
100 
106 
107  unsigned char getBoxMask();
108 
112  void shift(int off[3]);
113 
117  int isIntersecting() const;
118 
119  int isIntersectingPrimary(int edgeInd) const;
120 
121  float getIntersectionPrimary(int edgeInd) const;
122 
123 #ifdef WITH_CXX_GUARDEDALLOC
124  MEM_CXX_CLASS_ALLOC_FUNCS("DUALCON:CubeTriangleIsect")
125 #endif
126 };
127 
128 #endif /* __PROJECTIONS_H__ */
const int edgemap[12][2]
Definition: Projections.cpp:42
#define NUM_AXES
Definition: Projections.h:56
const int centmap[3][3][3][2]
Definition: Projections.cpp:35
const int vertmap[8][3]
Definition: Projections.cpp:24
const int facemap[6][4]
Definition: Projections.cpp:57
void shift(int off[3])
int isIntersecting() const
int isIntersectingPrimary(int edgeInd) const
CubeProjection cubeProj[NUM_AXES]
Projections of the cube vertices.
Definition: Projections.h:89
unsigned char getBoxMask()
TriangleProjection * inherit
Inheritable portion.
Definition: Projections.h:86
float getIntersectionPrimary(int edgeInd) const
static void error(const char *str)
Definition: meshlaplacian.c:65
__int64 int64_t
Definition: stdint.h:92
int64_t origin
Definition: Projections.h:75
int64_t edges[3]
Definition: Projections.h:76
int64_t tri_proj[NUM_AXES][2]
Projections of triangle (min and max)
Definition: Projections.h:63
double norm[3]
Normal of the triangle.
Definition: Projections.h:66
int index
Index of polygon.
Definition: Projections.h:69