forked from royasutton/omdl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.scad
213 lines (150 loc) · 7.43 KB
/
constants.scad
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
//! Constant definitions.
/***************************************************************************//**
\file
\author Roy Allen Sutton
\date 2015-2018
\copyright
This file is part of [omdl] (https://github.com/royasutton/omdl),
an OpenSCAD mechanical design library.
The \em omdl is free software; you can redistribute it and/or modify
it under the terms of the [GNU Lesser General Public License]
(http://www.gnu.org/licenses/lgpl.html) as published by the Free
Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
The \em omdl is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the \em omdl; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA; or see <http://www.gnu.org/licenses/>.
\details
\amu_include (include/amu/pgid_path_pstem_pg.amu)
\amu_define group_name (Constants)
\amu_define group_brief (Design constants.)
\amu_define group1 (${group}_general)
\amu_define group1_name (General)
\amu_define group1_brief (General mathematical constants.)
\amu_define group2 (${group}_system)
\amu_define group2_name (System)
\amu_define group2_brief (System and program limits.)
\amu_define group3 (${group}_euclidean)
\amu_define group3_name (Euclidean)
\amu_define group3_brief (Euclidean space axis mapping.)
\ingroup \amu_eval(${group1} ${group2} ${group3})
*******************************************************************************/
//----------------------------------------------------------------------------//
// group.
//----------------------------------------------------------------------------//
/***************************************************************************//**
\amu_include (include/amu/group.amu)
*******************************************************************************/
//----------------------------------------------------------------------------//
// group1.
//----------------------------------------------------------------------------//
/***************************************************************************//**
\addtogroup \amu_eval(${group})
@{
\defgroup \amu_eval(${group1} ${group1_name})
\brief \amu_eval(${group1_brief})
@{
*******************************************************************************/
//----------------------------------------------------------------------------//
//! <decimal> Epsilon, small distance to deal with overlapping shapes.
aeps = 0.001;
//! <decimal> The ratio of a circle's circumference to its diameter.
pi = 3.14159265358979323;
//! <decimal> The ratio of a circle's circumference to its radius.
tau = 2*pi;
//! <decimal> The golden ratio.
phi = (1 + sqrt(5)) / 2;
//! @}
//! @}
//----------------------------------------------------------------------------//
// group2.
//----------------------------------------------------------------------------//
/***************************************************************************//**
\addtogroup \amu_eval(${group})
@{
\defgroup \amu_eval(${group2} ${group2_name})
\brief \amu_eval(${group2_brief})
@{
*******************************************************************************/
//----------------------------------------------------------------------------//
//! <decimal> The largest representable number in OpenSCAD scripts.
number_max = 1e308;
//! <decimal> The smallest representable number in OpenSCAD scripts.
number_min = -1e308;
//! <string> A string with no characters (the empty string).
empty_str = "";
//! \<list> A list with no values (the empty list).
empty_lst = [];
//! OpenSCAD coarse grid limit.
grid_coarse = 0.001;
//! OpenSCAD fine grid limit.
grid_fine = 0.000001;
//! @}
//! @}
//----------------------------------------------------------------------------//
// group3.
//----------------------------------------------------------------------------//
/***************************************************************************//**
\addtogroup \amu_eval(${group})
@{
\defgroup \amu_eval(${group3} ${group3_name})
\brief \amu_eval(${group3_brief})
@{
*******************************************************************************/
//----------------------------------------------------------------------------//
//! <integer> The coordinate axis index for the Euclidean space x-axis.
x_axis_ci = 0;
//! <integer> The coordinate axis index for the Euclidean space y-axis.
y_axis_ci = 1;
//! <integer> The coordinate axis index for the Euclidean space z-axis.
z_axis_ci = 2;
//! <decimal-list-2> A 2d zero vector (a list with two zeros).
zero2d = [0, 0];
//! <point-2d> The origin point coordinate in 2d Euclidean space.
origin2d = [0, 0];
//! <vector-2d> The unit vector of the positive x-axis in 2d Euclidean space.
x_axis2d_uv = [1, 0];
//! <vector-2d> The unit vector of the positive y-axis in 2d Euclidean space.
y_axis2d_uv = [0, 1];
//! <line-2d> A positively-directed unit line centered on the x-axis in 2d Euclidean space.
x_axis2d_ul = [-x_axis2d_uv, +x_axis2d_uv];
//! <line-2d> A positively-directed unit line centered on the y-axis in 2d Euclidean space.
y_axis2d_ul = [-y_axis2d_uv, +y_axis2d_uv];
//! <decimal-list-2> A 3d zero vector (a list with three zeros).
zero3d = [0, 0, 0];
//! <point-3d> The origin point coordinate in 3-dimensional Euclidean space.
origin3d = [0, 0, 0];
//! <vector-3d> The unit vector of the positive x-axis in 3d Euclidean space.
x_axis3d_uv = [1, 0, 0];
//! <vector-3d> The unit vector of the positive y-axis in 3d Euclidean space.
y_axis3d_uv = [0, 1, 0];
//! <vector-3d> The unit vector of the positive z-axis in 3d Euclidean space.
z_axis3d_uv = [0, 0, 1];
//! <line-3d> A positively-directed unit line centered on the x-axis in 3d Euclidean space.
x_axis3d_ul = [-x_axis3d_uv, +x_axis3d_uv];
//! <line-3d> A positively-directed unit line centered on the y-axis in 3d Euclidean space.
y_axis3d_ul = [-y_axis3d_uv, +y_axis3d_uv];
//! <line-3d> A positively-directed unit line centered on the z-axis in 3d Euclidean space.
z_axis3d_ul = [-z_axis3d_uv, +z_axis3d_uv];
//! <plane> The right-handed xy plane centered at the origin with normal vector.
xy_plane_on = [origin3d, z_axis3d_uv];
//! <plane> The right-handed yz plane centered at the origin with normal vector.
yz_plane_on = [origin3d, x_axis3d_uv];
//! <plane> The right-handed zx plane centered at the origin with normal vector.
zx_plane_on = [origin3d, y_axis3d_uv];
//! <plane> The right-handed xy plane centered at the origin with coplanar unit square points.
xy_plane_os = [origin3d, [for (r=[[1,1],[1,-1],[-1,-1],[-1,1]]) [r[0],r[1],0]]];
//! <plane> The right-handed yz plane centered at the origin with coplanar unit square points.
yz_plane_os = [origin3d, [for (r=[[1,1],[1,-1],[-1,-1],[-1,1]]) [0,r[0],r[1]]]];
//! <plane> The right-handed zx plane centered at the origin with coplanar unit square points.
zx_plane_os = [origin3d, [for (r=[[1,1],[1,-1],[-1,-1],[-1,1]]) [r[1],0,r[0]]]];
//! @}
//! @}
//----------------------------------------------------------------------------//
// end of file
//----------------------------------------------------------------------------//