stim namespace

The root namespace for all stim functions and types.

Namespaces

namespace lib
Library metadata.
namespace literals inline
User-defined literals for stim types.

Classes

struct bounding_box
An axis-aligned bounding box.
struct bounding_sphere
A bounding sphere.
struct cache_interface
Interface for enabling runtime caching of computationally-expensive resources.
struct cutter_description
Initialization parameters for rigid body-based cutters.
struct debug_draw_interface
Interface for drawing poly-lines for debugging purposes.
struct debug_ui_interface
Interface for enabling an immediate-mode GUI for debugging purposes.
struct duration
A simple duration type.
class environment
A shared system environment context for soft-tissue simulations.
struct environment_description
Initialization parameters for stim::environment.
struct executor_interface
Interface for enabling multi-threading.
struct executor_task
An opaque packet of task data used by the executor interface.
struct force_feedback_emitter_description
Initialization parameters for force feedback emitters.
class force_feedback_emitter_handle
A handle to a force_feedback_emitter.
struct log_interface
Interface for enabling library log output.
template<typename Scalar, size_t Rows, size_t Columns>
struct matrix
A NxM-dimensional matrix.
struct mesh_description
Initialization parameters for meshes.
struct mesh_indices_description
Initialization parameters for a mesh's indices.
class mesh_reader
RAII interface for reading mesh information from scene objects.
template<size_t Dimensions>
struct mesh_vertices_channel_description
Initialization parameters for a multi-scalar channel of mesh vertex data.
struct mesh_vertices_description
Initialization parameters for a mesh's vertices.
struct mesh_vertices_scalar_description
Initialization parameters for a single scalar in a channel of mesh vertex data.
struct object_constants
Constants used to fine-tune the behaviour of an object in the simulation.
class object_handle
A generic handle capable of opaquely representing any simulation object.
struct plane
A plane.
template<typename T = void>
class result
A result type for library operations which may fail, returning an error message.
struct rigid_body_description
Initialization parameters for rigid bodies.
class rigid_body_handle
A handle to a rigid body.
struct signed_distance_field_sample
Holds the signed distance and the gradient of some signed distance field at some point.
class simulation
A soft-tissue simulation.
struct simulation_constants
Constants used to tweak various aspects of the physics simulation.
struct simulation_description
Initialization parameters for stim::simulation.
struct soft_body_description
Initialization parameters for soft bodies.
class soft_body_handle
A handle to a soft body.
template<typename T, size_t Extent = -1>
class span
A non-owning view of contiguous elements.
class string_view
A non-owning view of a UTF-8 string.
template<typename Scalar, size_t Dimensions>
struct vector
An N-dimensional vector.
struct volumetric_body_description
Initialization parameters for volumetric bodies.
class volumetric_body_handle
A handle to a volumetric body.
struct workspace_description
Initialization parameters for the workspace componenent of stim::simulation_description.

Enums

enum class cutter_flags: uint64_t { none = 0 }
Rigid body-based cutter initialization flags.
enum class debug_draw_groups: uint64_t { none = 0, workspaces = 1 << 0, rigid_bodies = 1 << 1, soft_bodies = 1 << 2, volumetric_bodies = 1 << 3, force_feedback_emitters = 1 << 4, axes = 1 << 9, bounding_spheres = 1 << 10, bounding_boxes = 1 << 11, signed_distance_fields = 1 << 12, cutters = 1 << 13, particles = 1 << 22, position_constraints = 1 << 23, stretch_constraints = 1 << 24, bend_constraints = 1 << 25, collision_constraints = 1 << 26, constraints = position_constraints | stretch_constraints | bend_constraints | collision_constraints, all = ~uint64_t{}, defaults = all & ~(axes | bounding_spheres | signed_distance_fields) }
Debug line drawing render groups.
enum class debug_ui_groups: uint64_t { none = 0, summary = 1 << 0, memory = 1 << 1, profiler = 1 << 2, objects = 1 << 3, solver = 1 << 4, lib = 1 << 5, all = ~uint64_t{}, defaults = all }
Debug UI groups.
enum class environment_flags: uint64_t { none = 0 }
System environment initialization flags.
enum class force_feedback_emitter_flags: uint64_t { none = 0 }
Force feedback emitter initialization flags.
enum class log_categories: uint8_t { none = 0, verbose = 1 << 0, info = 1 << 1, warning = 1 << 2, error = 1 << 3 }
Log message categories.
enum class mesh_flags: uint64_t { none = 0, triangle_list = 1 << 0, triangle_strip = 1 << 1, forward_winding = 1 << 2, reverse_winding = 1 << 3 }
Mesh initialization flags.
enum class mesh_traits: uint64_t { none = 0, topology = 1 << 0, winding_order = 1 << 1, index_count = 1 << 2, vertex_count = 1 << 3, indices = 1 << 4, positions = 1 << 5, normals = 1 << 6, uvs = 1 << 7 }
Mesh traits.
enum class rigid_body_flags: uint64_t { none = 0, immobile = 1 << 0, high_resolution_sdf = 1 << 1, force_feedback = 1 << 2 }
Rigid body flags.
enum class scalar_type: uint8_t { none, float16, float32, float64, int8, int16, int32, int64, uint8, uint16, uint32, uint64 }
Scalar types.
enum class simulation_flags: uint64_t { none = 0 }
Simulation initialization flags.
enum class soft_body_flags: uint64_t { none = 0, cuttable = 1 << 0, mesh_simplification_low = 0, mesh_simplification_medium = 1 << 1, mesh_simplification_high = 1 << 2, mesh_simplification_disabled = mesh_simplification_medium | mesh_simplification_high, pin_in_place = 1 << 3, immobile_boundaries = 1 << 4 }
Soft body initialization flags.
enum class volumetric_body_flags: uint64_t { none = 0 }
Volumetric body initialization flags.

