aboutsummaryrefslogtreecommitdiff
path: root/src/input/images5a.input.pamphlet
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2007-08-14 05:14:52 +0000
committerdos-reis <gdr@axiomatics.org>2007-08-14 05:14:52 +0000
commitab8cc85adde879fb963c94d15675783f2cf4b183 (patch)
treec202482327f474583b750b2c45dedfc4e4312b1d /src/input/images5a.input.pamphlet
downloadopen-axiom-ab8cc85adde879fb963c94d15675783f2cf4b183.tar.gz
Initial population.
Diffstat (limited to 'src/input/images5a.input.pamphlet')
-rw-r--r--src/input/images5a.input.pamphlet175
1 files changed, 175 insertions, 0 deletions
diff --git a/src/input/images5a.input.pamphlet b/src/input/images5a.input.pamphlet
new file mode 100644
index 00000000..a44a3810
--- /dev/null
+++ b/src/input/images5a.input.pamphlet
@@ -0,0 +1,175 @@
+\documentclass{article}
+\usepackage{axiom}
+\begin{document}
+\title{\$SPAD/src/input images5a.input}
+\author{The Axiom Team}
+\maketitle
+\begin{abstract}
+\end{abstract}
+\eject
+\tableofcontents
+\eject
+\section{License}
+<<license>>=
+--Copyright The Numerical Algorithms Group Limited 1994-1996.
+@
+<<*>>=
+<<license>>
+
+-- Etruscan Venus
+-- Parameterization by George Frances
+
+venus(a,r,steps) ==
+ surf := (u:DoubleFloat, v:DoubleFloat): Point DoubleFloat +->
+ cv := cos(v)
+ sv := sin(v)
+ cu := cos(u)
+ su := sin(u)
+ x := r * cos(2*u) * cv + sv * cu
+ y := r * sin(2*u) * cv - sv * su
+ z := a * cv
+ point [x,y,z]
+ draw(surf, 0..%pi, -%pi..%pi, var1Steps==steps,var2Steps==steps,
+ title == "Etruscan Venus")
+
+venus(5/2, 13/10, 50)
+
+-- Figure Eight Klein Bottle
+-- Parameterization from:
+-- "Differential Geometry and Computer Graphics" by Thomas Banchoff
+-- in Perspectives in Mathemtaics, Anneversry of Oberwolfasch 1984.
+-- Beirkhauser-Verlag, Basel, pp 43-60.
+
+klein(x,y) ==
+ cx := cos(x)
+ cy := cos(y)
+ sx := sin(x)
+ sy := sin(y)
+ sx2 := sin(x/2)
+ cx2 := cos(x/2)
+ sq2 := sqrt(2.0@DoubleFloat)
+ point [cx * (cx2 * (sq2 + cy) + (sx2 * sy * cy)), _
+ sx * (cx2 * (sq2 + cy) + (sx2 * sy * cy)), _
+ -sx2 * (sq2 + cy) + cx2 * sy * cy]
+
+draw(klein, 0..4*%pi, 0..2*%pi, var1Steps==50, var2Steps==50, _
+ title=="Figure Eight Klein Bottle")
+
+-- Twisted torus
+
+-- Generalized tubes.
+-- The functions in this file draw a 2-d curve in the normal
+-- planes around a 3-d curve. The computations are all done
+-- numerically in machine-precision floating point for efficiency.
+
+R3 := Point DoubleFloat -- Points in 3-Space
+R2 := Point DoubleFloat -- Points in 2-Space
+S := Segment Float -- Draw ranges
+ThreeCurve := DoubleFloat -> R3 -- type of a space curve function
+TwoCurve := (DoubleFloat, DoubleFloat) -> R2 -- type of a plane curve function
+Surface := (DoubleFloat, DoubleFloat) -> R3 -- type of a parameterized surface function
+
+-- Frenet frames define a coordinate system around a point on a space curve
+FrenetFrame := Record(value: R3, tagent: R3, normal: R3, binormal: R3)
+
+-- Holds current Frenet frame for a point on a curve
+frame: FrenetFrame
+
+-- compile, don't interpret functions
+)set fun compile on
+
+-- Draw a generalized tube.
+-- ntubeDraw(spaceCurve, planeCurve, u0..u1, t0..t1)
+-- draws planeCurve int the normal planes of spaceCurve. u0..u1 specifies
+-- the paramter range of the planeCurve and t0..t1 specifies the parameter
+-- range of the spaceCurve. Additionally the plane curve function takes
+-- as a second parameter the current parameter of the spaceCurve. This
+-- allows the plane curve to evolve as it goes around the space curve.
+-- see "page5.input" for an example of this.
+ntubeDraw: (ThreeCurve, TwoCurve, S, S) -> VIEW3D
+ntubeDraw(spaceCurve, planeCurve, uRange, tRange) ==
+ ntubeDrawOpt(spaceCurve, planeCurve, uRange, tRange, []$List DROPT)
+
+-- ntuberDrawOpt is the same as ntuberDraw, but takes optional
+-- parameters which it passes to the draw command.
+ntubeDrawOpt: (ThreeCurve, TwoCurve, S, S, List DROPT) -> VIEW3D
+ntubeDrawOpt(spaceCurve, planeCurve, uRange, tRange, l) ==
+ delT:DoubleFloat := (hi(tRange) - lo(tRange))/10000
+ oldT:DoubleFloat := lo(tRange) - 1
+ fun := ngeneralTube(spaceCurve, planeCurve, delT, oldT)
+ draw(fun, uRange, tRange, l)
+
+-- nfrenetFrame(c, t, delT) numerically computes the Frenet Frame
+-- about the curve c at t. delT is a small number used to
+-- compute derivatives.
+nfrenetFrame(c, t, delT) ==
+ f0 := c(t)
+ f1 := c(t+delT)
+ t0 := f1 - f0 -- the tangent
+ n0 := f1 + f0
+ b := cross(t0, n0) -- the binormal
+ n := cross(b,t0) -- the normal
+ ln := length n
+ lb := length b
+ ln = 0 or lb = 0 => error "Frenet Frame not well defined"
+ n := (1/ln)*n -- make into unit length vectors
+ b := (1/lb)*b
+ [f0, t0, n, b]$FrenetFrame
+
+-- nGeneralTube(spaceCurve, planeCurve, delT, oltT)
+-- creates a function which can be passed to the system draw command.
+-- The function is a parameterized surface for the general tube
+-- around the spaceCurve. delT is a small number used to compute
+-- derivatives, and oldT is used to hold the current value of the
+-- t parameter for the spaceCurve. This is an efficiency measure
+-- to ensure that frames are only computed once for every value of t.
+ngeneralTube: (ThreeCurve, TwoCurve, DoubleFloat, DoubleFloat) -> Surface
+ngeneralTube(spaceCurve, planeCurve, delT, oldT) ==
+ free frame
+ (v:DoubleFloat, t: DoubleFloat): R3 +->
+ if (t ~= oldT) then
+ frame := nfrenetFrame(spaceCurve, t, delT)
+ oldT := t
+ p := planeCurve(v, t)
+ frame.value + p.1*frame.normal + p.2*frame.binormal
+
+
+-- rotate a 2-d point by theta round the origin
+rotateBy(p, theta) ==
+ c := cos(theta)
+ s := sin(theta)
+ point [p.1*c - p.2*s, p.1*s + p.2*c]
+
+-- a circle in 3-space
+bcircle t ==
+ point [3*cos t, 3*sin t, 0]
+
+-- an elipse which twists around 4 times as t revolves once.
+twist(u, t) ==
+ theta := 4*t
+ p := point [sin u, cos(u)/2]
+ rotateBy(p, theta)
+
+ntubeDrawOpt(bcircle, twist, 0..2*%pi, 0..2*%pi, _
+ var1Steps == 70, var2Steps == 250)
+
+-- Striped torus
+
+-- a twisting circle
+twist2(u, t) ==
+ theta := t
+ p := point [sin u, cos(u)]
+ rotateBy(p, theta)
+
+-- color function producing 21 stripes
+cf(u,v) == sin(21*u)
+
+ntubeDrawOpt(bcircle, twist2, 0..2*%pi, 0..2*%pi, _
+ colorFunction == cf, var1Steps == 168, var2Steps == 126)
+
+@
+\eject
+\begin{thebibliography}{99}
+\bibitem{1} nothing
+\end{thebibliography}
+\end{document}