You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -139,22 +139,22 @@ You need to load the visualization package, e.g., `using GLMakie`, in your sessi
139
139
140
140
This can be handy for constructing a path, for example you can interactively set the approximate position and view parameters and then query them for use by the tools above.
141
141
142
-
```
142
+
```julia
143
143
state =capture_view(scene)
144
144
```
145
145
146
146
`state` is a `ViewState` object.
147
147
148
148
### Setting the current view state
149
149
150
-
```
150
+
```julia
151
151
oldstate =set_view!(camera, path, t)
152
152
```
153
153
154
154
This updates the current `camera` settings from `path` at time `t`.
FlyThroughPaths operates on the [`ViewState`](@ref) model. In order to implement support for this in a plotting package, you must implement dispatches for the following two functions:
6
+
-`capture_view(obj)::ViewState`: extract the current `ViewState`, i.e., camera settings, from `obj`.
7
+
-`set_view!(obj, viewstate::ViewState)`: set the camera to the given `ViewState`.
8
+
9
+
Integration is already implemented for Makie; you can see that in `ext/FlyThroughPathsMakieExt.jl`. The first ~20 lines are the most instructive, beyond which lie utility functions and visualization specializations.
Copy file name to clipboardExpand all lines: docs/src/index.md
+137-3Lines changed: 137 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,143 @@ CurrentModule = FlyThroughPaths
6
6
7
7
Documentation for [FlyThroughPaths](https://github.com/HolyLab/FlyThroughPaths.jl).
8
8
9
-
```@index
9
+
10
+
All of the examples below assume you've loaded the package with `using FlyThroughPaths`.
11
+
12
+
# Quick start
13
+
14
+
## Generic tools
15
+
16
+
### Representation of paths and view state
17
+
18
+
Paths are parametrized by time `t`, represented in units of seconds. All paths implicitly start at `t=0`.
19
+
20
+
The representation of view state is independent of any particular plotting package, although our parametrization is inspired by [Makie's 3D camera](https://docs.makie.org/stable/explanations/cameras/#3d_camera):
21
+
22
+
-`eyeposition`: the 3d coordinates of the camera
23
+
-`lookat`: the 3d coordinates of the point of the camera's "focus" (center of gaze)
24
+
-`upvector`: the 3d direction that will correspond to the top of the view. Any component of this vector in the direction of `lookat - eyeposition` is ignored/discarded.
25
+
-`fov`: the angle (in degrees) of the cone centered on `lookat - eyeposition` that should be captured.
This indicates that over a 5-second period, the camera state gradually adopts any values specified in `newstate`.
81
+
82
+
```@repl main
83
+
path2(0)
84
+
path2(5)
85
+
path2(2.5)
86
+
```
87
+
88
+
Keyword options include:
89
+
90
+
-`constraint` (`:none` or `:rotation`): specify a value to keep constant during motion. `:rotation` performs a rotation around `lookat`. Note that if the separation between `eyeposition` and `lookat` is not constant, then the trajectory will be elliptical rather than circular.
91
+
-`speed` controls how the change is made across time:
92
+
-`:constant`: speed is instantaneously set to a new constant value that will arrive at the endpoint at the specified time
93
+
-`:sinusoidal`: speed will initially increase (starting at a speed of 0), achieve a maximum at the midpoint, and then decrease back to 0.
94
+
95
+
96
+
### Moving the camera, option 2: Bezier movements
97
+
98
+
With this option, you can approximately simulate the feeling of flight, preserving momentum:
The starting state, `P0` in the diagram, is taken from the endpoint of `path`. Over the next `Δt` seconds, one then moves towards the last `ViewState` argument of `bezier`, orienting successively towards any prior arguments. Probably the most robust option is to use `bezier(Δt, P1, P2, P3)`, which can be interpreted as "depart `P0` traveling towards `P1`, and arrive at `P3` as if you had come from `P2`." The view does not actually pass through `P1` and `P2`, but these set the initial and final tangents of the curve.
109
+
110
+
To see this in action, let's create a move that "rotates" around the origin but moves outward (to a more distant orbit) on its way there:
These require interaction with a plotting package supported by one of the extensions. Currently supported:
121
+
122
+
-[Makie](https://docs.makie.org/stable/)
123
+
124
+
You need to load the visualization package, e.g., `using GLMakie`, in your session before any of the commands below will work.
125
+
126
+
### Capturing the current view state
127
+
128
+
This can be handy for constructing a path, for example you can interactively set the approximate position and view parameters and then query them for use by the tools above.
129
+
130
+
```julia
131
+
state =capture_view(scenelike::Union{Scene, LScene})
132
+
```
133
+
134
+
`state` is a `ViewState` object.
135
+
136
+
### Setting the current view state
137
+
138
+
```julia
139
+
oldstate =set_view!(scenelike, path, t)
140
+
```
141
+
142
+
This updates the current `camera` settings from `path` at time `t`.
0 commit comments