Typedefs

template<typename... T>
using all_scalar_types = api_detail::variadic_and<is_scalar_type<T>::value...>
Metafunction for determining if a set of types are all (or are all references to) a stim scalar types.
using buffer_view = span<void>
A view of an opaque (type-erased) buffer.
using const_buffer_view = const_span<void>
A const view of an opaque (type-erased) buffer.
template<typename T, size_t Extent = -1>
using const_span = span<const T, Extent>
Alias for span<const T>.
template<typename T>
using is_scalar_type = std::integral_constant<bool,(to_scalar_type<T>::value !=scalar_type::none)>
Metafunction for determining if a type is (or is a reference to) a stim scalar type.
using mat3 = matrix<float, 3, 3>
A 3x3 matrix of floats.
using mat4 = matrix<float, 4, 4>
A 4x4 matrix of floats.
template<scalar_type Type>
using to_real_type = typename api_detail::scalar_type_to_real_type<Type>::type
Metafunction for getting the real type corresponding to a scalar_type value.
template<typename T>
using to_scalar_type = api_detail::real_type_to_scalar_type<api_detail::remove_cvref<T>>
Metafunction for getting the scalar_type value corresponding to a real type.
using vec2 = vector<float, 2>
A 2D vector of floats.
using vec3 = vector<float, 3>
A 3D vector of floats.
using vec4 = vector<float, 4>
A 4D vector of floats.

Functions

auto create_environment(const environment_description& desc) -> result<environment> noexcept
Creates a stim::environment.
auto create_simulation(const simulation_description& desc) -> result<simulation> noexcept
Creates a simulation.
auto operator!(scalar_type val) -> bool constexpr noexcept
Returns true if a scalar_type is none.
auto operator""_ms(unsigned long long ms) -> duration constexpr noexcept
Creates a stim::duration representing milliseconds.
auto operator""_ms(long double ms) -> duration constexpr noexcept
Creates a stim::duration representing milliseconds.
auto operator""_ns(unsigned long long ns) -> duration constexpr noexcept
Creates a stim::duration representing nanoseconds.
auto operator""_ns(long double ns) -> duration constexpr noexcept
Creates a stim::duration representing nanoseconds.
auto operator""_s(unsigned long long s) -> duration constexpr noexcept
Creates a stim::duration representing seconds.
auto operator""_s(long double s) -> duration constexpr noexcept
Creates a stim::duration representing seconds.
auto operator""_sv(const char* str, size_t len) -> string_view constexpr noexcept
Creates a string_view.
auto operator""_us(unsigned long long us) -> duration constexpr noexcept
Creates a stim::duration representing microseconds.
auto operator""_us(long double us) -> duration constexpr noexcept
Creates a stim::duration representing microseconds.

Enum documentation

enum class stim::cutter_flags: uint64_t

Rigid body-based cutter initialization flags.

enum class stim::debug_draw_groups: uint64_t

Debug line drawing render groups.

Enumerators
none
workspaces

The simulation's workspace regions.

rigid_bodies

Master switch for all rigid body debug drawing.

soft_bodies

Master switch for all soft body debug drawing.

volumetric_bodies

