Blender V5.0
Projections.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#ifndef __PROJECTIONS_H__
6#define __PROJECTIONS_H__
7
8#include <cstdlib>
9
10#include "MEM_guardedalloc.h"
11
12#define CONTAINS_INDEX
13#define GRID_DIMENSION 20
14
15#if defined(_WIN32) && !(_MSC_VER >= 1900)
16# define isnan(n) _isnan(n)
17# define LONG __int64
18# define int64_t __int64
19#else
20# include <cstdint>
21#endif
22
29
30extern const int vertmap[8][3];
31extern const int centmap[3][3][3][2];
32extern const int edgemap[12][2];
33extern const int facemap[6][4];
34
35/* Axes:
36 * 0, 1, 2: cube face normals
37 *
38 * 3: triangle normal
39 *
40 * 4, 5, 6,
41 * 7, 8, 9,
42 * 10, 11, 12: cross of each triangle edge vector with each cube
43 * face normal
44 */
45#define NUM_AXES 13
46
53
55 double norm[3];
56
58 int index;
59};
60
61/* This is a projection for the cube against a single projection
62 axis, see CubeTriangleIsect.cubeProj */
68
73 public:
76
79
80 CubeTriangleIsect() = default;
81
85 CubeTriangleIsect(int64_t cube[2][3], int64_t trig[3][3], int64_t error, int triind);
86
92
93 unsigned char getBoxMask();
94
98 void shift(const int off[3]);
99
103 int isIntersecting() const;
104
105 int isIntersectingPrimary(int edgeInd) const;
106
107 float getIntersectionPrimary(int edgeInd) const;
108
109 MEM_CXX_CLASS_ALLOC_FUNCS("DUALCON:CubeTriangleIsect")
110};
111
112#endif /* __PROJECTIONS_H__ */
Read Guarded memory(de)allocation.
const int edgemap[12][2]
const int centmap[3][3][3][2]
const int vertmap[8][3]
const int facemap[6][4]
#define NUM_AXES
Definition Projections.h:45
long long int int64_t
CubeTriangleIsect()=default
void shift(const int off[3])
int isIntersecting() const
int isIntersectingPrimary(int edgeInd) const
CubeProjection cubeProj[NUM_AXES]
Projections of the cube vertices.
Definition Projections.h:78
unsigned char getBoxMask()
TriangleProjection * inherit
Inheritable portion.
Definition Projections.h:75
float getIntersectionPrimary(int edgeInd) const
static void error(const char *str)
int64_t edges[3]
Definition Projections.h:65
int64_t tri_proj[NUM_AXES][2]
Projections of triangle (min and max).
Definition Projections.h:52
double norm[3]
Normal of the triangle.
Definition Projections.h:55
int index
Index of polygon.
Definition Projections.h:58