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
6 ! --------------------------------------------------------------
\r
8 ! --------------------------------------------------------------
\r
9 ARTICLE: "face-page" "Face in ADSODA"
\r
10 "explanation of faces"
\r
12 "link to functions" $nl
\r
13 "what is an halfspace" $nl
\r
14 "halfspace touching-corners adjacent-faces" $nl
\r
15 "touching-corners list of pointers to the corners which touch this face" $nl
\r
16 "adjacent-faces list of pointers to the faces which touch this face"
\r
21 "test relative position"
\r
23 point-inside-or-on-face?
\r
36 { $class-description "a face is defined by"
\r
37 { $list "halfspace equation" }
\r
38 { $list "list of touching corners" }
\r
39 { $list "list of adjacent faces" }
\r
41 "Touching corners and adjacent faces are defined by algorithm thanks to other faces of the solid"
\r
47 { $values { "v" "an halfspace equation" } { "tuple" "a face" } } ;
\r
49 { $values { "face" "a face" } { "face" "flipped face" } }
\r
50 { $description "change the orientation of a face" }
\r
53 HELP: face-translate
\r
54 { $values { "face" "a face" } { "v" "a vector" } }
\r
56 "translate a face following a vector"
\r
58 "a translation of an halfspace doesn't change the normal vector. this word just compute the new constant term" }
\r
62 HELP: face-transform
\r
63 { $values { "face" "a face" } { "m" "a transformation matrix" } }
\r
64 { $description "compute the transformation of a face using a transformation matrix" }
\r
67 ! --------------------------------
\r
69 ! --------------------------------------------------------------
\r
70 ARTICLE: "solid-page" "Solid in ADSODA"
\r
71 "explanation of solids"
\r
78 "test relative position"
\r
81 point-inside-or-on-solid?
\r
83 "playing with faces and solids"
\r
101 { $class-description "dimension" $nl "silhouettes" $nl "faces" $nl "corners" $nl "adjacencies-valid" $nl "color" $nl "name"
\r
106 { $values { "solid" "a solid" } { "face" "a face" } }
\r
107 { $description "reshape a solid with a face. The face truncate the solid." } ;
\r
110 { $values { "solid" "a solid" } { "halfspace" "an halfspace" } }
\r
111 { $description "like add-face but just with halfspace equation" } ;
\r
114 { $values { "solid" "a solid" } { "face" "a face" } { "solid1" "the outer part of the former solid" } { "solid2" "the inner part of the former solid" } }
\r
115 { $description "cut a solid into two parts. The face acts like a knife"
\r
119 HELP: solid-project
\r
120 { $values { "lights" "lights" } { "ambient" "ambient" } { "solid" "solid" } { "solids" "projection of solid" } }
\r
121 { $description "Project the solid using pv vector"
\r
123 "TODO: explain how to use lights"
\r
126 HELP: solid-translate
\r
127 { $values { "solid" "a solid" } { "v" "translating vector" } }
\r
128 { $description "Translate a solid using a vector"
\r
130 "v and solid must have the same dimension "
\r
133 HELP: solid-transform
\r
134 { $values { "solid" "a solid" } { "m" "transformation matrix" } }
\r
135 { $description "Transform a solid using a matrix"
\r
137 "v and solid must have the same dimension "
\r
141 { $values { "solid1" "initial shape" } { "solid2" "shape to remove" } { "solids" "resulting shape" } }
\r
142 { $description "Substract solid2 from solid1" } ;
\r
145 ! --------------------------------------------------------------
\r
147 ! --------------------------------------------------------------
\r
148 ARTICLE: "space-page" "Space in ADSODA"
\r
149 "A space is a collection of solids and lights."
\r
151 "link to functions"
\r
159 clear-space-solids
\r
166 space-ensure-solids
\r
167 eliminate-empty-solids
\r
170 remove-hidden-solids
\r
178 { $class-description
\r
179 "dimension" $nl " solids" $nl " ambient-color" $nl "lights"
\r
183 HELP: suffix-solids
\r
184 "( space solid -- space )"
\r
185 { $values { "space" "a space" } { "solid" "a solid to add" } }
\r
186 { $description "Add solid to space definition" } ;
\r
188 HELP: suffix-lights
\r
189 "( space light -- space ) "
\r
190 { $values { "space" "a space" } { "light" "a light to add" } }
\r
191 { $description "Add a light to space definition" } ;
\r
193 HELP: clear-space-solids
\r
194 "( space -- space )"
\r
195 { $values { "space" "a space" } }
\r
196 { $description "remove all solids in space" } ;
\r
198 HELP: space-ensure-solids
\r
199 { $values { "space" "a space" } }
\r
200 { $description "rebuild corners of all solids in space" } ;
\r
204 HELP: space-transform
\r
205 { $values { "space" "a space" } { "m" "a matrix" } }
\r
206 { $description "Transform a space using a matrix" } ;
\r
208 HELP: space-translate
\r
209 { $values { "space" "a space" } { "v" "a vector" } }
\r
210 { $description "Translate a space following a vector" } ;
\r
212 HELP: describe-space
\r
213 { $values { "space" "a space" } }
\r
214 { $description "return a description of space" } ;
\r
216 HELP: space-project
\r
217 { $values { "space" "a space" } { "i" "an integer" } }
\r
218 { $description "Project a space along ith coordinate" } ;
\r
220 ! --------------------------------------------------------------
\r
222 ! --------------------------------------------------------------
\r
223 ARTICLE: "3D-rendering-page" "The 3D rendering in ADSODA"
\r
224 "explanation of 3D rendering"
\r
226 "link to functions"
\r
236 { $values { "face" "a face" } { "color" "3 3 values array" } }
\r
237 { $description "display a face" } ;
\r
240 { $values { "solid" "a solid" } }
\r
241 { $description "display a solid" } ;
\r
244 { $values { "space" "a space" } }
\r
245 { $description "display a space" } ;
\r
247 ! --------------------------------------------------------------
\r
249 ! --------------------------------------------------------------
\r
251 ARTICLE: "light-page" "Light in ADSODA"
\r
252 "explanation of light"
\r
254 "link to functions"
\r
257 ARTICLE: { "adsoda" "light" } "ADSODA : lights"
\r
259 ! HELP: light position color
\r
260 ! <light> ( -- tuple ) light new ;
\r
261 ! light est un vecteur avec 3 variables pour les couleurs\n
\r
262 void Light::Apply(Vector& normal, double &cRed, double &cGreen, double &cBlue)\n
\r
264 // Dot the light direction with the normalized normal of Face.
\r
265 register double intensity = -(normal * (*this));
\r
266 // Face is a backface, from light's perspective
\r
270 // Add the intensity componentwise
\r
271 cRed += red * intensity;
\r
272 cGreen += green * intensity;
\r
273 cBlue += blue * intensity;
\r
274 // Clip to unit range
\r
275 if (cRed > 1.0) cRed = 1.0;
\r
276 if (cGreen > 1.0) cGreen = 1.0;
\r
277 if (cBlue > 1.0) cBlue = 1.0;
\r
283 ARTICLE: { "adsoda" "halfspace" } "ADSODA : halfspace"
\r
284 " defined by the concatenation of the normal vector and a constant"
\r
289 ARTICLE: "adsoda-main-page" "ADSODA : Arbitrary-Dimensional Solid Object Display Algorithm"
\r
290 "multidimensional handler :"
\r
292 "design a solid using face delimitations. Only works on convex shapes"
\r
294 { $emphasis "written in C++ by Greg Ferrar" }
\r
296 "full explanation on adsoda page at " { $url "http://www.flowerfire.com/ADSODA/" }
\r
298 "Useful words are describe on the following pages: "
\r
304 "3D-rendering-page"
\r
307 ABOUT: "adsoda-main-page"
\r