summaryrefslogtreecommitdiff
path: root/physics/README.md
blob: bf14ff7cae2a612c0b03fb1b199994b5e171af24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Useful links
## Constrained dynamics
 - [A lot of pictures to get general idea and familiarize, but not very understandable](https://danielchappuis.ch/download/ConstraintsDerivationRigidBody3D.pdf)
 - [More text and math but very well written and understandable](https://graphics.pixar.com/pbm2001/pdf/notesf.pdf)


 ## TODO:
 - Camera perspective rendering:
     - Subspace intersection
     - Instead of orthogonal projection, intersect camera plane with the ray (S2 x S1 interesection)
     - Scale radius:
         - Take a right-most point (particle.pos + camera.right * true_radius)
         - Project this point
         - projected(radius) = projected(particle.pos) - projected(right_most_point)
     - More generic `fn draw_sphere(radius, world_pos)`

 - Implement vector drawing for debug:
    - Line + small dot at the end
    - Display particle forces
    - Display particle velocities
    - Display jacobians for each constraint (render constraint jacobian at each related particle)
    - (?) Toggleable gradient for each constraint:
        - Artificially take C(q) with some grid
        - Grid should be on a plane, need an ability to control this plane as well

 - (?) Refactor: subspace distance constraint:
    - beam = distance to point
    - slider = distance to a line
    - But constraint has to act on 1 particle and 1 subspace, I will need dynamic subspaces (from point)
    - Hold this for now


### Better scene design
What defines a scene:
 - List of particles - points with mass that are affected by gravity
 - List of global forces (gravity, drag, etc.)
 - List of other renderable objects: beams, springs, lines, planes (each object may depend on some particle position):
    - Each object may depend on particle position or some static point (line passing through a particle, spring between particle and static point)
    - Each objects knows how to compute its subspace (point/line/plane)
    - Beams automatically add constraints to particles
    - Springs automatically register extra forces between particles
    - Collision planes setup necessary routines

 - List of additional constraints between particles and subspaces (e.g particle tied to a line)

 <!-- - List of subspaces (special points, lines, planes etc.) - used as connectors for constraints -->
 <!-- - (?) List of dynamic subspaces based on particle positions (i.e a plane that passes through a particle) -->
 - Camera spec (lens etc.), position and orientation - defines how the scene is projected on the picture plane

What the we should see on the screen:
 - Particles (rendered as spheres with some small radius)
 - Subspaces - points, lines, planes(?)
 - Some constraints (beams represented as lines)
 - Some forces (like springs)