From 790703ac757196bc5d0815218e3f991dd038c338 Mon Sep 17 00:00:00 2001 From: otmanon Date: Wed, 25 Oct 2023 16:39:51 -0400 Subject: [PATCH] website integration --- .github/workflows/build_site.yml | 31 ++++++ .gitignore | 5 +- docs/apps/animate_rig.md | 5 + docs/apps/cd_demo_pose_tracker.md | 5 + docs/apps/interactive_cd_affine_handle.md | 5 + docs/apps/interactive_cd_face_tracking.md | 5 + docs/apps/interactive_cd_rig_anim.md | 5 + docs/apps/test_FAST_IK.md | 5 + docs/apps/test_FAST_IK_CD_tex.md | 5 + docs/apps/test_FAST_IK_tex.md | 5 + docs/arap_hessian.md | 5 + docs/average_onto_simplex.md | 5 + docs/closest_orthogonal_subspace.md | 5 + docs/cluster_centroids.md | 5 + docs/cluster_grouping_matrices.md | 5 + docs/complementary_constraint_matrix.md | 5 + docs/create_docs.sh | 45 ++++++++ docs/deformation_jacobian.md | 5 + docs/diffuse_weights.md | 5 + docs/eigs.md | 5 + docs/face_landmarks_to_positions.md | 5 + docs/fast_cd_sim.md | 5 + docs/index.md | 6 ++ docs/laplacian.md | 5 + docs/laplacian_eigenmodes.md | 5 + docs/lbs_jacobian.md | 5 + docs/lbs_weight_space_constraint.md | 5 + docs/linear_elasticity_hessian.md | 5 + docs/mediapipe_face.md | 5 + docs/mediapipe_face_captor.md | 5 + docs/momentum_leaking_matrix.md | 5 + docs/normalize_height_and_center.md | 5 + docs/one_euro_filter.md | 5 + docs/orthonormalize.md | 5 + docs/project_into_subspace.md | 5 + docs/project_out_subspace.md | 5 + docs/project_to_orthogonal.md | 5 + docs/read_rig_anim_from_json.md | 5 + docs/read_rig_from_json.md | 5 + docs/rig_curve_geometry.md | 5 + docs/rig_geometry.md | 5 + docs/rotate_rig.md | 5 + docs/skinning_clusters.md | 5 + docs/skinning_subspace.md | 5 + docs/umfpack_lu_solve.md | 5 + docs/vectorized_trace.md | 5 + docs/vectorized_transpose.md | 5 + docs/viewers/ClustersViewer.md | 5 + docs/viewers/WeightsViewer.md | 5 + .../interactive_handle_subspace_viewer.md | 5 + docs/viewers/interactive_handle_viewer.md | 5 + docs/world2rel.md | 5 + docs/ympr_to_lame.md | 5 + mkdocs.yml | 39 +++++++ src/fast_cd/__init__.py | 70 ++++++------ .../__pycache__/arap_hessian.cpython-38.pyc | Bin 1768 -> 2230 bytes src/fast_cd/arap_hessian.py | 101 ++++++++++-------- src/fast_cd/deformation_jacobian.py | 3 +- 58 files changed, 464 insertions(+), 81 deletions(-) create mode 100644 .github/workflows/build_site.yml create mode 100644 docs/apps/animate_rig.md create mode 100644 docs/apps/cd_demo_pose_tracker.md create mode 100644 docs/apps/interactive_cd_affine_handle.md create mode 100644 docs/apps/interactive_cd_face_tracking.md create mode 100644 docs/apps/interactive_cd_rig_anim.md create mode 100644 docs/apps/test_FAST_IK.md create mode 100644 docs/apps/test_FAST_IK_CD_tex.md create mode 100644 docs/apps/test_FAST_IK_tex.md create mode 100644 docs/arap_hessian.md create mode 100644 docs/average_onto_simplex.md create mode 100644 docs/closest_orthogonal_subspace.md create mode 100644 docs/cluster_centroids.md create mode 100644 docs/cluster_grouping_matrices.md create mode 100644 docs/complementary_constraint_matrix.md create mode 100644 docs/create_docs.sh create mode 100644 docs/deformation_jacobian.md create mode 100644 docs/diffuse_weights.md create mode 100644 docs/eigs.md create mode 100644 docs/face_landmarks_to_positions.md create mode 100644 docs/fast_cd_sim.md create mode 100644 docs/index.md create mode 100644 docs/laplacian.md create mode 100644 docs/laplacian_eigenmodes.md create mode 100644 docs/lbs_jacobian.md create mode 100644 docs/lbs_weight_space_constraint.md create mode 100644 docs/linear_elasticity_hessian.md create mode 100644 docs/mediapipe_face.md create mode 100644 docs/mediapipe_face_captor.md create mode 100644 docs/momentum_leaking_matrix.md create mode 100644 docs/normalize_height_and_center.md create mode 100644 docs/one_euro_filter.md create mode 100644 docs/orthonormalize.md create mode 100644 docs/project_into_subspace.md create mode 100644 docs/project_out_subspace.md create mode 100644 docs/project_to_orthogonal.md create mode 100644 docs/read_rig_anim_from_json.md create mode 100644 docs/read_rig_from_json.md create mode 100644 docs/rig_curve_geometry.md create mode 100644 docs/rig_geometry.md create mode 100644 docs/rotate_rig.md create mode 100644 docs/skinning_clusters.md create mode 100644 docs/skinning_subspace.md create mode 100644 docs/umfpack_lu_solve.md create mode 100644 docs/vectorized_trace.md create mode 100644 docs/vectorized_transpose.md create mode 100644 docs/viewers/ClustersViewer.md create mode 100644 docs/viewers/WeightsViewer.md create mode 100644 docs/viewers/interactive_handle_subspace_viewer.md create mode 100644 docs/viewers/interactive_handle_viewer.md create mode 100644 docs/world2rel.md create mode 100644 docs/ympr_to_lame.md create mode 100644 mkdocs.yml diff --git a/.github/workflows/build_site.yml b/.github/workflows/build_site.yml new file mode 100644 index 0000000..f2a5657 --- /dev/null +++ b/.github/workflows/build_site.yml @@ -0,0 +1,31 @@ +name: Publish docs via GitHub Pages +on: + push: + branches: + - main + +jobs: + build: + name: Deploy docs + runs-on: ubuntu-latest + if: github.event_name == 'release' && github.event.action == 'published' + steps: + - name: Checkout main + uses: actions/checkout@v2 + + - name: Build wheels + shell: bash -l {0} + run: | + bash docs/create_docs.sh + + # NOT SURE HOW TO AUTOMATE VERSIONING, RUNNING THIS WILL WIPE EVERYTHING + # - name: Deploy docs + # uses: mhausenblas/mkdocs-deploy-gh-pages@master + # # Or use mhausenblas/mkdocs-deploy-gh-pages@nomaterial to build without the mkdocs-material theme + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # # CUSTOM_DOMAIN: optionaldomain.com + # CONFIG_FILE: mkdocs.yml + # # EXTRA_PACKAGES: mkdocstrings + # # GITHUB_DOMAIN: github.myenterprise.com + # REQUIREMENTS: docs/requirements.txt \ No newline at end of file diff --git a/.gitignore b/.gitignore index 3c43dde..9810c4b 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,7 @@ src/fast_cd/examples/__pycache__/* src/fast_cd/apps/__pycache__/* results/** -**.ini \ No newline at end of file +**.ini + +site/* +site/** \ No newline at end of file diff --git a/docs/apps/animate_rig.md b/docs/apps/animate_rig.md new file mode 100644 index 0000000..5e73692 --- /dev/null +++ b/docs/apps/animate_rig.md @@ -0,0 +1,5 @@ +--- +title: "apps.animate_rig" +--- + +::: src.fast_cd.apps.animate_rig diff --git a/docs/apps/cd_demo_pose_tracker.md b/docs/apps/cd_demo_pose_tracker.md new file mode 100644 index 0000000..6ec74e8 --- /dev/null +++ b/docs/apps/cd_demo_pose_tracker.md @@ -0,0 +1,5 @@ +--- +title: "apps.cd_demo_pose_tracker" +--- + +::: src.fast_cd.apps.cd_demo_pose_tracker diff --git a/docs/apps/interactive_cd_affine_handle.md b/docs/apps/interactive_cd_affine_handle.md new file mode 100644 index 0000000..4141939 --- /dev/null +++ b/docs/apps/interactive_cd_affine_handle.md @@ -0,0 +1,5 @@ +--- +title: "apps.interactive_cd_affine_handle" +--- + +::: src.fast_cd.apps.interactive_cd_affine_handle diff --git a/docs/apps/interactive_cd_face_tracking.md b/docs/apps/interactive_cd_face_tracking.md new file mode 100644 index 0000000..53506fc --- /dev/null +++ b/docs/apps/interactive_cd_face_tracking.md @@ -0,0 +1,5 @@ +--- +title: "apps.interactive_cd_face_tracking" +--- + +::: src.fast_cd.apps.interactive_cd_face_tracking diff --git a/docs/apps/interactive_cd_rig_anim.md b/docs/apps/interactive_cd_rig_anim.md new file mode 100644 index 0000000..6418c29 --- /dev/null +++ b/docs/apps/interactive_cd_rig_anim.md @@ -0,0 +1,5 @@ +--- +title: "apps.interactive_cd_rig_anim" +--- + +::: src.fast_cd.apps.interactive_cd_rig_anim diff --git a/docs/apps/test_FAST_IK.md b/docs/apps/test_FAST_IK.md new file mode 100644 index 0000000..ba7d3bf --- /dev/null +++ b/docs/apps/test_FAST_IK.md @@ -0,0 +1,5 @@ +--- +title: "apps.test_FAST_IK" +--- + +::: src.fast_cd.apps.test_FAST_IK diff --git a/docs/apps/test_FAST_IK_CD_tex.md b/docs/apps/test_FAST_IK_CD_tex.md new file mode 100644 index 0000000..f65160c --- /dev/null +++ b/docs/apps/test_FAST_IK_CD_tex.md @@ -0,0 +1,5 @@ +--- +title: "apps.test_FAST_IK_CD_tex" +--- + +::: src.fast_cd.apps.test_FAST_IK_CD_tex diff --git a/docs/apps/test_FAST_IK_tex.md b/docs/apps/test_FAST_IK_tex.md new file mode 100644 index 0000000..e5e0671 --- /dev/null +++ b/docs/apps/test_FAST_IK_tex.md @@ -0,0 +1,5 @@ +--- +title: "apps.test_FAST_IK_tex" +--- + +::: src.fast_cd.apps.test_FAST_IK_tex diff --git a/docs/arap_hessian.md b/docs/arap_hessian.md new file mode 100644 index 0000000..82865a3 --- /dev/null +++ b/docs/arap_hessian.md @@ -0,0 +1,5 @@ +--- +title: "arap_hessian" +--- + +::: src.fast_cd.arap_hessian diff --git a/docs/average_onto_simplex.md b/docs/average_onto_simplex.md new file mode 100644 index 0000000..1e9c255 --- /dev/null +++ b/docs/average_onto_simplex.md @@ -0,0 +1,5 @@ +--- +title: "average_onto_simplex" +--- + +::: src.fast_cd.average_onto_simplex diff --git a/docs/closest_orthogonal_subspace.md b/docs/closest_orthogonal_subspace.md new file mode 100644 index 0000000..fcd3d13 --- /dev/null +++ b/docs/closest_orthogonal_subspace.md @@ -0,0 +1,5 @@ +--- +title: "closest_orthogonal_subspace" +--- + +::: src.fast_cd.closest_orthogonal_subspace diff --git a/docs/cluster_centroids.md b/docs/cluster_centroids.md new file mode 100644 index 0000000..4f44403 --- /dev/null +++ b/docs/cluster_centroids.md @@ -0,0 +1,5 @@ +--- +title: "cluster_centroids" +--- + +::: src.fast_cd.cluster_centroids diff --git a/docs/cluster_grouping_matrices.md b/docs/cluster_grouping_matrices.md new file mode 100644 index 0000000..4420580 --- /dev/null +++ b/docs/cluster_grouping_matrices.md @@ -0,0 +1,5 @@ +--- +title: "cluster_grouping_matrices" +--- + +::: src.fast_cd.cluster_grouping_matrices diff --git a/docs/complementary_constraint_matrix.md b/docs/complementary_constraint_matrix.md new file mode 100644 index 0000000..246f87d --- /dev/null +++ b/docs/complementary_constraint_matrix.md @@ -0,0 +1,5 @@ +--- +title: "complementary_constraint_matrix" +--- + +::: src.fast_cd.complementary_constraint_matrix diff --git a/docs/create_docs.sh b/docs/create_docs.sh new file mode 100644 index 0000000..9e4bfbb --- /dev/null +++ b/docs/create_docs.sh @@ -0,0 +1,45 @@ +#!/bin/bash +#Delete everything in docs except for index.md +shopt -s nullglob +for file in docs/*.md; do + name=$(basename "$file") + if ! [ "$name" = "index.md" ]; then + rm "$file" + fi +done +#Delete everything in docs subdirectories except for index.md +shopt -s nullglob +for file in docs/*/*.md; do + name=$(basename "$file") + if ! [ "$name" = "index.md" ]; then + rm "$file" + fi +done +#For all files not in a module +shopt -s nullglob +for file in src/fast_cd/*.py; do + name=$(basename "$file" .py) + if ! [ "$name" = "__init__" ]; then + path="docs/${name}.md" + echo "---" > $path + echo "title: \"${name}\"" >> $path + echo "---" >> $path + echo >> $path + echo "::: src.fast_cd.${name}" >> $path + fi +done +#For all files in a module +shopt -s nullglob +for file in src/fast_cd/*/*.py; do + name=$(basename "$file" .py) + modulename=$(basename "$(dirname $file)") + if ! [ "$name" = "__init__" ]; then + mkdir -p "docs/${modulename}" + path="docs/${modulename}/${name}.md" + echo "---" > $path + echo "title: \"${modulename}.${name}\"" >> $path + echo "---" >> $path + echo >> $path + echo "::: src.fast_cd.${modulename}.${name}" >> $path + fi +done \ No newline at end of file diff --git a/docs/deformation_jacobian.md b/docs/deformation_jacobian.md new file mode 100644 index 0000000..f1a9dcc --- /dev/null +++ b/docs/deformation_jacobian.md @@ -0,0 +1,5 @@ +--- +title: "deformation_jacobian" +--- + +::: src.fast_cd.deformation_jacobian diff --git a/docs/diffuse_weights.md b/docs/diffuse_weights.md new file mode 100644 index 0000000..3e7e872 --- /dev/null +++ b/docs/diffuse_weights.md @@ -0,0 +1,5 @@ +--- +title: "diffuse_weights" +--- + +::: src.fast_cd.diffuse_weights diff --git a/docs/eigs.md b/docs/eigs.md new file mode 100644 index 0000000..ebda676 --- /dev/null +++ b/docs/eigs.md @@ -0,0 +1,5 @@ +--- +title: "eigs" +--- + +::: src.fast_cd.eigs diff --git a/docs/face_landmarks_to_positions.md b/docs/face_landmarks_to_positions.md new file mode 100644 index 0000000..b7c8944 --- /dev/null +++ b/docs/face_landmarks_to_positions.md @@ -0,0 +1,5 @@ +--- +title: "face_landmarks_to_positions" +--- + +::: src.fast_cd.face_landmarks_to_positions diff --git a/docs/fast_cd_sim.md b/docs/fast_cd_sim.md new file mode 100644 index 0000000..6e1991f --- /dev/null +++ b/docs/fast_cd_sim.md @@ -0,0 +1,5 @@ +--- +title: "fast_cd_sim" +--- + +::: src.fast_cd.fast_cd_sim diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..20a34b8 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,6 @@ +# Fast Complementary Dynamics + +This is the documentation page for the source code for [Fast Complementary Dynamics +via Skinning Eigenmodes](https://www.dgp.toronto.edu/projects/fast_complementary_dynamics_site/). + +This site and codebase is still a work in progress. diff --git a/docs/laplacian.md b/docs/laplacian.md new file mode 100644 index 0000000..c8072c7 --- /dev/null +++ b/docs/laplacian.md @@ -0,0 +1,5 @@ +--- +title: "laplacian" +--- + +::: src.fast_cd.laplacian diff --git a/docs/laplacian_eigenmodes.md b/docs/laplacian_eigenmodes.md new file mode 100644 index 0000000..78a3f6a --- /dev/null +++ b/docs/laplacian_eigenmodes.md @@ -0,0 +1,5 @@ +--- +title: "laplacian_eigenmodes" +--- + +::: src.fast_cd.laplacian_eigenmodes diff --git a/docs/lbs_jacobian.md b/docs/lbs_jacobian.md new file mode 100644 index 0000000..d944c6f --- /dev/null +++ b/docs/lbs_jacobian.md @@ -0,0 +1,5 @@ +--- +title: "lbs_jacobian" +--- + +::: src.fast_cd.lbs_jacobian diff --git a/docs/lbs_weight_space_constraint.md b/docs/lbs_weight_space_constraint.md new file mode 100644 index 0000000..a12941a --- /dev/null +++ b/docs/lbs_weight_space_constraint.md @@ -0,0 +1,5 @@ +--- +title: "lbs_weight_space_constraint" +--- + +::: src.fast_cd.lbs_weight_space_constraint diff --git a/docs/linear_elasticity_hessian.md b/docs/linear_elasticity_hessian.md new file mode 100644 index 0000000..f7a4c7a --- /dev/null +++ b/docs/linear_elasticity_hessian.md @@ -0,0 +1,5 @@ +--- +title: "linear_elasticity_hessian" +--- + +::: src.fast_cd.linear_elasticity_hessian diff --git a/docs/mediapipe_face.md b/docs/mediapipe_face.md new file mode 100644 index 0000000..04e3cd5 --- /dev/null +++ b/docs/mediapipe_face.md @@ -0,0 +1,5 @@ +--- +title: "mediapipe_face" +--- + +::: src.fast_cd.mediapipe_face diff --git a/docs/mediapipe_face_captor.md b/docs/mediapipe_face_captor.md new file mode 100644 index 0000000..edcb142 --- /dev/null +++ b/docs/mediapipe_face_captor.md @@ -0,0 +1,5 @@ +--- +title: "mediapipe_face_captor" +--- + +::: src.fast_cd.mediapipe_face_captor diff --git a/docs/momentum_leaking_matrix.md b/docs/momentum_leaking_matrix.md new file mode 100644 index 0000000..02eea13 --- /dev/null +++ b/docs/momentum_leaking_matrix.md @@ -0,0 +1,5 @@ +--- +title: "momentum_leaking_matrix" +--- + +::: src.fast_cd.momentum_leaking_matrix diff --git a/docs/normalize_height_and_center.md b/docs/normalize_height_and_center.md new file mode 100644 index 0000000..3e76128 --- /dev/null +++ b/docs/normalize_height_and_center.md @@ -0,0 +1,5 @@ +--- +title: "normalize_height_and_center" +--- + +::: src.fast_cd.normalize_height_and_center diff --git a/docs/one_euro_filter.md b/docs/one_euro_filter.md new file mode 100644 index 0000000..8ce588a --- /dev/null +++ b/docs/one_euro_filter.md @@ -0,0 +1,5 @@ +--- +title: "one_euro_filter" +--- + +::: src.fast_cd.one_euro_filter diff --git a/docs/orthonormalize.md b/docs/orthonormalize.md new file mode 100644 index 0000000..2b478ab --- /dev/null +++ b/docs/orthonormalize.md @@ -0,0 +1,5 @@ +--- +title: "orthonormalize" +--- + +::: src.fast_cd.orthonormalize diff --git a/docs/project_into_subspace.md b/docs/project_into_subspace.md new file mode 100644 index 0000000..8f52591 --- /dev/null +++ b/docs/project_into_subspace.md @@ -0,0 +1,5 @@ +--- +title: "project_into_subspace" +--- + +::: src.fast_cd.project_into_subspace diff --git a/docs/project_out_subspace.md b/docs/project_out_subspace.md new file mode 100644 index 0000000..e83fa30 --- /dev/null +++ b/docs/project_out_subspace.md @@ -0,0 +1,5 @@ +--- +title: "project_out_subspace" +--- + +::: src.fast_cd.project_out_subspace diff --git a/docs/project_to_orthogonal.md b/docs/project_to_orthogonal.md new file mode 100644 index 0000000..3e37e1b --- /dev/null +++ b/docs/project_to_orthogonal.md @@ -0,0 +1,5 @@ +--- +title: "project_to_orthogonal" +--- + +::: src.fast_cd.project_to_orthogonal diff --git a/docs/read_rig_anim_from_json.md b/docs/read_rig_anim_from_json.md new file mode 100644 index 0000000..b87d5ce --- /dev/null +++ b/docs/read_rig_anim_from_json.md @@ -0,0 +1,5 @@ +--- +title: "read_rig_anim_from_json" +--- + +::: src.fast_cd.read_rig_anim_from_json diff --git a/docs/read_rig_from_json.md b/docs/read_rig_from_json.md new file mode 100644 index 0000000..ac6b19f --- /dev/null +++ b/docs/read_rig_from_json.md @@ -0,0 +1,5 @@ +--- +title: "read_rig_from_json" +--- + +::: src.fast_cd.read_rig_from_json diff --git a/docs/rig_curve_geometry.md b/docs/rig_curve_geometry.md new file mode 100644 index 0000000..293aa5f --- /dev/null +++ b/docs/rig_curve_geometry.md @@ -0,0 +1,5 @@ +--- +title: "rig_curve_geometry" +--- + +::: src.fast_cd.rig_curve_geometry diff --git a/docs/rig_geometry.md b/docs/rig_geometry.md new file mode 100644 index 0000000..16e4634 --- /dev/null +++ b/docs/rig_geometry.md @@ -0,0 +1,5 @@ +--- +title: "rig_geometry" +--- + +::: src.fast_cd.rig_geometry diff --git a/docs/rotate_rig.md b/docs/rotate_rig.md new file mode 100644 index 0000000..789722f --- /dev/null +++ b/docs/rotate_rig.md @@ -0,0 +1,5 @@ +--- +title: "rotate_rig" +--- + +::: src.fast_cd.rotate_rig diff --git a/docs/skinning_clusters.md b/docs/skinning_clusters.md new file mode 100644 index 0000000..8ae7c94 --- /dev/null +++ b/docs/skinning_clusters.md @@ -0,0 +1,5 @@ +--- +title: "skinning_clusters" +--- + +::: src.fast_cd.skinning_clusters diff --git a/docs/skinning_subspace.md b/docs/skinning_subspace.md new file mode 100644 index 0000000..22354dc --- /dev/null +++ b/docs/skinning_subspace.md @@ -0,0 +1,5 @@ +--- +title: "skinning_subspace" +--- + +::: src.fast_cd.skinning_subspace diff --git a/docs/umfpack_lu_solve.md b/docs/umfpack_lu_solve.md new file mode 100644 index 0000000..e676b03 --- /dev/null +++ b/docs/umfpack_lu_solve.md @@ -0,0 +1,5 @@ +--- +title: "umfpack_lu_solve" +--- + +::: src.fast_cd.umfpack_lu_solve diff --git a/docs/vectorized_trace.md b/docs/vectorized_trace.md new file mode 100644 index 0000000..c304a86 --- /dev/null +++ b/docs/vectorized_trace.md @@ -0,0 +1,5 @@ +--- +title: "vectorized_trace" +--- + +::: src.fast_cd.vectorized_trace diff --git a/docs/vectorized_transpose.md b/docs/vectorized_transpose.md new file mode 100644 index 0000000..150c9c9 --- /dev/null +++ b/docs/vectorized_transpose.md @@ -0,0 +1,5 @@ +--- +title: "vectorized_transpose" +--- + +::: src.fast_cd.vectorized_transpose diff --git a/docs/viewers/ClustersViewer.md b/docs/viewers/ClustersViewer.md new file mode 100644 index 0000000..4e62b7e --- /dev/null +++ b/docs/viewers/ClustersViewer.md @@ -0,0 +1,5 @@ +--- +title: "viewers.ClustersViewer" +--- + +::: src.fast_cd.viewers.ClustersViewer diff --git a/docs/viewers/WeightsViewer.md b/docs/viewers/WeightsViewer.md new file mode 100644 index 0000000..afe0dce --- /dev/null +++ b/docs/viewers/WeightsViewer.md @@ -0,0 +1,5 @@ +--- +title: "viewers.WeightsViewer" +--- + +::: src.fast_cd.viewers.WeightsViewer diff --git a/docs/viewers/interactive_handle_subspace_viewer.md b/docs/viewers/interactive_handle_subspace_viewer.md new file mode 100644 index 0000000..2a5bff3 --- /dev/null +++ b/docs/viewers/interactive_handle_subspace_viewer.md @@ -0,0 +1,5 @@ +--- +title: "viewers.interactive_handle_subspace_viewer" +--- + +::: src.fast_cd.viewers.interactive_handle_subspace_viewer diff --git a/docs/viewers/interactive_handle_viewer.md b/docs/viewers/interactive_handle_viewer.md new file mode 100644 index 0000000..4444f84 --- /dev/null +++ b/docs/viewers/interactive_handle_viewer.md @@ -0,0 +1,5 @@ +--- +title: "viewers.interactive_handle_viewer" +--- + +::: src.fast_cd.viewers.interactive_handle_viewer diff --git a/docs/world2rel.md b/docs/world2rel.md new file mode 100644 index 0000000..8fb9cfa --- /dev/null +++ b/docs/world2rel.md @@ -0,0 +1,5 @@ +--- +title: "world2rel" +--- + +::: src.fast_cd.world2rel diff --git a/docs/ympr_to_lame.md b/docs/ympr_to_lame.md new file mode 100644 index 0000000..86e96a9 --- /dev/null +++ b/docs/ympr_to_lame.md @@ -0,0 +1,5 @@ +--- +title: "ympr_to_lame" +--- + +::: src.fast_cd.ympr_to_lame diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..90e7b5b --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,39 @@ +# https://realpython.com/python-project-documentation-with-mkdocs/ +# to deploy: +# commit a change with __version__ in setup.py and src/__init__.py +# wait for wheels to build and download them +# twine upload dist/* +# label as new release +# bash docs/create_docs.sh +# mike deploy --update-aliases --rebase --push [VERSION NUMBER] latest +# https://mkdocstrings.github.io/python/usage/ +site_name: Fast CoDy +theme: +# favicon: assets/images/favicon.png + palette: + primary: red + name: "material" + features: + - navigation.sections +plugins: +- mkdocstrings: + default_handler: python + handlers: + python: + paths: [src, src/fast_cd] + options: + heading_level: 2 + show_root_toc_entry: false + show_root_heading: false + show_signature_annotations: false + # show_signature: false + docstring_style: "numpy" +repo_url: https://github.com/otmanon/fast_cd_pyb/ +repo_name: otmanon/fast_cd_pyb/ +extra: + analytics: + provider: google + property: G-YDMBBH2H8E + version: + provider: mike +# https://github.com/jimporter/mike \ No newline at end of file diff --git a/src/fast_cd/__init__.py b/src/fast_cd/__init__.py index c1c5143..d2c54e4 100644 --- a/src/fast_cd/__init__.py +++ b/src/fast_cd/__init__.py @@ -1,46 +1,52 @@ -from .arap_hessian import * -from .skinning_subspace import * -from .average_onto_simplex import * -from .closest_orthogonal_subspace import * -from .cluster_centroids import * -from .cluster_grouping_matrices import * -from .deformation_jacobian import * -from .laplacian import * -from .laplacian_eigenmodes import * -from .lbs_jacobian import * -from .lbs_jacobian import * -from .lbs_weight_space_constraint import * -from .linear_elasticity_hessian import * -from .normalize_height_and_center import * -from .orthonormalize import * -from .project_into_subspace import * -from .project_to_orthogonal import * -from .read_rig_from_json import * -from .read_rig_anim_from_json import * -from .rig_curve_geometry import * -from .rig_geometry import * -from .rotate_rig import * -from .skinning_clusters import * -from .skinning_subspace import * -from .vectorized_trace import * -from .vectorized_transpose import * -from .ympr_to_lame import * +__version__ = '0.0.5' + +from .arap_hessian import arap_hessian +from .skinning_subspace import skinning_subspace +from .average_onto_simplex import average_onto_simplex +from .closest_orthogonal_subspace import closest_orthogonal_subspace +from .cluster_centroids import cluster_centroids_spectral, cluster_centroids_euclidean +from .cluster_grouping_matrices import cluster_grouping_matrices +from .deformation_jacobian import deformation_jacobian +from .laplacian import laplacian +from .laplacian_eigenmodes import laplacian_eigenmodes +from .lbs_jacobian import lbs_jacobian +from .lbs_weight_space_constraint import lbs_weight_space_constraint +from .linear_elasticity_hessian import linear_elasticity_hessian +from .normalize_height_and_center import normalize_height_and_center +from .orthonormalize import orthonormalize +from .project_into_subspace import project_into_subspace +from .project_to_orthogonal import project_to_orthogonal +from .read_rig_from_json import read_rig_from_json +from .read_rig_anim_from_json import read_rig_anim_from_json +from .rig_curve_geometry import rig_curve_geometry +from .rig_geometry import rig_geometry +from .rotate_rig import rotate_rig +from .skinning_clusters import skinning_clusters +from .vectorized_trace import vectorized_trace +from .vectorized_transpose import vectorized_transpose +from .ympr_to_lame import ympr_to_lame from .project_out_subspace import project_out_subspace from .diffuse_weights import diffuse_weights from .momentum_leaking_matrix import momentum_leaking_matrix from .complementary_constraint_matrix import complementary_constraint_matrix from .umfpack_lu_solve import umfpack_lu_solve from .eigs import eigs -from .fast_cd_sim import * +from .fast_cd_sim import fast_cd_sim, fast_cd_state from .mediapipe_face import FE from .one_euro_filter import OneEuroFilter from .face_landmarks_to_positions import face_landmarks_to_positions -from .apps import * -from .viewers import * +from .apps.interactive_cd_rig_anim import interactive_cd_rig_anim from .mediapipe_face_captor import mediapipe_face_captor from .world2rel import world2rel -from .viewers.WeightsViewer import * -from .viewers.ClustersViewer import * + +#Apps +from .apps.interactive_cd_face_tracking import interactive_cd_face_tracking +from .apps.interactive_cd_affine_handle import interactive_cd_affine_handle + +#Viewers +from .viewers.WeightsViewer import WeightsViewer +from .viewers.ClustersViewer import ClustersViewer +from .viewers.interactive_handle_subspace_viewer import interactive_handle_subspace_viewer # set data path and shaders path import os diff --git a/src/fast_cd/__pycache__/arap_hessian.cpython-38.pyc b/src/fast_cd/__pycache__/arap_hessian.cpython-38.pyc index c5260dbb3022a1286abd08b4cbe696a20177d577..defb8419f803f25a835c5c02389e316a6a8317b1 100644 GIT binary patch literal 2230 zcmZ`)OK%%D5GJ`#J*^mm>ogA#Zh=OCVI)ouX%GZ;ofrYyIzb%gun=IZMM_?KA1X4DX?ie+G7Fw}Zk3ba#vt{s zqZyu%`~gTDO=ej9pvmRcHiGq4P3GDcRwqO<<^GB_cngS1qp3GT69;Vla|BO&Z9t!q ziLZj=a9Ytm>=mf0MjF2*lTe4+Ij%9E1;67KnpD8Ht}7QiXt3`)U|rR&uD->Snnh{o z8lcovbGl@3V7+eT7kkua*v?xlw0k#nIK4JQy3s;90IC6nuv=3%A-jizrrG(gSR4KFwuxNH_G+tBsklxAH>HQ8piLuB zR-*@pvuG{gLZCe$NeMySJQ&^dU-6AKa?>qT7UzdN?;UlYaCxGNVYeSkwf)2n2R(K$9CtUmQuHnaT__5}gQN5EH5``# z8_I<3Y#L;_4jm#*yn?InEt56;`GQtJx{#{WMmJ=b~}&`@iyXi#@s_w@EKLaK z-7VnC`iHTpfkfVc4qXe^swBkA5a1QE3S3B5a2;kXvI=~i)FH&HSbPP#9kRRI2_sMT zlHpjafh6+sQ3kvTn)t#9ZkiK^qu%(`<8K3Fp+4}=`e|JZA7up_rTno;d}#_NxPwEd G?)?X#I3*zf delta 927 zcmY*YOK;Oa5Z;GhapIEnK_6;q4;0A)l~Rg?5aLo)!6lbc4pyaNvTozXam=n0Dbhxf zXirESs{DcE24^I$9QYUe3&>yK0<%dg%3Aa7XlA}|yyNxv$}i75^gI{A`ts@gP9jNu$aZ{3l!K4A0WRl)~xCn176lQ`!lfHV0&O<1)>t2 zA%>Sx&ya+nhQsgXct|9MC|O1$+#~5zh)_vJn7@?d|Li=1{E{To>T6bmh@;&2h$WpU zCK3(J5$e$#_lMS%gdvT2kROqrncHX1upmunX63F#5}%WvEp189ii|SjGcKc^1C2}4 zxo#nWe?oy>$URv&$31tVG9z73ar0ZlvetooaT2$#dK?!=c;Z$Vw1ad>+QZoqlBF_| z7MKfWLpx7;Fg>fv2@Hzs=_$PLV`a8Di}<(z0e?=Jq8?_EB59_KRvHO4cwn#hmC@j> zR1uLWOJpGzQDCw-JQbX39s48+^E^tG&7&#bW|@fD{!ZY&Pg=Fcu`X6LK1~9v(@NUS zNI5Z!(mc+)s*v+A6x2u`H6s&bw;TdbW#FZ4wa`bTsyJhW7CSN{Sd C|Ln#9 diff --git a/src/fast_cd/arap_hessian.py b/src/fast_cd/arap_hessian.py index 7bc262c..11cf057 100644 --- a/src/fast_cd/arap_hessian.py +++ b/src/fast_cd/arap_hessian.py @@ -6,21 +6,62 @@ from .deformation_jacobian import deformation_jacobian - -''' -Computes the linear elasticity hessian matrix, using the method of Kim. et al. 2019 Dynamic Deformables -Inputs: - V - n x 3 mesh geometry - F - t x 4 tet indices -Optional: - mu - float or t x 1 array of per-tet first lame parameter values - U - n x 3 deformed mesh geometry where hessian is evaluated - -Returns: - H - 3n x 3n sparse arap hessian matrix - -''' def arap_hessian(V, F, mu=None, U=None): + + """Computes ARAP Hessian + + Parameters + ---------- + V : (n, 3) numpy float array + Rest vertex geometry + F : (f, 4) numpy int array + Tetrahedron indices + mu : float or (f, 1) numpy float array or None + First lame parameter (e.g. stiffness). if None, then sets it to 1 for all tets. + U : (n, 3) numpy float array or None + Deformed geometry where to evaluate the hessian. If None, then U=V. + + Returns + ------- + H : (n*3, n*3) scipy sparse csc matrix + ARAP Hessian at U + """ + + + def dpsidF2(F): + # F is organized in a vecotrized way, #tets x d x d + if (len(F.shape) == 2): + F = F[None, :, :] + d = F.shape[1] + n = F.shape[0] + [U, S, V] = np.linalg.svd(F) + # V = Vt.transpose([0, 2, 1]) + T0 = np.array([[0, -1, 0], [1, 0, 0], [0, 0, 0]]) # (1/ np.sqrt(2)) * U * [] * V + T0 = (1 / np.sqrt(2)) * U @ T0 @ V + + T1 = np.array([[0, 0, 0], [0, 0, 1], [0, -1, 0]]) + T1 = (1 / np.sqrt(2)) * U @ T1 @ V + + T2 = np.array([[0, 0, 1], [0, 0, 0], [-1, 0, 0]]) + T2 = (1 / np.sqrt(2)) * U @ T2 @ V + + t0 = np.reshape(T0, (n, d * d, 1)) + t1 = np.reshape(T1, (n, d * d, 1)) + t2 = np.reshape(T2, (n, d * d, 1)) + + s0 = np.reshape(S[:, 0], (n, 1, 1)) + s1 = np.reshape(S[:, 1], (n, 1, 1)) + s2 = np.reshape(S[:, 2], (n, 1, 1)) + + H = 2 * np.tile(np.identity(9), (n, 1, 1)) + + H -= (4 / (s0 + s1)) * (t0 @ t0.transpose(0, 2, 1)) + H -= (4 / (s1 + s2)) * (t1 @ t1.transpose(0, 2, 1)) + H -= (4 / (s0 + s2)) * (t2 @ t2.transpose(0, 2, 1)) + + return H + + dim = V.shape[1] # B = deformation_jacobian(V, F); if (mu is None): @@ -48,35 +89,3 @@ def arap_hessian(V, F, mu=None, U=None): H = B.transpose() @ A @ Mu @ dpdF2 @ B return H -def dpsidF2(F): - #F is organized in a vecotrized way, #tets x d x d - if (len(F.shape) == 2): - F = F[None, :, :] - d = F.shape[1] - n = F.shape[0] - [U, S, V] = np.linalg.svd(F) - # V = Vt.transpose([0, 2, 1]) - T0 = np.array([[0, -1, 0], [1, 0, 0], [0, 0,0]]) #(1/ np.sqrt(2)) * U * [] * V - T0 = (1/ np.sqrt(2)) * U @ T0 @ V - - T1 = np.array([[0, 0, 0], [0, 0, 1], [0, -1,0]]) - T1 = (1/ np.sqrt(2)) * U @ T1 @ V - - T2 = np.array([[0, 0, 1], [0, 0, 0], [-1, 0,0]]) - T2 = (1/ np.sqrt(2)) * U @ T2 @ V - - t0 = np.reshape(T0, (n, d*d, 1)) - t1 = np.reshape(T1, (n, d*d, 1)) - t2 = np.reshape(T2, (n, d*d, 1)) - - s0 = np.reshape(S[:, 0], (n, 1, 1)) - s1 = np.reshape(S[:, 1], (n, 1, 1)) - s2 = np.reshape(S[:, 2], (n, 1, 1)) - - H = 2 * np.tile(np.identity(9), (n, 1, 1)) - - H -= (4 / (s0 + s1)) * (t0 @ t0.transpose(0, 2, 1)) - H -= (4 / (s1 + s2)) * (t1 @ t1.transpose(0, 2, 1)) - H -= (4 / (s0 + s2)) * (t2 @ t2.transpose(0, 2, 1)) - - return H diff --git a/src/fast_cd/deformation_jacobian.py b/src/fast_cd/deformation_jacobian.py index d760806..07cedcc 100644 --- a/src/fast_cd/deformation_jacobian.py +++ b/src/fast_cd/deformation_jacobian.py @@ -19,8 +19,7 @@ def deformation_jacobian(V, T): P = sp.sparse.coo_matrix((vals.flatten(), (imat.flatten(), jmat.flatten())), shape=(9 * t, 9 * t)).tocsc() J = P @ Ge - # f = J@V.flatten(order="F") - # F = f.reshape((t, 9)) + return J