Master switch for all volumetric body debug drawing.

force_feedback_emitters

Force feedback emitters.

axes

Object axes.

bounding_spheres

Bounding spheres.

bounding_boxes

Bounding boxes.

signed_distance_fields

Signed distance fields.

cutters

Cutters.

particles

Particles.

position_constraints

Position constraints.

stretch_constraints

Stretch constraints.

bend_constraints

Bend constraints.

collision_constraints

Collision constraints.

constraints

All constraints.

all

All debug draw groups.

defaults

The default groups argument passed to stim::simulation::debug_draw().

enum class stim::debug_ui_groups: uint64_t

Debug UI groups.

Enumerators
none
summary

A high-level summary of the simulation's state.

memory

The simulation's internal memory usage.

profiler

The simulation's internal profiler.

objects

The objects in the simulation, grouped by type.

solver

Controls for the internal physics solver mode.

lib

Displays information about the stim library itself (version, arch, et cetera).

all

All debug UI groups.

defaults

The default groups argument passed to stim::simulation::debug_ui().

enum class stim::environment_flags: uint64_t

System environment initialization flags.

enum class stim::force_feedback_emitter_flags: uint64_t

Force feedback emitter initialization flags.

enum class stim::log_categories: uint8_t

Log message categories.

Enumerators
none
verbose

Verbose messages meant mainly for library internal diagnostics.

info

Informational messages.

warning

Warnings.

error

Errors.

enum class stim::mesh_flags: uint64_t

Mesh initialization flags.

Enumerators
none
triangle_list

The mesh's topology is a list of distinct triangles.

Image
triangle_strip

The mesh's topology is sequential strip of connected triangles.

Image
forward_winding

The mesh's triangles are forward-wound, i.e. [0, 1, 2], ....

reverse_winding

The mesh's triangles are reverse-wound, i.e. [0, 2, 1], ....

enum class stim::mesh_traits: uint64_t

Mesh traits.

Enumerators
none
topology

The mesh's topology.

winding_order

The mesh's triangle winding order.

index_count

The number of indices in the mesh.

vertex_count

The number of vertices in the mesh.

indices

The values of the indices in the mesh.

positions

The values of the vertex positions in the mesh.

normals

The values of the vertex normals in the mesh.

uvs

The values of the vertex UVs in the mesh.

enum class stim::rigid_body_flags: uint64_t

Rigid body flags.

Enumerators
none
immobile

This rigid body will not be moved, scaled or rotated after being created.

This allows the simulation to take some shortcuts to reduce CPU and memory usage used for this object.

high_resolution_sdf

Generate a higher-resolution signed-distance field (can help with collision 'jank').

force_feedback

Record force-feedback information for this rigid body.

enum class stim::scalar_type: uint8_t

Scalar types.

Enumerators
none
float16

16-bit IEEE 754 floating-points

float32

32-bit IEEE 754 floating-points

float64

64-bit IEEE 754 floating-points

int8

signed 8-bit integers

int16

signed 16-bit integers

int32

signed 32-bit integers

int64

signed 64-bit integers

uint8

unsigned 8-bit integers

uint16

unsigned 16-bit integers

uint32

unsigned 32-bit integers

uint64

unsigned 64-bit integers

enum class stim::simulation_flags: uint64_t

Simulation initialization flags.

enum class stim::soft_body_flags: uint64_t

Soft body initialization flags.

Enumerators
none
cuttable

This soft body will be cuttable.

mesh_simplification_low

Any simplification applied to the soft body's mesh will be of low strength.

mesh_simplification_medium

Any simplification applied to the soft body's mesh will be of medium strength.

mesh_simplification_high

Any simplification applied to the soft body's mesh will be of high strength.

mesh_simplification_disabled

No simplification will be applied to the soft body's mesh.

pin_in_place

Attempts to keep the body's vertices in place, using position_constraints. Still allows some movement.

immobile_boundaries

Keeps all boundary edges fixed in place.

enum class stim::volumetric_body_flags: uint64_t

Volumetric body initialization flags.

Function documentation

result<environment> stim::create_environment(const environment_description& desc) noexcept

Creates a stim::environment.

Parameters
desc The environment description.
Returns A new system environment, or an error message detailing why instantiation failed.

result<simulation> stim::create_simulation(const simulation_description& desc) noexcept

Creates a simulation.

Parameters
desc The simulation description.
Returns A new simulation, or an error message detailing why instantiation failed.

bool stim::operator!(scalar_type val) constexpr noexcept

Returns true if a scalar_type is none.