blob: c6daca886f41c7c0ad1b19fd6be84900b83a517b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
//-----------------------------------------------------------------------------
// BSPLIB HEADER: BspLibDefs.h
//
// Copyright (c) 1996-1998 by Markus Hadwiger
// All Rights Reserved.
//-----------------------------------------------------------------------------
#ifndef _BSPLIBDEFS_H_
#define _BSPLIBDEFS_H_
// standard C library headers -------------------------------------------------
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <stddef.h>
// various build dependent macros ---------------------------------------------
#ifdef _DEBUG
#define PUBLIC
#define PRIVATE static
#define D(x) x
#define CHECK_DEREFERENCING(x) x
#else
#define PUBLIC
#define PRIVATE static
#define D(x)
#define CHECK_DEREFERENCING(x) x
#endif
// define NAMESPACE usage -----------------------------------------------------
#define USE_BSPLIB_NAMESPACE
#ifdef USE_BSPLIB_NAMESPACE
#define BSPLIB_NAMESPACE BspLib
#define BSPLIB_NAMESPACE_BEGIN namespace BSPLIB_NAMESPACE {
#define BSPLIB_NAMESPACE_END }
#else
#define BSPLIB_NAMESPACE
#define BSPLIB_NAMESPACE_BEGIN
#define BSPLIB_NAMESPACE_END
#endif
#ifndef _WIN32
#define stricmp strcasecmp
#define strnicmp strncasecmp
#endif
// MS VC++ specific macros ----------------------------------------------------
#ifdef _MSC_VER
#define PATH_MAX _MAX_PATH
#endif
#define _CRT_SECURE_NO_WARNINGS 1
// boolean values -------------------------------------------------------------
#define TRUE 1
#define FALSE 0
// asm types ------------------------------------------------------------------
typedef uint8_t byte;
typedef uint16_t word;
typedef uint32_t dword;
// data types for coordinates -------------------------------------------------
typedef int32_t fixed_t;
typedef double hprec_t;
// conversion macros for 3 and 2 digit values ---------------------------------
#define DIG3_TO_STR( s, a ) (s)[0]=(((a)/100)%10)+'0';\
(s)[1]=(((a)/10)%10)+'0'; \
(s)[2]=((a)%10)+'0'; \
(s)[3]='\0';
#define DIG2_TO_STR( s, a ) (s)[0]=(((a)/10)%10)+'0'; \
(s)[1]=((a)%10)+'0'; \
(s)[2]='\0';
// some general structures ----------------------------------------------------
//
BSPLIB_NAMESPACE_BEGIN
// RGB color triplet using bytes as members -----------------------------------
struct ColorRGB {
byte R;
byte G;
byte B;
};
// RGB color triplet plus alpha using bytes as members ------------------------
struct ColorRGBA {
byte R;
byte G;
byte B;
byte A;
};
// RGB color triplet using floats as members ----------------------------------
struct ColorRGBf {
float R;
float G;
float B;
};
// RGB color triplet plus alpha using floats as members -----------------------
struct ColorRGBAf {
float R;
float G;
float B;
float A;
};
// epsilon area specifications ------------------------------------------------
//
#define EPS_SCALAR EpsAreas::eps_scalarproduct
#define EPS_COMP_ZERO EpsAreas::eps_vanishcomponent
#define EPS_DENOM_ZERO EpsAreas::eps_vanishdenominator
#define EPS_POINT_ON_PLANE EpsAreas::eps_planethickness
#define EPS_POINT_ON_LINE EpsAreas::eps_pointonline
#define EPS_POINT_ON_LINESEG EpsAreas::eps_pointonlineseg
#define EPS_VERTEX_MERGE EpsAreas::eps_vertexmergearea
class EpsAreas {
public:
static double eps_scalarproduct; // epsilon area for general scalar product comparisons
static double eps_vanishcomponent; // epsilon area for vanishing vector components
static double eps_vanishdenominator; // epsilon area for vanishing denominators
static double eps_planethickness; // epsilon area for width of "infinitely thin" plane
static double eps_pointonline; // epsilon area for point on line determination
static double eps_pointonlineseg; // epsilon area for point on lineseg parameter (t)
static double eps_vertexmergearea; // epsilon area for merging of vertices
};
BSPLIB_NAMESPACE_END
#endif // _BSPLIBDEFS_H_
|