// (c) 1997 Brown University // (c) 1997 Dave Peck, David Akers, Tom Banchoff // The Cyclides of Dupin - Gruse include * from Standard; include * from Curves; include * from Sets; include * from Surfaces; include * from DifferentialGeometry; // the unit circle circle := R -> (R, R) : t -> (cos t, sin t) / sqrt(2); // Create a control slider for the XW rotation. a := widget Slider(0, pi/2), name<-"Rotation around XW plane", drag <- True; // Create sliders for the resolution i & j. qt := widget Slider(20, 150), name<-"Image accuracy along I", field <- Z, init<-40; zt := widget Slider(20, 50), name<-"Image accuracy along J", field <- Z, init<-40; I := Interval(-pi,pi,qt); J := Dashes(-pi, pi, zt); // one way to define a torus torus := [ circle(I) >< circle(J) ]; // This matrix defines rotation around the XW plane. A := [[cos a, 0, 0, -sin a], [ 0, 1, 0, 0], [ 0, 0, 1, 0], [sin a, 0, 0, cos a]]; // The rotation function itself; just a matrix mult. rotate := R^4 -> R^4 : x -> A x; // simple projection project := R^4 -> R^3 : [x, y, z, w] -> [x, y, z] / (w - 1); // Now show the sterographic projection of the rotated flat torus. widget Show(project(rotate(torus))), color<-"3:blue->yellow->red->yellow->blue->yellow->red";