-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Emanuel Lima <[email protected]>
- Loading branch information
1 parent
fac7a12
commit f22ee1d
Showing
7 changed files
with
113 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ jobs: | |
version: | ||
- 'nightly' | ||
- 'lts' | ||
- 'release' | ||
- '1' | ||
os: | ||
- ubuntu-latest | ||
- macos-latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# WiP | ||
|
||
module Polar2Cartesian | ||
|
||
using CadCAD: Point, run_exp | ||
|
||
# Create the spaces as kwdef structs (for now) | ||
|
||
@kwdef struct Cartesian <: Point | ||
x::Float64 | ||
y::Float64 | ||
end | ||
|
||
@kwdef struct Polar <: Point | ||
r::Float64 | ||
phi::Float64 | ||
end | ||
|
||
# Set the parameters | ||
|
||
sim_params = ( | ||
n_steps = 5, | ||
n_runs = 1 | ||
) | ||
|
||
# Define the dynamics of the simulation | ||
|
||
function cartesian2polar(cart::Cartesian)::Polar | ||
return Polar( | ||
r = sqrt(cart.x^2 + cart.y^2), | ||
phi = atan(cart.y, cart.x) | ||
) | ||
end | ||
|
||
function polar2cartesian(pol::Polar)::Cartesian | ||
return Cartesian( | ||
x = pol.r * cos(pol.phi), | ||
y = pol.r * sin(pol.phi) | ||
) | ||
end | ||
|
||
# Set the initial state | ||
|
||
initial_conditions = Cartesian(; | ||
x = 1.5, | ||
y = 3.7 | ||
) | ||
|
||
# Set the pipeline | ||
|
||
pipeline = "cartesian2polar > polar2cartesian" | ||
|
||
# Run the simulation | ||
|
||
trajectory = run_exp(initial_conditions, sim_params, pipeline) | ||
|
||
println(trajectory) | ||
|
||
end |