1 ! Copyright (C) 2008 Jeff Bigot
\r
2 ! See http://factorcode.org/license.txt for BSD license.
\r
3 USING: help.markup help.syntax ;
\r
9 ! --------------------------------------------------------------
\r
11 ! --------------------------------------------------------------
\r
12 ARTICLE: "face-page" "face in ADSODA"
\r
13 "explanation of faces"
\r
16 "what is an halfspace"
\r
17 "halfspace touching-corners adjacent-faces"
\r
18 "touching-corners list of pointers to the corners which touch this face\n"
\r
20 "adjacent-faces list of pointers to the faces which touch this face\n"
\r
21 { $subsection face }
\r
22 { $subsection <face> }
\r
23 "test relative position"
\r
24 { $subsection point-inside-or-on-face? }
\r
25 { $subsection point-inside-face? }
\r
27 { $subsection flip-face }
\r
28 { $subsection face-translate }
\r
29 { $subsection face-transform }
\r
34 { $class-description "a face is defined by"
\r
35 { $list "halfspace equation" }
\r
36 { $list "list of touching corners" }
\r
37 { $list "list of adjacent faces" }
\r
39 "Touching corners and adjacent faces are defined by algorithm thanks to other faces of the solid"
\r
45 { $values { "v" "an halfspace equation" } { "tuple" "a face" } } ;
\r
47 { $values { "face" "a face" } { "face" "flipped face" } }
\r
48 { $description "change the orientation of a face" }
\r
51 HELP: face-translate
\r
52 { $values { "face" "a face" } { "v" "a vector" } }
\r
54 "translate a face following a vector"
\r
56 "a translation of an halfspace doesn't change the normal vector. this word just compute the new constant term" }
\r
60 HELP: face-transform
\r
61 { $values { "face" "a face" } { "m" "a transformation matrix" } }
\r
62 { $description "compute the transformation of a face using a transformation matrix" }
\r
65 ! --------------------------------
\r
67 ! --------------------------------------------------------------
\r
68 ARTICLE: "solid-page" "solid in ADSODA"
\r
69 "explanation of solids"
\r
72 { $subsection solid }
\r
73 { $subsection <solid> }
\r
74 "test relative position"
\r
75 { $subsection point-inside-solid? }
\r
76 { $subsection point-inside-or-on-solid? }
\r
77 "playing with faces and solids"
\r
78 { $subsection add-face }
\r
79 { $subsection cut-solid }
\r
80 { $subsection slice-solid }
\r
82 { $subsection solid-project }
\r
83 { $subsection solid-translate }
\r
84 { $subsection solid-transform }
\r
85 { $subsection subtract }
\r
87 { $subsection get-silhouette }
\r
89 { $subsection solid= }
\r
95 { $class-description "dimension" $nl "silhouettes" $nl "faces" $nl "corners" $nl "adjacencies-valid" $nl "color" $nl "name"
\r
100 { $values { "solid" "a solid" } { "face" "a face" } }
\r
101 { $description "reshape a solid with a face. The face truncate the solid." } ;
\r
104 { $values { "solid" "a solid" } { "halfspace" "an halfspace" } }
\r
105 { $description "like add-face but just with halfspace equation" } ;
\r
108 { $values { "solid" "a solid" } { "face" "a face" } { "solid1" "the outer part of the former solid" } { "solid2" "the inner part of the former solid" } }
\r
109 { $description "cut a solid into two parts. The face acts like a knife"
\r
113 HELP: solid-project
\r
114 { $values { "lights" "lights" } { "ambient" "ambient" } { "solid" "solid" } { "solids" "projection of solid" } }
\r
115 { $description "Project the solid using pv vector"
\r
117 "TODO: explain how to use lights"
\r
120 HELP: solid-translate
\r
121 { $values { "solid" "a solid" } { "v" "translating vector" } }
\r
122 { $description "Translate a solid using a vector"
\r
124 "v and solid must have the same dimension "
\r
127 HELP: solid-transform
\r
128 { $values { "solid" "a solid" } { "m" "transformation matrix" } }
\r
129 { $description "Transform a solid using a matrix"
\r
131 "v and solid must have the same dimension "
\r
135 { $values { "solid1" "initial shape" } { "solid2" "shape to remove" } { "solids" "resulting shape" } }
\r
136 { $description " " } ;
\r
139 ! --------------------------------------------------------------
\r
141 ! --------------------------------------------------------------
\r
142 ARTICLE: "space-page" "space in ADSODA"
\r
143 "A space is a collection of solids and lights."
\r
145 "link to functions"
\r
148 { $subsection space }
\r
149 { $subsection <space> }
\r
150 { $subsection suffix-solids }
\r
151 { $subsection suffix-lights }
\r
152 { $subsection clear-space-solids }
\r
153 { $subsection describe-space }
\r
157 { $subsection space-ensure-solids }
\r
158 { $subsection eliminate-empty-solids }
\r
159 { $subsection space-transform }
\r
160 { $subsection space-translate }
\r
161 { $subsection remove-hidden-solids }
\r
162 { $subsection space-project }
\r
168 { $class-description
\r
169 "dimension" $nl " solids" $nl " ambient-color" $nl "lights"
\r
173 HELP: suffix-solids
\r
174 "( space solid -- space )"
\r
175 { $values { "space" "a space" } { "solid" "a solid to add" } }
\r
176 { $description "Add solid to space definition" } ;
\r
178 HELP: suffix-lights
\r
179 "( space light -- space ) "
\r
180 { $values { "space" "a space" } { "light" "a light to add" } }
\r
181 { $description "Add a light to space definition" } ;
\r
183 HELP: clear-space-solids
\r
184 "( space -- space )"
\r
185 { $values { "space" "a space" } }
\r
186 { $description "remove all solids in space" } ;
\r
188 HELP: space-ensure-solids
\r
189 { $values { "space" "a space" } }
\r
190 { $description "rebuild corners of all solids in space" } ;
\r
194 HELP: space-transform
\r
195 " ( space m -- space )"
\r
196 { $values { "space" "a space" } { "m" "a matrix" } }
\r
197 { $description "Transform a space using a matrix" } ;
\r
199 HELP: space-translate
\r
200 { $values { "space" "a space" } { "v" "a vector" } }
\r
201 { $description "Translate a space following a vector" } ;
\r
203 HELP: describe-space " ( space -- )"
\r
204 { $values { "space" "a space" } }
\r
205 { $description "return a description of space" } ;
\r
207 HELP: space-project
\r
208 { $values { "space" "a space" } { "i" "an integer" } }
\r
209 { $description "Project a space along ith coordinate" } ;
\r
211 ! --------------------------------------------------------------
\r
213 ! --------------------------------------------------------------
\r
214 ARTICLE: "3D-rendering-page" "3D rendering in ADSODA"
\r
215 "explanation of 3D rendering"
\r
217 "link to functions"
\r
218 { $subsection face->GL }
\r
219 { $subsection solid->GL }
\r
220 { $subsection space->GL }
\r
225 { $values { "face" "a face" } { "color" "3 3 values array" } }
\r
226 { $description "" } ;
\r
229 { $values { "solid" "a solid" } }
\r
230 { $description "" } ;
\r
233 { $values { "space" "a space" } }
\r
234 { $description "" } ;
\r
236 ! --------------------------------------------------------------
\r
238 ! --------------------------------------------------------------
\r
240 ARTICLE: "light-page" "light in ADSODA"
\r
241 "explanation of light"
\r
243 "link to functions"
\r
246 ARTICLE: { "adsoda" "light" } "ADSODA : lights"
\r
247 "! HELP: light position color"
\r
248 "! <light> ( -- tuple ) light new ;"
\r
250 "! light est un vecteur avec 3 variables pour les couleurs\n"
\r
252 " void Light::Apply(Vector& normal, double &cRed, double &cGreen, double &cBlue)\n"
\r
254 " // Dot the light direction with the normalized normal of Face."
\r
255 " register double intensity = -(normal * (*this));"
\r
257 " // Face is a backface, from light's perspective"
\r
258 " if (intensity < 0)"
\r
261 " // Add the intensity componentwise"
\r
262 " cRed += red * intensity;"
\r
263 " cGreen += green * intensity;"
\r
264 " cBlue += blue * intensity;"
\r
266 " // Clip to unit range"
\r
267 " if (cRed > 1.0) cRed = 1.0;"
\r
268 " if (cGreen > 1.0) cGreen = 1.0;"
\r
269 " if (cBlue > 1.0) cBlue = 1.0;"
\r
276 ARTICLE: { "adsoda" "halfspace" } "ADSODA : halfspace"
\r
277 "! demi espace défini par un vecteur normal et une constante"
\r
278 " defined by the concatenation of the normal vector and a constant"
\r
283 ARTICLE: "adsoda-main-page" "ADSODA : Arbitrary-Dimensional Solid Object Display Algorithm"
\r
284 "multidimensional handler :"
\r
286 "design a solid using face delimitations. Only works on convex shapes"
\r
288 { $emphasis "written in C++ by Greg Ferrar" }
\r
290 "full explanation on adsoda page at " { $url "http://www.flowerfire.com/ADSODA/" }
\r
292 "Useful words are describe on the following pages: "
\r
293 { $subsection "face-page" }
\r
294 { $subsection "solid-page" }
\r
295 { $subsection "space-page" }
\r
296 { $subsection "light-page" }
\r
297 { $subsection "3D-rendering-page" }
\r
300 ABOUT: "adsoda-main-page"
\r