Skip to content

Instantly share code, notes, and snippets.

@dannypsnl
Last active January 14, 2025 07:20
Show Gist options
  • Select an option

  • Save dannypsnl/7ef94cbbc905e0b87d2884cf1f404f54 to your computer and use it in GitHub Desktop.

Select an option

Save dannypsnl/7ef94cbbc905e0b87d2884cf1f404f54 to your computer and use it in GitHub Desktop.
Möbius strip
#lang racket
(require plot
plot/utils)
(plot3d
(parametric-surface3d
(λ (θ t)
(define R 1)
(define s (/ t 2))
(list
(* (+ R (* s (cos (* 1/2 θ)))) (cos θ))
(* (+ R (* s (cos (* 1/2 θ)))) (sin θ))
(* s (sin (* 1/2 θ)))))
0 (* 2 pi) #:s-samples 20
-1 1)
#:z-min -6 #:z-max 6
#:altitude 22)
@dannypsnl
Copy link
Author

#lang racket
(require plot
         plot/utils)

(parameterize ([plot-decorations?  #t]
               [plot3d-samples     30])
  (plot3d
   (parametric-surface3d
    (λ (t s)
      (list
       (* 3 s (sin t))
       (* s (+ (cos t)
               (* 2/5 (cos (* 2 t)))
               (* 1/15 (cos (* 3 t)))))
       (* 3/4 s (sin (* 2 t)))))
    0 (* 2 pi)
    0 1)
   #:z-min -6 #:z-max 6
   #:altitude 25))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment