{"id":28367486,"url":"https://github.com/interactivecomputergraphics/stark","last_synced_at":"2025-08-16T23:09:37.445Z","repository":{"id":239837552,"uuid":"800744698","full_name":"InteractiveComputerGraphics/stark","owner":"InteractiveComputerGraphics","description":"Stark is a C++ and Python simulation platform for the robust simulation of rigid and deformable objects in a strongly coupled manner. ","archived":false,"fork":false,"pushed_at":"2024-11-19T15:20:55.000Z","size":15021,"stargazers_count":59,"open_issues_count":0,"forks_count":5,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-08-11T23:49:27.161Z","etag":null,"topics":["deformable-solids","discrete-shell","dynamics","rigid-bodies","simulation"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/InteractiveComputerGraphics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-14T23:10:12.000Z","updated_at":"2025-08-11T02:25:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"927dbd1d-5e86-456a-b1d0-b83b572756b7","html_url":"https://github.com/InteractiveComputerGraphics/stark","commit_stats":null,"previous_names":["interactivecomputergraphics/stark"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/InteractiveComputerGraphics/stark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InteractiveComputerGraphics%2Fstark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InteractiveComputerGraphics%2Fstark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InteractiveComputerGraphics%2Fstark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InteractiveComputerGraphics%2Fstark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InteractiveComputerGraphics","download_url":"https://codeload.github.com/InteractiveComputerGraphics/stark/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InteractiveComputerGraphics%2Fstark/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270177804,"owners_count":24540324,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deformable-solids","discrete-shell","dynamics","rigid-bodies","simulation"],"created_at":"2025-05-29T01:09:49.767Z","updated_at":"2025-08-16T23:09:37.421Z","avatar_url":"https://github.com/InteractiveComputerGraphics.png","language":"C++","readme":"**Note:** This repository is a *work in progress*. \nMore documentation, examples, tutorials, etc. will be coming as the rest of our responsibilities permit. \nIn any case, Stark itself is fully functional and actively used in our own research.\nWe appreciate your patience and interest.\n\n# Stark\n\u003cp align=center\u003e\n \u003cimg src=\"docs/images/robotic_hand.png\" width=\"400\"\u003e\n  \u0026nbsp;\u0026nbsp;\n \u003cimg src=\"docs/images/franka_plastic_cup.jpg\" width=\"400\"\u003e\n\u003c/p\u003e\n\nStark is a C++ and Python simulation _platform_ that provides easy access to state-of-the-art methods to robustly solve simulations of rigid and deformable objects in a strongly coupled manner.\nTo the best of our knowledge, no other existing open source simulation environment provides such a rich collection of models, including coupling, with the same level of robustness.\nStark has been validated through real-world, challenging cases of interactions between robots and deformable objects, see the [Stark ICRA'24 paper](https://www.animation.rwth-aachen.de/publication/0588/).\n\nOne of the main features of Stark is that it uses a powerful symbolic differentiation and code generation engine that allows for a concise formulation of the global variational form of the non-linear dynamic problem.\nAdding new models (e.g. materials, joints, interactions, ...) in Stark is as simple as specifying their energy potential in symbolic form together with the data they depend on.\nThis removes the tedium of manually deriving, implementing, testing and optimizing new models and integrating them in existing complex simulation environments.\nStark collects all the potentials and uses Newton's Method to find the solution to the non-linear implicit time-stepping problem.\nPresently, even though Stark has a C++ and Python API, models can only be defined in C++.\n\nBy default, Stark comes out-of-the-box with important widely used models:\n- 3D and 2D **FEM** discretizations for deformable non-linear materials\n- **Discrete Shells** for cloths and stiff shells\n- **Rigid Bodies** with joints and motors\n- Frictional Contact with **IPC**\n\nSee [Features](#features) section for more details.\n\nThere are two use cases for Stark:\n  - As an external, black-box, powerful simulator that can handle very challenging scenarios.\n  No knowledge of Stark internals are needed in this case, and users can directly use the high-level C++ or Python APIs.\n  - As a research and development tool for simulation.\n  Thanks mainly to the symbolic differentiation and integrated collision detection, Stark can dramatically increase productivity of simulation technology research.\n  See [here](stark/src/models) how the models contained in Stark are implemented.\n\n\n## Hello World\nThe following is a script example using Stark's Python API to execute a simulation of a piece of cloth falling on a rigid box with a prescribed spinning motion.\n\n\u003cp align=center\u003e\n \u003cimg src=\"docs/images/spinning_box_cloth.gif\"\u003e\n\u003c/p\u003e\n\n```python\nimport numpy as np\nimport pystark\n\nsettings = pystark.Settings()\nsettings.output.simulation_name = \"spinning_box_cloth\"\nsettings.output.output_directory = \"output_folder\"\nsettings.output.codegen_directory = \"codegen_folder\"\nsimulation = pystark.Simulation(settings)\n\n# Global frictional contact IPC parameters\ncontact_params = pystark.EnergyFrictionalContact.GlobalParams()\ncontact_params.default_contact_thickness = 0.001  # Can be overriden by per-object thickness\ncontact_params.friction_stick_slide_threshold = 0.01\nsimulation.interactions().contact().set_global_params(contact_params)\n\n# Add deformable surface\ncV, cT, cH = simulation.presets().deformables().add_surface_grid(\"cloth\",\n    size=np.array([0.4, 0.4]),\n    subdivisions=np.array([20, 20]),\n    params=pystark.Surface.Params.Cotton_Fabric()\n)\n\n# Add rigid body box\nbV, bT, bH = simulation.presets().rigidbodies().add_box(\"box\", mass=1.0, size=0.08)\nbH.rigidbody.add_translation(np.array([0.0, 0.0, -0.08]))\nfix_handler = simulation.rigidbodies().add_constraint_fix(bH.rigidbody)\n\n# Set friction pair\ncH.contact.set_friction(bH.contact, 1.0)\n\n# Script\nduration = 10.0\ndef script(t):\n    fix_handler.set_transformation(\n        translation=np.array([0.0, 0.0, -0.08 - 0.1*np.sin(t)]), \n        angle_deg=100.0*t, \n        axis=np.array([0.0, 0.0, 1.0]))\nsimulation.add_time_event(0, duration, script)\n\n# Run\nsimulation.run(duration)\n```\n\nThe output is a sequence of VTK files per output group (in this case one sequence for the cloth and another for the box).\nVTK files can be viewed in Blender with [this](https://github.com/InteractiveComputerGraphics/blender-sequence-loader) add-on or in [Paraview](https://www.paraview.org/).\nYou can use [meshio](https://github.com/nschloe/meshio) to transform VTK meshes to other formats.\n\nStark code will always follow the same structure:\n  - Define global settings and parameters.\n  - Add objects, boundary conditions and define interactions. In this example, `presets` are used but custom objects and composed materials are also possible.\n  - Optionally, specify time-dependent events (script).\n  - Run.\n    \nSee the folder [`stark/pystark/examples`](pystark/examples) for more scenes using the Python API and [`stark/examples`](examples/) for scenes written in C++.\n\n\n## Get Stark\nStark's C++ and Python APIs are essentially equivalent.\nA user who just wants to _use_ Stark with the models that it comes with, probably will prefer the Python API.\nUsers looking to work on their own new models to _extend_ Stark with new functionality will have to work directly in the C++ source code.\n\nEvery time Stark encounters a new potential energy, it will generate and compile code to compute its derivatives.\nTherefore, a C++17 compiler is required.\nYou can specify the command to invoke a compatible compiler using `pystark.set_compiler_command(str)` in Python and `stark::set_compiler_command(str)` in C++.\nBy default, it is `\"g++\"` in Unix and `\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvarsx86_amd64.bat\"` in Windows.\n\nIf you don't have a C++17 compiler and just want to use the models shipped with Stark by default, you can download the corresponding compiled binaries [here](https://rwth-aachen.sciebo.de/s/5NXgsPtoDyVl8Yo).\nDon't forget to point Stark to the folder containing those in `settings.output.codegen_directory`.\n\n### Python API\nYou can install Stark for Python 3.8+ using\n```\npip install stark-sim\n```\n\n### Build from source\nTo build from source you will need [CMake](https://cmake.org/) and a C++17 compiler.\nAll dependencies are bundled with Stark or are downloaded by CMake at build time.\n\n## Examples with code\n\u003cdiv align=\"center\"\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003cimg src=\"docs/images/twisting_cloth.gif\" alt=\"Alt text for gif1\" style=\"width:100%; max-width: 300px;\" /\u003e\n      \u003cbr\u003e\n      \u003ca href=\"pystark/examples/twisting_cloth.py\"\u003etwisting_cloth.py\u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003cimg src=\"docs/images/boxes_on_cloth.gif\" alt=\"Alt text for gif1\" style=\"width:100%; max-width: 300px;\" /\u003e\n      \u003cbr\u003e\n      \u003ca href=\"pystark/examples/boxes_on_cloth.py\"\u003eboxes_on_cloth.py\u003c/a\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003cimg src=\"docs/images/inflation.gif\" alt=\"Alt text for gif1\" style=\"width:100%; max-width: 300px;\" /\u003e\n      \u003cbr\u003e\n      \u003ca href=\"pystark/examples/inflation.py\"\u003einflation.py\u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003cimg src=\"docs/images/viscoelasticity.gif\" alt=\"Alt text for gif1\" style=\"width:100%; max-width: 300px;\" /\u003e\n      \u003cbr\u003e\n      \u003ca href=\"pystark/examples/viscoelasticity.py\"\u003eviscoelasticity.py\u003c/a\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003c!-- Continue adding rows here --\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\n\n## Features\n\n### Models\nBesides a simulator, Stark is a repository of potential energies commonly used for deformable and rigid objects and frictional contact.\nThe following models can be found in symbolic form in `stark/stark/src/models/`:\n\n* Deformable objects\n  - 2D and 3D linear FEM (triangles and tets) with the Neo-Hookean and Stable Neo-Hookean constitutive models, respectively ([paper](https://dl.acm.org/doi/10.1145/3180491))\n  - Discrete Shells ([paper](https://dl.acm.org/doi/10.5555/846276.846284))\n  - Strain limiting ([paper](https://dl.acm.org/doi/10.1145/3450626.3459767))\n  - Inertial and material damping\n* Rigid bodies\n  - Soft joints (linear)\n  - Smooth force/torque capped motors [(paper)](https://www.animation.rwth-aachen.de/publication/0588/)\n  - Comprehensive collection of constraints (ball joints, hinge joints, sliders, ...)\n* Frictional contact (based on triangle meshes)\n  - IPC [(paper)](https://dl.acm.org/doi/abs/10.1145/3386569.3392425)\n* Attachments (based on triangle mesh distances)\n\n### Solver\n* Symbolic differentiation\n  - Automatic generation of gradients and Hessians\n  - Parallel autonomous global evaluation and assembly\n* Triangle-based collision detection\n* Solver\n  - Newton's Method\n  - Intersection free line search (CCD coming soon)\n  - Conjugate Gradient or Direct LU linear solver\n  - Optional adaptive time step size\n  - Optional numerical PSD projection of element Hessians\n* Event-based scripts\n\n## Research using Stark\n* [\"Micropolar Elasticity in Physically-Based Animation\"](https://www.animation.rwth-aachen.de/publication/0582/) - Löschner et al., 2023\n* [\"Curved Three-Director Cosserat Shells with Strong Coupling\"](https://www.animation.rwth-aachen.de/publication/0589/) - Löschner et al., 2024\n* [\"Strongly Coupled Simulation of Magnetic Rigid Bodies\"](https://www.animation.rwth-aachen.de/publication/0590/) - Westhofen et al., 2024\n\n## Cite Stark\n```bibtex\n@InProceedings{FLL+24,\n  author={Fernández-Fernández, José Antonio and Lange, Ralph and Laible, Stefan and Arras, Kai O. and Bender, Jan},\n  booktitle={2024 IEEE International Conference on Robotics and Automation (ICRA)}, \n  title={STARK: A Unified Framework for Strongly Coupled Simulation of Rigid and Deformable Bodies with Frictional Contact}, \n  year={2024},\n  pages={16888-16894},\n  doi={10.1109/ICRA57147.2024.10610574}}\n}\n```\n\n## Acknowledgments\n\n\u003ctable border=\"0\" style=\"align_center;border-radius: 20px;padding: 20px;margin:auto;border:0px\"\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\n      \u003cimg src=\"https://raw.githubusercontent.com/boschresearch/bosch-corporate-information/main/static/Bosch_symbol_logo_black_red.svg\" width=\"300\"\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e\n      Robert Bosch GmbH is acknowledged for generous financial support of the development of the initial version of Stark from 2019 to 2021.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\nList of collaborators to the codebase:\n  - [José Antonio Fernández-Fernández](https://github.com/JoseAntFer)\n  - [Fabian Löschner](https://github.com/w1th0utnam3)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finteractivecomputergraphics%2Fstark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finteractivecomputergraphics%2Fstark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finteractivecomputergraphics%2Fstark/lists"}