source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/vrippack-0.31/include/defines.h @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 2.6 KB
Line 
1/*
2
3Brian Curless
4
5Computer Graphics Laboratory
6Stanford University
7
8---------------------------------------------------------------------
9
10Copyright (1997) The Board of Trustees of the Leland Stanford Junior
11University. Except for commercial resale, lease, license or other
12commercial transactions, permission is hereby given to use, copy,
13modify this software for academic purposes only.  No part of this
14software or any derivatives thereof may be used in the production of
15computer models for resale or for use in a commercial
16product. STANFORD MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND
17CONCERNING THIS SOFTWARE.  No support is implied or provided.
18
19*/
20
21
22#ifndef _DEFINES_
23#define _DEFINES_
24
25#ifndef LINUX
26#include <malloc.h>
27#endif
28
29#ifdef LINUX
30#include <stdlib.h>
31#endif
32
33#include <string.h>
34
35#ifndef NULL
36#define NULL    0
37#endif
38
39#ifndef TRUE
40#define TRUE    1
41#endif
42
43#ifndef FALSE
44#define FALSE   0
45#endif
46
47#ifndef FLT_MAX
48#define FLT_MAX 3.40282347e+38F
49#endif
50
51#ifndef MAXFLOAT
52#define MAXFLOAT FLT_MAX
53#endif
54
55#ifndef MAX
56#define MAX(a, b) ((a) > (b) ? (a) : (b))
57#endif
58
59#ifndef MIN
60#define MIN(a, b) ((a) < (b) ? (a) : (b))
61#endif
62
63#ifndef SWAP
64#define SWAP(a, b, t) (t) = (a); (a) = (b); (b) = (t)
65#endif
66
67#ifndef SWAP_INT
68#define SWAP_INT(a, b) {int _temp_int = (a); (a) = (b); (b) = _temp_int;}
69#endif
70
71#ifndef SWAP_FLOAT
72#define SWAP_FLOAT(a, b) {float _temp_float =(a); (a) =(b); (b) =_temp_float;}
73#endif
74
75#ifndef SWAP_USHORT
76#define SWAP_USHORT(a, b) {unsigned short _temp_ushort = (a); (a) = (b); \
77  (b) = _temp_ushort;}
78#endif
79
80#ifndef SQUARE
81#define SQUARE(x) ((x)*(x))
82#endif
83
84#ifndef ROUND_UCHAR
85#define ROUND_UCHAR(x) (uchar((x)+0.5))
86#endif
87
88#ifndef ABS
89#define ABS(x) ((x) > 0 ? (x) : -(x))
90#endif
91
92#ifndef SIGN
93#define SIGN(x) ((x) > 0 ? 1 : -1)
94#endif
95
96#ifndef DEGTORAD
97#define DEGTORAD(x) ((x)*M_PI/180)
98#endif
99
100#ifndef RAD
101#define RAD(x) ((x)*M_PI/180)
102#endif
103
104#ifndef RADTODEG
105#define RADTODEG(x) ((x)*180/M_PI)
106#endif
107
108#ifndef LINUX
109
110#ifndef MALLOC
111#define MALLOC(x, n) ((x*)malloc((n)*sizeof(x)))
112#endif
113
114#ifndef newmalloc
115#define newmalloc(x, n) ((x*)malloc((n)*sizeof(x)))
116#endif /* newmalloc */
117
118#endif /* LINUX */
119
120#ifndef PI
121#define PI 3.14159265358979323846264
122#endif
123
124#ifndef EQSTR
125#define EQSTR(x, y)  (strcmp((x),(y)) == 0)
126#endif
127
128#ifndef IS_ODD
129#define IS_ODD(x)  ((x)%2 != 0)
130#endif
131
132#ifndef IS_EVEN
133#define IS_EVEN(x)  ((x)%2 == 0)
134#endif
135
136#ifndef ROUNT_INT
137#define ROUND_INT(x)  ((int)(x+0.5))
138#endif
139
140
141/* Watch out for BSD incompatibility */
142
143typedef unsigned char uchar;
144typedef unsigned short ushort;
145typedef unsigned int uint;
146
147
148typedef uchar byte;
149
150/* Stop using this? */
151/*typedef int Bool;*/
152
153#endif
Note: See TracBrowser for help on using the repository browser.