Skip to content
LIBRARY
SpringShape.md

SpringShape

Spring coil shape primitive for 3D rendering.

This component extends from Shape

Usage

MultibodyComponents.SpringShape(render=true, color=[0.5, 0.5, 0.5, 1.0], specular_coefficient=0.7, num_windings=6, N=200, end_ratio=0.1)

Parameters:

NameDescriptionUnitsDefault value
renderWhether this shape should be renderedtrue
colorRGBA color of the shape[0.5, 0.5, 0.5, 1]
specular_coefficientSpecular reflection coefficient (0 = fully diffuse)0.7
num_windings6
N200
end_ratio0.1

Variables

NameDescriptionUnits
r3D position of the shape origin in world frame
R3D rotation matrix (orientation) of the shape in world frame
r_shapeOffset from r to shape origin, resolved in shape frame
length_directionPrimary axis direction (unit vector, resolved in shape frame)
width_directionSecondary axis direction (unit vector, resolved in shape frame)
lengthDimension along length_direction
widthDimension along width_direction
heightDimension perpendicular to both length and width

Behavior

Source

dyad
"Spring coil shape primitive for 3D rendering."
component SpringShape
  extends Shape
  # Number of coil windings
  parameter num_windings::Real = 6
  # Number of points used to render each winding
  parameter N::Integer = 200
  # Fraction of total length used for tapered ends
  parameter end_ratio::Real = 0.1
relations
end
Flattened Source
dyad
"Spring coil shape primitive for 3D rendering."
component SpringShape
  "Whether this shape should be rendered"
  parameter render::Boolean = true
  "3D position of the shape origin in world frame"
  variable r::Real[3]
  "3D rotation matrix (orientation) of the shape in world frame"
  variable R::Real[3, 3]
  "Offset from r to shape origin, resolved in shape frame"
  variable r_shape::Real[3]
  "Primary axis direction (unit vector, resolved in shape frame)"
  variable length_direction::Real[3]
  "Secondary axis direction (unit vector, resolved in shape frame)"
  variable width_direction::Real[3]
  "Dimension along length_direction"
  variable length::Real
  "Dimension along width_direction"
  variable width::Real
  "Dimension perpendicular to both length and width"
  variable height::Real
  "RGBA color of the shape"
  parameter color::Real[4] = [0.5, 0.5, 0.5, 1.0]
  "Specular reflection coefficient (0 = fully diffuse)"
  parameter specular_coefficient::Real = 0.7
  # Number of coil windings
  parameter num_windings::Real = 6
  # Number of points used to render each winding
  parameter N::Integer = 200
  # Fraction of total length used for tapered ends
  parameter end_ratio::Real = 0.1
relations
metadata {}
end


Test Cases

No test cases defined.

  • Examples

  • Experiments

  • Analyses