Skip to content

Commit

Permalink
updated last of docs
Browse files Browse the repository at this point in the history
  • Loading branch information
otmanon committed Oct 31, 2023
1 parent 5a5827e commit 1de4769
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/fast_cody/fast_cd_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class fast_cd_sim():
"""
Fast Complementary Dynamics Simulation, implementation of https://www.dgp.toronto.edu/projects/fast_complementary_dynamics_site/
"""
def __init__(self, V, T, B, l, J, mu=1e5, rho=1, h=1e-2, max_iters=30, threshold=1e-8,
def __init__(self, V, T, B, l, J, mu=1e4, rho=1e3, h=1e-2, max_iters=30, threshold=1e-8,
read_cache=False, cache_dir="", Aeq=None, write_cache=False):
"""
Initializes a Fast Complementary Dynamics Simulation.
Expand Down
32 changes: 32 additions & 0 deletions src/fast_cody/viewers/interactive_handle_subspace_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,38 @@ class interactive_handle_subspace_viewer():
max_fps : int
maximum fps for the viewer
Examples
--------
Examples
--------
```
import fast_cody as fcd
import numpy as np
num_modes = 16
num_clusters = 120
[V, F, T] = fcd.read_msh(fcd.get_data("cd_fish.msh"))
Wp = np.ones((V.shape[0], 1))
J = fcd.lbs_jacobian(V, Wp)
C = fcd.complementary_constraint_matrix(V, T, J, dt=1e-3)
Cd = fcd.lbs_weight_space_constraint(V, C)
[B, l, Ws] =fcd.skinning_subspace(V, T, num_modes, num_clusters, C=Cd)
sim = fcd.fast_cd_sim(V, T, B, l, J, mu=1e4)
z0 = np.zeros((num_modes*12, 1))
T0 = np.identity(4).astype( dtype=np.float32, order="F");
p0 = T0[0:3, :].reshape((12, 1))
st = fcd.fast_cd_state(z0, p0)
step = 0
def pre_draw_callback():
global step
p = viewer.T0[0:3, :].reshape((-1, 1))
z = sim.step( p, st)
st.update(z, p)
viewer.update_subspace_coefficients(z, p)
step += 1
viewer = fcd.viewers.interactive_handle_subspace_viewer(V, T, Wp, Ws, pre_draw_callback)
viewer.launch()
```
"""

def __init__(self, V, T, Wp, Ws, pre_draw_callback,T0=None,
Expand Down

0 comments on commit 1de4769

Please sign in to comment.