aboutsummaryrefslogtreecommitdiff
path: root/src/input/images5.input.pamphlet
blob: 49a96b2c3012535d0caa8c4a39c1b5dbc308767c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
\documentclass{article}
\usepackage{axiom}
\begin{document}
\title{\$SPAD/src/input images5.input}
\author{The Axiom Team}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\eject
\section{License}
<<license>>=
--Copyright The Numerical Algorithms Group Limited 1994.
@
<<*>>=
<<license>>
-- Color gallery page 5


-- 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

)read ntube

-- 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}