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
17 { $subsection face }
\r
18 { $subsection <face> }
\r
19 "test relative position"
\r
20 { $subsection point-inside-or-on-face? }
\r
21 { $subsection point-inside-face? }
\r
23 { $subsection flip-face }
\r
24 { $subsection face-translate }
\r
25 { $subsection face-transform }
\r
30 { $class-description "a face is defined by"
\r
31 { $list "halfspace equation" }
\r
32 { $list "list of touching corners" }
\r
33 { $list "list of adjacent faces" }
\r
35 "Touching corners and adjacent faces are defined by algorithm thanks to other faces of the solid"
\r
41 { $values { "v" "an halfspace equation" } { "tuple" "a face" } } ;
\r
43 { $values { "face" "a face" } { "face" "flipped face" } }
\r
44 { $description "change the orientation of a face" }
\r
47 HELP: face-translate
\r
48 { $values { "face" "a face" } { "v" "a vector" } }
\r
50 "translate a face following a vector"
\r
52 "a translation of an halfspace doesn't change the normal vector. this word just compute the new constant term" }
\r
56 HELP: face-transform
\r
57 { $values { "face" "a face" } { "m" "a transformation matrix" } }
\r
58 { $description "compute the transformation of a face using a transformation matrix" }
\r
61 ! --------------------------------
\r
63 ! --------------------------------------------------------------
\r
64 ARTICLE: "solid-page" "Solid in ADSODA"
\r
65 "explanation of solids"
\r
68 { $subsection solid }
\r
69 { $subsection <solid> }
\r
70 "test relative position"
\r
71 { $subsection point-inside-solid? }
\r
72 { $subsection point-inside-or-on-solid? }
\r
73 "playing with faces and solids"
\r
74 { $subsection add-face }
\r
75 { $subsection cut-solid }
\r
76 { $subsection slice-solid }
\r
78 { $subsection solid-project }
\r
79 { $subsection solid-translate }
\r
80 { $subsection solid-transform }
\r
81 { $subsection subtract }
\r
83 { $subsection get-silhouette }
\r
85 { $subsection solid= }
\r
91 { $class-description "dimension" $nl "silhouettes" $nl "faces" $nl "corners" $nl "adjacencies-valid" $nl "color" $nl "name"
\r
96 { $values { "solid" "a solid" } { "face" "a face" } }
\r
97 { $description "reshape a solid with a face. The face truncate the solid." } ;
\r
100 { $values { "solid" "a solid" } { "halfspace" "an halfspace" } }
\r
101 { $description "like add-face but just with halfspace equation" } ;
\r
104 { $values { "solid" "a solid" } { "face" "a face" } { "solid1" "the outer part of the former solid" } { "solid2" "the inner part of the former solid" } }
\r
105 { $description "cut a solid into two parts. The face acts like a knife"
\r
109 HELP: solid-project
\r
110 { $values { "lights" "lights" } { "ambient" "ambient" } { "solid" "solid" } { "solids" "projection of solid" } }
\r
111 { $description "Project the solid using pv vector"
\r
113 "TODO: explain how to use lights"
\r
116 HELP: solid-translate
\r
117 { $values { "solid" "a solid" } { "v" "translating vector" } }
\r
118 { $description "Translate a solid using a vector"
\r
120 "v and solid must have the same dimension "
\r
123 HELP: solid-transform
\r
124 { $values { "solid" "a solid" } { "m" "transformation matrix" } }
\r
125 { $description "Transform a solid using a matrix"
\r
127 "v and solid must have the same dimension "
\r
131 { $values { "solid1" "initial shape" } { "solid2" "shape to remove" } { "solids" "resulting shape" } }
\r
132 { $description "Substract solid2 from solid1" } ;
\r
135 ! --------------------------------------------------------------
\r
137 ! --------------------------------------------------------------
\r
138 ARTICLE: "space-page" "Space in ADSODA"
\r
139 "A space is a collection of solids and lights."
\r
141 "link to functions"
\r
144 { $subsection space }
\r
145 { $subsection <space> }
\r
146 { $subsection suffix-solids }
\r
147 { $subsection suffix-lights }
\r
148 { $subsection clear-space-solids }
\r
149 { $subsection describe-space }
\r
153 { $subsection space-ensure-solids }
\r
154 { $subsection eliminate-empty-solids }
\r
155 { $subsection space-transform }
\r
156 { $subsection space-translate }
\r
157 { $subsection remove-hidden-solids }
\r
158 { $subsection space-project }
\r
164 { $class-description
\r
165 "dimension" $nl " solids" $nl " ambient-color" $nl "lights"
\r
169 HELP: suffix-solids
\r
170 "( space solid -- space )"
\r
171 { $values { "space" "a space" } { "solid" "a solid to add" } }
\r
172 { $description "Add solid to space definition" } ;
\r
174 HELP: suffix-lights
\r
175 "( space light -- space ) "
\r
176 { $values { "space" "a space" } { "light" "a light to add" } }
\r
177 { $description "Add a light to space definition" } ;
\r
179 HELP: clear-space-solids
\r
180 "( space -- space )"
\r
181 { $values { "space" "a space" } }
\r
182 { $description "remove all solids in space" } ;
\r
184 HELP: space-ensure-solids
\r
185 { $values { "space" "a space" } }
\r
186 { $description "rebuild corners of all solids in space" } ;
\r
190 HELP: space-transform
\r
191 " ( space m -- space )"
\r
192 { $values { "space" "a space" } { "m" "a matrix" } }
\r
193 { $description "Transform a space using a matrix" } ;
\r
195 HELP: space-translate
\r
196 { $values { "space" "a space" } { "v" "a vector" } }
\r
197 { $description "Translate a space following a vector" } ;
\r
199 HELP: describe-space " ( space -- )"
\r
200 { $values { "space" "a space" } }
\r
201 { $description "return a description of space" } ;
\r
203 HELP: space-project
\r
204 { $values { "space" "a space" } { "i" "an integer" } }
\r
205 { $description "Project a space along ith coordinate" } ;
\r
207 ! --------------------------------------------------------------
\r
209 ! --------------------------------------------------------------
\r
210 ARTICLE: "3D-rendering-page" "The 3D rendering in ADSODA"
\r
211 "explanation of 3D rendering"
\r
213 "link to functions"
\r
214 { $subsection face->GL }
\r
215 { $subsection solid->GL }
\r
216 { $subsection space->GL }
\r
221 { $values { "face" "a face" } { "color" "3 3 values array" } }
\r
222 { $description "display a face" } ;
\r
225 { $values { "solid" "a solid" } }
\r
226 { $description "display a solid" } ;
\r
229 { $values { "space" "a space" } }
\r
230 { $description "display a space" } ;
\r
232 ! --------------------------------------------------------------
\r
234 ! --------------------------------------------------------------
\r
236 ARTICLE: "light-page" "Light in ADSODA"
\r
237 "explanation of light"
\r
239 "link to functions"
\r
242 ARTICLE: { "adsoda" "light" } "ADSODA : lights"
\r
244 ! HELP: light position color
\r
245 ! <light> ( -- tuple ) light new ;
\r
246 ! light est un vecteur avec 3 variables pour les couleurs\n
\r
247 void Light::Apply(Vector& normal, double &cRed, double &cGreen, double &cBlue)\n
\r
249 // Dot the light direction with the normalized normal of Face.
\r
250 register double intensity = -(normal * (*this));
\r
251 // Face is a backface, from light's perspective
\r
255 // Add the intensity componentwise
\r
256 cRed += red * intensity;
\r
257 cGreen += green * intensity;
\r
258 cBlue += blue * intensity;
\r
259 // Clip to unit range
\r
260 if (cRed > 1.0) cRed = 1.0;
\r
261 if (cGreen > 1.0) cGreen = 1.0;
\r
262 if (cBlue > 1.0) cBlue = 1.0;
\r
268 ARTICLE: { "adsoda" "halfspace" } "ADSODA : halfspace"
\r
269 " defined by the concatenation of the normal vector and a constant"
\r
274 ARTICLE: "adsoda-main-page" "ADSODA : Arbitrary-Dimensional Solid Object Display Algorithm"
\r
275 "multidimensional handler :"
\r
277 "design a solid using face delimitations. Only works on convex shapes"
\r
279 { $emphasis "written in C++ by Greg Ferrar" }
\r
281 "full explanation on adsoda page at " { $url "http://www.flowerfire.com/ADSODA/" }
\r
283 "Useful words are describe on the following pages: "
\r
284 { $subsection "face-page" }
\r
285 { $subsection "solid-page" }
\r
286 { $subsection "space-page" }
\r
287 { $subsection "light-page" }
\r
288 { $subsection "3D-rendering-page" }
\r
291 ABOUT: "adsoda-main-page"
\r