Geometry

Geometry

This contact implementation represents rigid objects with triangular meshes and compliant objects with tetrahedral meshes. This package uses the custom geometry data type eMesh. Convenience functions to create meshes for common shapes are documented below.

eMesh Data Type

struct eMesh{T1<:Union{Nothing, Tri}, T2<:Union{Nothing, Tet}}

Data structure for holding geometry data.

source

Simple Shapes

eMesh_box()
eMesh_box(r)
eMesh_box(r, c)

Outputs an eMesh for a box.

source
eMesh_sphere()
eMesh_sphere(rad)
eMesh_sphere(rad, n_div)

Outputs an eMesh for a sphere. Larger values of n_div create finer discretizations.

source
eMesh_half_plane()
eMesh_half_plane(plane_w)
eMesh_half_plane(plane_w, is_include_vis_sides)

Outputs an eMesh for a half-plane.

source
eMesh_cylinder()
eMesh_cylinder(rad)
eMesh_cylinder(rad, height; n)

Outputs an eMesh for a cylinder.

source

Swept Meshes

create_swept_mesh(fun_gen, lr, rad)
create_swept_mesh(fun_gen, lr, rad, n_side)
create_swept_mesh(fun_gen, lr, rad, n_side, is_open; rot_half)

Creates a mesh by sweeping a 3D path for the given inputs:

  • fun_gen: function that takes a single input arc length and outputs 1.) the position on path, 2.) a single direction normal to path and 3.) direction along the path.
  • lr: arc length locations of nodes on path
  • rad: thickness of swept mesh
  • n_side: number of sides of swept path
  • is_open: if the path starts and ends at the same point (e.g. ring) set this to false
  • rot_half: if the sides of the path are "off" set this to false
source
f_swept_triv(θ)

Straight path for a swept mesh. Pass this to create_swept_mesh to make a basic swept mesh.

source
f_swept_circle(r, θ)

Circular path for a swept mesh. Specify the radius by evaluating it ahead of time. For example, define my_circle(θ) = f_swept_circle(0.1, θ), and then pass my_circle to create_swept_mesh.

source

Rotationally Symmetric Meshes

Mesh from an STL file

For an example of this this example:

Transforming Meshes

transform!(e_mesh, extra_args)

Creates a transformation matrix by creating a basic_dh from extra_arguments and then transforms the eMesh. See basic_dh for how to create common transformation types. Reflections are not allowed.

source
struct basic_dh{T}

A matrix used to represent any transformation for eMesh and homogenous transformations for dynamics. The invert method for this object assumes that the matrix corresponds to a homogenous transform. Common transformation types and how to make them:

  • translate 1.0 in x: basic_dh(SVector(1.0, 0.0, 0.0))
  • rotate pi/2 about z: basic_dh(RotZ(pi/2))
  • scale each axis by 2.0: basic_dh(2.0)
  • scale x axis by 2.0: basic_dh(Diagonal(SVector(2.0, 1.0, 1.0)))
  • rotate by R and translate by t: basic_dh(R, t)
source