Files
2025-07-04 20:33:06 +03:00

290 lines
20 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Usage &mdash; imstk-unity 1.0.0 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Releases" href="releases.html" />
<link rel="prev" title="Tutorial" href="guide.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home"> imstk-unity
</a>
<div class="version">
1.0.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Introduction</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="documentation.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="documentation.html#setup-for-development">Setup for Development</a></li>
<li class="toctree-l1"><a class="reference internal" href="documentation.html#devices">Devices</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">User guide</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="guide.html">Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="guide.html#example-scenes">Example Scenes</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Class List</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="#component-structure">Component Structure</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#infrastructure">Infrastructure</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#simulationmanager"><code class="docutils literal notranslate"><span class="pre">SimulationManager</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#imstkbehaviour"><code class="docutils literal notranslate"><span class="pre">iMSTKBehaviour</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#geometryfilter"><code class="docutils literal notranslate"><span class="pre">GeometryFilter</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#geometrymap"><code class="docutils literal notranslate"><span class="pre">GeometryMap</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#rigidcontroller"><code class="docutils literal notranslate"><span class="pre">RigidController</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#boundarycondition"><code class="docutils literal notranslate"><span class="pre">BoundaryCondition</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#importers">Importers</a></li>
<li class="toctree-l3"><a class="reference internal" href="#editor-scripts">Editor Scripts</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#models">Models</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#pbdmodel"><code class="docutils literal notranslate"><span class="pre">PbdModel</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#rbdmodel"><code class="docutils literal notranslate"><span class="pre">RbdModel</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#staticmodel"><code class="docutils literal notranslate"><span class="pre">StaticModel</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#interactions">Interactions</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#collisioninteraction"><code class="docutils literal notranslate"><span class="pre">CollisionInteraction</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#pbdobjectinteraction"><code class="docutils literal notranslate"><span class="pre">PbdObjectInteraction</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#pbdrigidgraspinginteraction"><code class="docutils literal notranslate"><span class="pre">PbdRigidGraspingInteraction</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#devices">Devices</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#openhapticsdevice"><code class="docutils literal notranslate"><span class="pre">OpenHapticsDevice</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#vrpndevice"><code class="docutils literal notranslate"><span class="pre">VrpnDevice</span></code></a></li>
</ul>
</li>
</ul>
</li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Release Notes</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="releases.html">Releases</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Licensing</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="license.html">Apache License</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">imstk-unity</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
<li>Usage</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/classes.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="usage">
<h1>Usage<a class="headerlink" href="#usage" title="Permalink to this heading"></a></h1>
<p>For minimal usage of iMSTK-Unity, two things must be added to a Unity Scene.</p>
<blockquote>
<div><ul class="simple">
<li><p>A <code class="docutils literal notranslate"><span class="pre">GameObject</span></code> with a <code class="docutils literal notranslate"><span class="pre">SimulationManager</span></code> attached to it</p></li>
<li><p>A <code class="docutils literal notranslate"><span class="pre">GameObject</span></code> with a Model attached to it.</p></li>
</ul>
</div></blockquote>
<p>Commonly a PhysicsGeometry is also needed on the Model <code class="docutils literal notranslate"><span class="pre">GameObject</span></code>.</p>
</section>
<section id="component-structure">
<h1>Component Structure<a class="headerlink" href="#component-structure" title="Permalink to this heading"></a></h1>
<p>While the C# wrapper supports almost all iMSTK classes, there is a subset that is made available as unity components, this can be assembled in the editor to create simulations using iMSTK inside of Unity.</p>
<section id="infrastructure">
<h2>Infrastructure<a class="headerlink" href="#infrastructure" title="Permalink to this heading"></a></h2>
<section id="simulationmanager">
<h3><code class="docutils literal notranslate"><span class="pre">SimulationManager</span></code><a class="headerlink" href="#simulationmanager" title="Permalink to this heading"></a></h3>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">SimulationManager</span></code> is a component responsible for managing the simulation. There may only exist one. It also controls the construction, initialization, and destruction of <code class="docutils literal notranslate"><span class="pre">iMSTKBehaviour</span></code> to ensure execution ordering:</dt><dd><ul class="simple">
<li><p>Simulation Manager created</p></li>
<li><p>iMSTK objects created and internally initialized</p></li>
<li><p>iMSTK objects externally initialized</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">SimulationManager</span></code> Start</p></li>
<li><p>Updates</p></li>
<li><p>iMSTK objects cleaned up</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">SimulationManager</span></code> cleaned up.</p></li>
</ul>
</dd>
</dl>
<p>This component is required to be in the scene for simulations to run. It is created before any other iMSTK components on any <code class="docutils literal notranslate"><span class="pre">GameObject</span></code>. It implements the start, stop, pause, and other global scene related tasks.</p>
</section>
<section id="imstkbehaviour">
<h3><code class="docutils literal notranslate"><span class="pre">iMSTKBehaviour</span></code><a class="headerlink" href="#imstkbehaviour" title="Permalink to this heading"></a></h3>
<p>An extension of MonoBehaviour to provide different callbacks for special construction, initialization, and destruction ordering.</p>
</section>
<section id="geometryfilter">
<h3><code class="docutils literal notranslate"><span class="pre">GeometryFilter</span></code><a class="headerlink" href="#geometryfilter" title="Permalink to this heading"></a></h3>
<p>Similar to a MeshFilter in Unity. It provides an input and output geometry. It may take in any iMSTK geometry, as well as a Unity Mesh (one can also drag/drop a MeshFilter to it). These are instances of geometries used in all of iMSTK unity scripts.</p>
</section>
<section id="geometrymap">
<h3><code class="docutils literal notranslate"><span class="pre">GeometryMap</span></code><a class="headerlink" href="#geometrymap" title="Permalink to this heading"></a></h3>
<p>Allows the use of separate meshes for the deformable, visual and collision representation. Will move the vertices of the target mesh according to matching points on the source mesh. The points do not have to completely coincide.</p>
</section>
<section id="rigidcontroller">
<h3><code class="docutils literal notranslate"><span class="pre">RigidController</span></code><a class="headerlink" href="#rigidcontroller" title="Permalink to this heading"></a></h3>
<p>Object used between a device handled by the user and a <code class="docutils literal notranslate"><span class="pre">RbdModel</span></code>. It utilizes a mass spring system to correct for latency in the system. It corrects for problems with haptics in simulation systems. By manipulating the spring parameters the haptic response can be tuned to the behavior of the computer and the simulated system.</p>
</section>
<section id="boundarycondition">
<h3><code class="docutils literal notranslate"><span class="pre">BoundaryCondition</span></code><a class="headerlink" href="#boundarycondition" title="Permalink to this heading"></a></h3>
<p>Use this behavior to mark vertices on a deformable object as <cite>fixed</cite>. This means they wont move but are still part of the overall system. In general this will mean that the object will be attached to the points selected. As the shape assigned can be any mesh this is an easy way to fix an object in space.</p>
</section>
<section id="importers">
<h3>Importers<a class="headerlink" href="#importers" title="Permalink to this heading"></a></h3>
<p>iMSTK-Unity provides a custom Unity importer to import geometry using iMSTK. This can import point, line, surface, tetrahedral, &amp; hexahedral meshes (vtk, vtu, stl, ply, veg, …). If the mesh imported is a point, line, or surface mesh then it will be imported as a Unity Mesh object. Anything else not supported by Unity, is loaded as an iMSTKUnity Geometry Object. When a volumetric mesh (such as a tetrahedral mesh) is imported the accompanying surface is extracted and provided as an additional asset.</p>
</section>
<section id="editor-scripts">
<h3>Editor Scripts<a class="headerlink" href="#editor-scripts" title="Permalink to this heading"></a></h3>
<p>iMSTK-Unity provides extensions to the Unity editor. These extensions include:</p>
<blockquote>
<div><ul class="simple">
<li><p>Custom inspectors for the models and geometry components.</p></li>
<li><p>A global settings menu.</p></li>
<li><p>Menu Items for quick creation of GameObject with iMSTK items already setup.</p></li>
<li><p>Editors/windows for various operations</p></li>
</ul>
</div></blockquote>
</section>
</section>
<section id="models">
<h2>Models<a class="headerlink" href="#models" title="Permalink to this heading"></a></h2>
<section id="pbdmodel">
<h3><code class="docutils literal notranslate"><span class="pre">PbdModel</span></code><a class="headerlink" href="#pbdmodel" title="Permalink to this heading"></a></h3>
<p>Use this to represent deformable objects. Position Based Dynamics (PBD), is used to model the deformation. This model supports Lines (1D), Surface Meshes (2D) and, Tetrahedral Meshes (3D) dynamical models see the <a class="reference external" href="https://imstk.readthedocs.io/en/latest/PbdModel.html">iMSTK Documentation</a> for more information on constraints and models. Visual, physics and collision geometry can be assigned separately. If you do, a separate map will be necessary to update the various meshes.</p>
<p>The physics geometry determines the type of constraint that can be used, an invalid constraint may cause problems.</p>
<table class="docutils align-default" id="id1">
<caption><span class="caption-text">Valid Constraint Combinations</span><a class="headerlink" href="#id1" title="Permalink to this table"></a></caption>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Physics Geometry Type</p></th>
<th class="head"><p>Valid Constraints</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Line Mesh (Threads)</p></td>
<td><p>Distance Stiffness, Bend Stiffness</p></td>
</tr>
<tr class="row-odd"><td><p>Surface Mesh (Membranes, Bags)</p></td>
<td><p>Distance Stiffness, Dihedral Stiffness, Area Stiffness</p></td>
</tr>
<tr class="row-even"><td><p>Volumentric Mesh (Tissue)</p></td>
<td><p>Distance Stiffness, Volume Stiffness, Fem (all models)</p></td>
</tr>
</tbody>
</table>
</section>
<section id="rbdmodel">
<h3><code class="docutils literal notranslate"><span class="pre">RbdModel</span></code><a class="headerlink" href="#rbdmodel" title="Permalink to this heading"></a></h3>
<p>Use this to represent moveable rigid objects like forceps or scalpels. Visual and collision geometry can be assigned separately, this behavior will update the transform of the GameObject with each update. For more information set the <a class="reference external" href="https://imstk.readthedocs.io/en/latest/Dynamical_Models.html#rigid-body-2">iMSTK Documentation</a></p>
</section>
<section id="staticmodel">
<h3><code class="docutils literal notranslate"><span class="pre">StaticModel</span></code><a class="headerlink" href="#staticmodel" title="Permalink to this heading"></a></h3>
<p>Use this to represent un-moveable rigid objects like the ground plane or other obstacles.</p>
</section>
</section>
<section id="interactions">
<h2>Interactions<a class="headerlink" href="#interactions" title="Permalink to this heading"></a></h2>
<section id="collisioninteraction">
<h3><code class="docutils literal notranslate"><span class="pre">CollisionInteraction</span></code><a class="headerlink" href="#collisioninteraction" title="Permalink to this heading"></a></h3>
<p>Use this behavior to set up collisions between two objects, in general this behavior can detect what the type of the two objects is that are interacting (mode <cite>Auto</cite>). But you can also select the algorithm that should be used.</p>
</section>
<section id="pbdobjectinteraction">
<h3><code class="docutils literal notranslate"><span class="pre">PbdObjectInteraction</span></code><a class="headerlink" href="#pbdobjectinteraction" title="Permalink to this heading"></a></h3>
<p>A collision interaction specific to PBD models, it allows setting of values specific to interactions with PBDs.</p>
</section>
<section id="pbdrigidgraspinginteraction">
<h3><code class="docutils literal notranslate"><span class="pre">PbdRigidGraspingInteraction</span></code><a class="headerlink" href="#pbdrigidgraspinginteraction" title="Permalink to this heading"></a></h3>
<p>An interaction that allows the grasping of objects, when activated it will attach a point on the rigid to a point on the deformable object and will attempt to keep the two in the same place.</p>
</section>
</section>
<section id="devices">
<h2>Devices<a class="headerlink" href="#devices" title="Permalink to this heading"></a></h2>
<section id="openhapticsdevice">
<h3><code class="docutils literal notranslate"><span class="pre">OpenHapticsDevice</span></code><a class="headerlink" href="#openhapticsdevice" title="Permalink to this heading"></a></h3>
<p>This device is only available with a custom build of iMSTK. It enable the use of the <a class="reference external" href="https://www.3dsystems.com/haptics">3DSystems</a> haptic device.</p>
</section>
<section id="vrpndevice">
<h3><code class="docutils literal notranslate"><span class="pre">VrpnDevice</span></code><a class="headerlink" href="#vrpndevice" title="Permalink to this heading"></a></h3>
<p>This device is only available with a custom build if iMSTK. It enables interactions with devices run by a <a class="reference external" href="https://github.com/vrpn/vrpn">VRPN</a> server.</p>
</section>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="guide.html" class="btn btn-neutral float-left" title="Tutorial" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="releases.html" class="btn btn-neutral float-right" title="Releases" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2022, Kitware.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>