Skip to content

Instantly share code, notes, and snippets.

@alexgian
Last active September 26, 2024 11:14
Show Gist options
  • Select an option

  • Save alexgian/9fd4975eb2d868d1063209e1ae3d22e3 to your computer and use it in GitHub Desktop.

Select an option

Save alexgian/9fd4975eb2d868d1063209e1ae3d22e3 to your computer and use it in GitHub Desktop.
(ns param-2D
(:require
[emmy.env :as e :refer :all]
[emmy.generic :as g]
[emmy.mafs :as mafs]
[emmy.leva]
[emmy.viewer :as ev]
))
;; ## Parametric equations with *mafs*
(defn param_eqn_1 [a]
(fn [t]
[(* a (- t (sin t)))
(* a (- 1 (cos t)))]))
(ev/with-let
[!coeffs {:a 1 :x 0}]
(let [x (* pi 16)]
(mafs/mafs
(emmy.leva/controls
{:folder {:name "cycloid"}
:schema
{:a {:min 0.1 :max 3 :step 0.05}
:x {:min -1 :max 20 :step 0.05}
}
:atom !coeffs})
(mafs/cartesian)
(mafs/parametric {:xy
(ev/with-params
{:atom !coeffs
:params [:a]}
param_eqn_1)
:t [0 (* 16 pi)]
:color "#43CC50EB"
})
(mafs/circle {:center [0 1] :radius 1 :color :yellow :opacity 0})
)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment