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