]> gitweb.factorcode.org Git - factor.git/blobdiff - unmaintained/adsoda/adsoda-docs.factor
tools.test: Make the flag public. Finish porting tester changes to fuzzer.
[factor.git] / unmaintained / adsoda / adsoda-docs.factor
old mode 100755 (executable)
new mode 100644 (file)
index d90beb7..a6ad0c7
-! Copyright (C) 2008 Jeff Bigot\r
-! See http://factorcode.org/license.txt for BSD license.\r
-USING: help.markup help.syntax ;\r
-\r
-IN: adsoda\r
-\r
-\r
-\r
-! --------------------------------------------------------------\r
-! faces\r
-! --------------------------------------------------------------\r
-ARTICLE: "face-page" "face in ADSODA"\r
-"explanation of faces"\r
-$nl\r
-"link to functions"\r
-"what is an halfspace"\r
-"halfspace touching-corners adjacent-faces"\r
-"touching-corners list of pointers to the corners which touch this face\n"\r
-\r
-"adjacent-faces list of pointers to the faces which touch this face\n"\r
-{ $subsection face }\r
-{ $subsection <face> }\r
-"test relative position"\r
-{ $subsection point-inside-or-on-face? } \r
-{ $subsection point-inside-face? }\r
-"handling face"\r
-{ $subsection flip-face }\r
-{ $subsection face-translate  }\r
-{ $subsection  face-transform }\r
-\r
-;\r
-\r
-HELP: face\r
-{ $class-description "a face is defined by"\r
-{ $list "halfspace equation" }\r
-{ $list "list of touching corners" }\r
-{ $list "list of adjacent faces" }\r
-$nl\r
-"Touching corners and adjacent faces are defined by algorithm thanks to other faces of the solid"\r
-}\r
-\r
-\r
-;\r
-HELP: <face> \r
-{ $values { "v" "an halfspace equation" } { "tuple" "a face" }  }   ;\r
-HELP: flip-face \r
-{ $values { "face" "a face" } { "face" "flipped face" } }\r
-{ $description "change the orientation of a face" }\r
-;\r
-\r
-HELP: face-translate \r
-{ $values { "face" "a face" } { "v" "a vector" } }\r
-{ $description \r
-"translate a face following a vector"\r
-$nl\r
-"a translation of an halfspace doesn't change the normal vector. this word just compute the new constant term" }\r
-\r
\r
- ;\r
-HELP: face-transform \r
-{ $values { "face" "a face" } { "m" "a transformation matrix" } }\r
-{ $description  "compute the transformation of a face using a transformation matrix" }\r
\r
- ;\r
-! --------------------------------\r
-! solid\r
-! --------------------------------------------------------------\r
-ARTICLE: "solid-page" "solid in ADSODA"\r
-"explanation of solids"\r
-$nl\r
-"link to functions"\r
-{ $subsection solid }\r
-{ $subsection <solid> }\r
-"test relative position"\r
-{ $subsection point-inside-solid? }\r
-{ $subsection point-inside-or-on-solid? }\r
-"playing with faces and solids"\r
-{ $subsection add-face }\r
-{ $subsection cut-solid }\r
-{ $subsection slice-solid }\r
-"solid handling"\r
-{ $subsection solid-project }\r
-{ $subsection solid-translate }\r
-{ $subsection solid-transform }\r
-{ $subsection subtract }\r
-\r
-{ $subsection get-silhouette  }\r
-\r
-{ $subsection  solid= }\r
-\r
-\r
-;\r
-\r
-HELP: solid \r
-{ $class-description "dimension" $nl "silhouettes" $nl "faces" $nl "corners" $nl "adjacencies-valid" $nl "color" $nl "name" \r
-}\r
-;\r
-\r
-HELP: add-face \r
-{ $values { "solid" "a solid" } { "face" "a face" } }\r
-{ $description "reshape a solid with a face. The face truncate the solid." } ;\r
-\r
-HELP: cut-solid\r
-{ $values { "solid" "a solid" } { "halfspace" "an halfspace" } }\r
-{ $description "like add-face but just with halfspace equation" } ;\r
-\r
-HELP: slice-solid\r
-{ $values { "solid" "a solid" } { "face" "a face" } { "solid1" "the outer part of the former solid" } { "solid2" "the inner part of the former solid" } }\r
-{ $description "cut a solid into two parts. The face acts like a knife"\r
-}  ;\r
-\r
-\r
-HELP: solid-project\r
-{ $values { "lights" "lights" } { "ambient" "ambient" } { "solid" "solid" } { "solids" "projection of solid" } }\r
-{ $description "Project the solid using pv vector" \r
-$nl\r
-"TODO: explain how to use lights"\r
-} ;\r
-\r
-HELP: solid-translate \r
-{ $values { "solid" "a solid" } { "v" "translating vector" } }\r
-{ $description "Translate a solid using a vector" \r
-$nl\r
-"v and solid must have the same dimension "\r
-} ;\r
-\r
-HELP: solid-transform \r
-{ $values { "solid" "a solid" } { "m" "transformation matrix" } }\r
-{ $description "Transform a solid using a matrix"\r
-$nl\r
-"v and solid must have the same dimension "\r
-} ;\r
-\r
-HELP: subtract \r
-{ $values { "solid1" "initial shape" } { "solid2" "shape to remove" } { "solids" "resulting shape" } }\r
-{ $description  " " } ;\r
-\r
-\r
-! --------------------------------------------------------------\r
-! space \r
-! --------------------------------------------------------------\r
-ARTICLE: "space-page" "space in ADSODA"\r
-"A space is a collection of solids and lights."\r
-$nl\r
-"link to functions"\r
-$nl\r
-"Defining words"\r
-{ $subsection space }\r
-{ $subsection <space> } \r
-{ $subsection suffix-solids  }\r
-{ $subsection suffix-lights }\r
-{ $subsection clear-space-solids  }\r
-{ $subsection describe-space }\r
-\r
-\r
-"Handling space"\r
-{ $subsection space-ensure-solids }\r
-{ $subsection eliminate-empty-solids  }\r
-{ $subsection space-transform }\r
-{ $subsection space-translate }\r
-{ $subsection remove-hidden-solids }\r
-{ $subsection space-project }\r
-\r
-\r
-;\r
-\r
-HELP: space \r
-{ $class-description \r
-"dimension" $nl " solids" $nl " ambient-color" $nl "lights" \r
-}\r
-;\r
-\r
-HELP: suffix-solids \r
-"( space solid -- space )"\r
-{ $values { "space" "a space" } { "solid" "a solid to add" } }\r
-{ $description "Add solid to space definition" } ;\r
-\r
-HELP: suffix-lights \r
-"( space light -- space ) "\r
-{ $values { "space" "a space" } { "light" "a light to add" } }\r
-{ $description "Add a light to space definition" } ;\r
-\r
-HELP: clear-space-solids \r
-"( space -- space )"   \r
-{ $values { "space" "a space" } }\r
-{ $description "remove all solids in space" } ;\r
-\r
-HELP: space-ensure-solids \r
-{ $values { "space" "a space" } }\r
-{ $description "rebuild corners of all solids in space" } ;\r
-\r
-\r
-\r
-HELP: space-transform \r
-" ( space m -- space )" \r
-{ $values { "space" "a space" } { "m" "a matrix" } }\r
-{ $description "Transform a space using a matrix" } ;\r
-\r
-HELP: space-translate \r
-{ $values { "space" "a space" } { "v" "a vector" } }\r
-{ $description "Translate a space following a vector" } ;\r
-\r
-HELP: describe-space " ( space -- )"\r
-{ $values { "space" "a space" } }\r
-{ $description "return a description of space" } ;\r
-\r
-HELP: space-project \r
-{ $values { "space" "a space" } { "i" "an integer" } }\r
-{ $description "Project a space along ith coordinate" } ;\r
-\r
-! --------------------------------------------------------------\r
-! 3D rendering\r
-! --------------------------------------------------------------\r
-ARTICLE: "3D-rendering-page" "3D rendering in ADSODA"\r
-"explanation of 3D rendering"\r
-$nl\r
-"link to functions"\r
-{ $subsection face->GL }\r
-{ $subsection solid->GL }\r
-{ $subsection space->GL }\r
-\r
-;\r
-\r
-HELP: face->GL \r
-{ $values { "face" "a face" } { "color" "3 3 values array" } }\r
-{ $description "" } ;\r
-\r
-HELP: solid->GL \r
-{ $values { "solid" "a solid" } }\r
-{ $description "" } ;\r
-\r
-HELP: space->GL \r
-{ $values { "space" "a space" } }\r
-{ $description "" } ;\r
-\r
-! --------------------------------------------------------------\r
-! light\r
-! --------------------------------------------------------------\r
-\r
-ARTICLE: "light-page" "light in ADSODA"\r
-"explanation of light"\r
-$nl\r
-"link to functions"\r
-;\r
-\r
-ARTICLE: { "adsoda" "light" } "ADSODA : lights"\r
-"! HELP: light position color" \r
-"! <light> ( -- tuple ) light new ;"\r
-\r
-"! light est un vecteur avec 3 variables pour les couleurs\n"\r
-\r
-" void Light::Apply(Vector& normal, double &cRed, double &cGreen, double &cBlue)\n"\r
-" { \n"\r
-"   // Dot the light direction with the normalized normal of Face."\r
-"   register double intensity = -(normal * (*this));"\r
-\r
-"   // Face is a backface, from light's perspective"\r
-"   if (intensity < 0)"\r
-"     return;"\r
-"   "\r
-"   // Add the intensity componentwise"\r
-"   cRed += red * intensity;"\r
-"   cGreen += green * intensity;"\r
-"   cBlue += blue * intensity;"\r
-\r
-"   // Clip to unit range"\r
-"  if (cRed > 1.0) cRed = 1.0;"\r
-"   if (cGreen > 1.0) cGreen = 1.0;"\r
-"   if (cBlue > 1.0) cBlue = 1.0;"\r
-\r
-\r
-;\r
-\r
-\r
-\r
-ARTICLE: { "adsoda" "halfspace" } "ADSODA : halfspace"\r
-"! demi espace défini par un vecteur normal et une constante"\r
-" defined by the concatenation of the normal vector and a constant"  \r
- ;\r
-\r
-\r
-\r
-ARTICLE:  "adsoda-main-page"  "ADSODA : Arbitrary-Dimensional Solid Object Display Algorithm"\r
-"multidimensional handler :" \r
-$nl\r
-"design a solid using face delimitations. Only works on convex shapes"\r
-$nl\r
-{ $emphasis "written in C++ by Greg Ferrar" }\r
-$nl\r
-"full explanation on adsoda page at " { $url "http://www.flowerfire.com/ADSODA/" }\r
-$nl\r
-"Useful words are describe on the following pages: "\r
-{ $subsection "face-page" }\r
-{ $subsection "solid-page" }\r
-{ $subsection "space-page" }\r
-{ $subsection "light-page" }\r
-{ $subsection "3D-rendering-page" }\r
- ;\r
-\r
-ABOUT: "adsoda-main-page"\r
+! Copyright (C) 2008 Jeff Bigot
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax ;
+IN: adsoda
+
+! --------------------------------------------------------------
+! faces
+! --------------------------------------------------------------
+ARTICLE: "face-page" "Face in ADSODA"
+"explanation of faces"
+$nl
+"link to functions" $nl
+"what is an halfspace" $nl
+"halfspace touching-corners adjacent-faces" $nl
+"touching-corners list of pointers to the corners which touch this face" $nl
+"adjacent-faces list of pointers to the faces which touch this face"
+{ $subsections
+    face
+    <face>
+}
+"test relative position"
+{ $subsections
+    point-inside-or-on-face?
+    point-inside-face?
+}
+"handling face"
+{ $subsections
+    flip-face
+    face-translate
+    face-transform
+}
+
+;
+
+HELP: face
+{ $class-description "a face is defined by"
+{ $list "halfspace equation" }
+{ $list "list of touching corners" }
+{ $list "list of adjacent faces" }
+$nl
+"Touching corners and adjacent faces are defined by algorithm thanks to other faces of the solid"
+}
+
+
+;
+HELP: <face> 
+{ $values { "v" "an halfspace equation" } { "tuple" "a face" }  }   ;
+HELP: flip-face 
+{ $values { "face" "a face" } { "face" "flipped face" } }
+{ $description "change the orientation of a face" }
+;
+
+HELP: face-translate 
+{ $values { "face" "a face" } { "v" "a vector" } }
+{ $description 
+"translate a face following a vector"
+$nl
+"a translation of an halfspace doesn't change the normal vector. this word just compute the new constant term" }
+
+ ;
+HELP: face-transform 
+{ $values { "face" "a face" } { "m" "a transformation matrix" } }
+{ $description  "compute the transformation of a face using a transformation matrix" }
+ ;
+! --------------------------------
+! solid
+! --------------------------------------------------------------
+ARTICLE: "solid-page" "Solid in ADSODA"
+"explanation of solids"
+$nl
+"link to functions"
+{ $subsections
+    solid
+    <solid>
+}
+"test relative position"
+{ $subsections
+    point-inside-solid?
+    point-inside-or-on-solid?
+}
+"playing with faces and solids"
+{ $subsections
+    add-face
+    cut-solid
+    slice-solid
+}
+"solid handling"
+{ $subsections
+    solid-project
+    solid-translate
+    solid-transform
+    subtract
+    get-silhouette 
+    solid=
+}
+;
+
+HELP: solid 
+{ $class-description "dimension" $nl "silhouettes" $nl "faces" $nl "corners" $nl "adjacencies-valid" $nl "color" $nl "name" 
+}
+;
+
+HELP: add-face 
+{ $values { "solid" "a solid" } { "face" "a face" } }
+{ $description "reshape a solid with a face. The face truncate the solid." } ;
+
+HELP: cut-solid
+{ $values { "solid" "a solid" } { "halfspace" "an halfspace" } }
+{ $description "like add-face but just with halfspace equation" } ;
+
+HELP: slice-solid
+{ $values { "solid" "a solid" } { "face" "a face" } { "solid1" "the outer part of the former solid" } { "solid2" "the inner part of the former solid" } }
+{ $description "cut a solid into two parts. The face acts like a knife"
+}  ;
+
+
+HELP: solid-project
+{ $values { "lights" "lights" } { "ambient" "ambient" } { "solid" "solid" } { "solids" "projection of solid" } }
+{ $description "Project the solid using pv vector" 
+$nl
+"TODO: explain how to use lights"
+} ;
+
+HELP: solid-translate 
+{ $values { "solid" "a solid" } { "v" "translating vector" } }
+{ $description "Translate a solid using a vector" 
+$nl
+"v and solid must have the same dimension "
+} ;
+
+HELP: solid-transform 
+{ $values { "solid" "a solid" } { "m" "transformation matrix" } }
+{ $description "Transform a solid using a matrix"
+$nl
+"v and solid must have the same dimension "
+} ;
+
+HELP: subtract 
+{ $values { "solid1" "initial shape" } { "solid2" "shape to remove" } { "solids" "resulting shape" } }
+{ $description  "Substract solid2 from solid1" } ;
+
+
+! --------------------------------------------------------------
+! space 
+! --------------------------------------------------------------
+ARTICLE: "space-page" "Space in ADSODA"
+"A space is a collection of solids and lights."
+$nl
+"link to functions"
+$nl
+"Defining words"
+{ $subsections
+    space
+    <space>
+    suffix-solids 
+    suffix-lights
+    clear-space-solids 
+    describe-space
+}
+
+
+"Handling space"
+{ $subsections
+    space-ensure-solids
+    eliminate-empty-solids
+    space-transform
+    space-translate
+    remove-hidden-solids
+    space-project
+}
+
+
+;
+
+HELP: space 
+{ $class-description 
+"dimension" $nl " solids" $nl " ambient-color" $nl "lights" 
+}
+;
+
+HELP: suffix-solids 
+"( space solid -- space )"
+{ $values { "space" "a space" } { "solid" "a solid to add" } }
+{ $description "Add solid to space definition" } ;
+
+HELP: suffix-lights 
+"( space light -- space ) "
+{ $values { "space" "a space" } { "light" "a light to add" } }
+{ $description "Add a light to space definition" } ;
+
+HELP: clear-space-solids 
+"( space -- space )"   
+{ $values { "space" "a space" } }
+{ $description "remove all solids in space" } ;
+
+HELP: space-ensure-solids 
+{ $values { "space" "a space" } }
+{ $description "rebuild corners of all solids in space" } ;
+
+
+
+HELP: space-transform 
+{ $values { "space" "a space" } { "m" "a matrix" } }
+{ $description "Transform a space using a matrix" } ;
+
+HELP: space-translate 
+{ $values { "space" "a space" } { "v" "a vector" } }
+{ $description "Translate a space following a vector" } ;
+
+HELP: describe-space
+{ $values { "space" "a space" } }
+{ $description "return a description of space" } ;
+
+HELP: space-project 
+{ $values { "space" "a space" } { "i" "an integer" } }
+{ $description "Project a space along ith coordinate" } ;
+
+! --------------------------------------------------------------
+! 3D rendering
+! --------------------------------------------------------------
+ARTICLE: "3D-rendering-page" "The 3D rendering in ADSODA"
+"explanation of 3D rendering"
+$nl
+"link to functions"
+{ $subsections
+    face->GL
+    solid->GL
+    space->GL
+}
+
+;
+
+HELP: face->GL 
+{ $values { "face" "a face" } { "color" "3 3 values array" } }
+{ $description "display a face" } ;
+
+HELP: solid->GL 
+{ $values { "solid" "a solid" } }
+{ $description "display a solid" } ;
+
+HELP: space->GL 
+{ $values { "space" "a space" } }
+{ $description "display a space" } ;
+
+! --------------------------------------------------------------
+! light
+! --------------------------------------------------------------
+
+ARTICLE: "light-page" "Light in ADSODA"
+"explanation of light"
+$nl
+"link to functions"
+;
+
+ARTICLE: { "adsoda" "light" } "ADSODA : lights"
+{ $code """
+! HELP: light position color
+! <light> ( -- tuple ) light new ;
+! light est un vecteur avec 3 variables pour les couleurs\n
+ void Light::Apply(Vector& normal, double &cRed, double &cGreen, double &cBlue)\n
+ { \n
+   // Dot the light direction with the normalized normal of Face.
+   register double intensity = -(normal * (*this));
+   // Face is a backface, from light's perspective
+   if (intensity < 0)
+     return;
+   
+   // Add the intensity componentwise
+   cRed += red * intensity;
+   cGreen += green * intensity;
+   cBlue += blue * intensity;
+   // Clip to unit range
+  if (cRed > 1.0) cRed = 1.0;
+   if (cGreen > 1.0) cGreen = 1.0;
+   if (cBlue > 1.0) cBlue = 1.0;
+""" }
+;
+
+
+
+ARTICLE: { "adsoda" "halfspace" } "ADSODA : halfspace"
+" defined by the concatenation of the normal vector and a constant"  
+ ;
+
+
+
+ARTICLE:  "adsoda-main-page"  "ADSODA : Arbitrary-Dimensional Solid Object Display Algorithm"
+"multidimensional handler :" 
+$nl
+"design a solid using face delimitations. Only works on convex shapes"
+$nl
+{ $emphasis "written in C++ by Greg Ferrar" }
+$nl
+"full explanation on adsoda page at " { $url "http://www.flowerfire.com/ADSODA/" }
+$nl
+"Useful words are describe on the following pages: "
+{ $subsections
+    "face-page"
+    "solid-page"
+    "space-page"
+    "light-page"
+    "3D-rendering-page"
+} ;
+
+ABOUT: "adsoda-main-page"