Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

open-axiom repository from github

24005 views
1
/*
2
Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd.
3
All rights reserved.
4
Copyright (C) 2007-2008, Gabriel Dos Reis.
5
all rights reserved.
6
7
Redistribution and use in source and binary forms, with or without
8
modification, are permitted provided that the following conditions are
9
met:
10
11
- Redistributions of source code must retain the above copyright
12
notice, this list of conditions and the following disclaimer.
13
14
- Redistributions in binary form must reproduce the above copyright
15
notice, this list of conditions and the following disclaimer in
16
the documentation and/or other materials provided with the
17
distribution.
18
19
- Neither the name of The Numerical ALgorithms Group Ltd. nor the
20
names of its contributors may be used to endorse or promote products
21
derived from this software without specific prior written permission.
22
23
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
24
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
26
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
27
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
*/
35
36
37
/***********************************************************************
38
contour.h
39
***********************************************************************/
40
#define segDEBUG
41
42
/* #define contour -100*/
43
44
#define CONTOUR_float double
45
#define ACTIVE_poly_struct poly
46
47
#define line_crosses_plane(z_min, z_max, z_val) \
48
((z_min < z_val) && (z_max >= z_val))
49
50
#ifdef oldie
51
typedef struct _active_poly_struct {
52
struct _active_poly_struct *next;
53
int num;
54
struct _poly *polygon;
55
} active_poly_struct;
56
#endif
57
58
typedef struct _segment_struct {
59
struct _segment_struct *next;
60
struct _viewTriple *point1, *point2;
61
} segment_struct;
62
63
typedef struct _segment_list_struct {
64
int num_segs;
65
segment_struct *segments;
66
int num, max_num; /* num=slice num, max_num=#slices for this contour */
67
} segment_list_struct;
68
69
/*=====================================================================*
70
Macro Definitions
71
*=====================================================================*/
72
#define foreach_slice(index, slice, slice_list, max_slices) \
73
for (index=0; \
74
(index<max_slices) && (int)(slice=(slice_list+index)); \
75
index++)
76
#define foreach_segment(seg, slice, fl) \
77
for (seg=slice->segments; (fl) && (seg != NIL(segment_struct)); seg=seg->next)
78
79
#define foreach_segment_old(idx, s, sl, max, fl) \
80
for (idx=0; idx<max; idx++) \
81
for (s=(sl+idx)->segments; (fl) && (s != NIL(segment_struct)); s=s->next)
82
83
/*---------------------------------------------------------------------*
84
interface stuff
85
*---------------------------------------------------------------------*/
86
#ifdef oldie
87
#define contourCursorForeground moColor(red1, light)
88
#define contourCursorBackground moColor(green0, normal)
89
#else
90
#define contourCursorForeground monoColor(68)
91
#define contourCursorBackground monoColor(197)
92
#endif
93
94
#define contourMASK ExposureMask
95
96
#define contourPlaneTextCOLOR 28
97
98
/*---------------------------------------------------*
99
title, dividing lines & stuff
100
*---------------------------------------------------*/
101
#define contourTitleColor moColor(blue0, normal)
102
#define contourTitleA 190
103
#define contourTitleB 217
104
105
#define dotSize 8
106
#define dotExt 12
107
#define dotColor moColor(red2, pastel)
108
109
/*---------------------------------------------------*
110
Button Positions & Dimensions
111
*---------------------------------------------------*/
112
#define contourPlaneXY_X 150
113
#define contourPlaneXY_Y 250
114
#define contourPlaneXZ_X 190
115
#define contourPlaneXZ_Y 250
116
#define contourPlaneYZ_X 230
117
#define contourPlaneYZ_Y 250
118
#define contourLittleButt_W 20
119
#define contourLittleButt_H 20
120
121
#define contourFlatView_X 120
122
#define contourFlatView_Y 290
123
#define contourAppendSegs_X 120
124
#define contourAppendSegs_Y 320
125
#ifdef oldie
126
#define contourBigButt_W 170
127
#define contourBigButt_H 20
128
#else
129
#define contourBigButt_W 10
130
#define contourBigButt_H 10
131
#endif
132
/*---------------------------------------------------*
133
Line & button colors
134
*---------------------------------------------------*/
135
#define abort_FG moColor(red1, pastel)
136
#define return_FG moColor(green2, pastel)
137
#define littleButt_FG moColor(yellow0, pastel)
138
#define bigButt_FG moColor(orange1, pastel)
139
140
/*---------------------------------------------------*
141
longitude part
142
*---------------------------------------------------*/
143
#define contourLongitude_X 10
144
#define contourLongitude_Y 55
145
#define contourLongitude_W 135
146
#define contourLongitude_H 120
147
148
#define long_FG moColor(green1, normal)
149
#define long_corner_X 36
150
#define long_corner_Y 72
151
#define long_RADIUS 40
152
#define long_W (long_RADIUS<<1)
153
#define long_H (long_RADIUS<<1)
154
155
#define long_center_X (long_corner_X + long_RADIUS)
156
#define long_center_Y (long_corner_Y + long_RADIUS)
157
158
#define long_str_X 15
159
#define long_str_Y 48
160
161
/*---------------------------------------------------*
162
latitude part
163
*---------------------------------------------------*/
164
#define contourLatitude_X 160
165
#define contourLatitude_Y 55
166
#define contourLatitude_W 135
167
#define contourLatitude_H 120
168
169
#define lat_FG moColor(green1, normal)
170
#define lat_corner_X 130
171
#define lat_corner_Y 85
172
#define lat_RADIUS 60
173
#define lat_W (lat_RADIUS<<1)
174
#define lat_H (lat_RADIUS<<1)
175
#define lat_quad_X (lat_corner_X + lat_RADIUS)
176
#define lat_quad_Y (lat_corner_Y + lat_RADIUS)
177
178
#define lat_str_X 176
179
#define lat_str_Y 48
180
181
/*---------------------------------------------------*
182
slice part
183
*---------------------------------------------------*/
184
#define contourSliceNum_X 10
185
#define contourSliceNum_Y 245
186
#define contourSliceNum_W 90
187
#define contourSliceNum_H 115
188
189
#define slice_FG moColor(red1, normal)
190
191
#define slice_str_X 20
192
#define slice_str_Y 240
193
#define slicer_image_X 50
194
#define slicer_image_Y 253
195
196
#define MAX_SLICES 100
197
198
199