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.
Simple Shapes
PressureFieldContact.Geometry.eMesh_box
— Function.eMesh_box()
eMesh_box(r)
eMesh_box(r, c)
Outputs an eMesh
for a box.
PressureFieldContact.Geometry.eMesh_sphere
— Function.eMesh_sphere()
eMesh_sphere(rad)
eMesh_sphere(rad, n_div)
Outputs an eMesh
for a sphere. Larger values of n_div
create finer discretizations.
PressureFieldContact.Geometry.eMesh_half_plane
— Function.eMesh_half_plane()
eMesh_half_plane(plane_w)
eMesh_half_plane(plane_w, is_include_vis_sides)
Outputs an eMesh
for a half-plane.
PressureFieldContact.Geometry.eMesh_cylinder
— Function.eMesh_cylinder()
eMesh_cylinder(rad)
eMesh_cylinder(rad, height; n)
Outputs an eMesh
for a cylinder.
Swept Meshes
PressureFieldContact.Geometry.create_swept_mesh
— Function.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 pathrad
: thickness of swept meshn_side
: number of sides of swept pathis_open
: if the path starts and ends at the same point (e.g. ring) set this to falserot_half
: if the sides of the path are "off" set this to false
PressureFieldContact.Geometry.f_swept_triv
— Function.f_swept_triv(θ)
Straight path for a swept mesh. Pass this to create_swept_mesh
to make a basic swept mesh.
PressureFieldContact.Geometry.f_swept_circle
— Function.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
.
Rotationally Symmetric Meshes
Mesh from an STL file
For an example of this this example:
Transforming Meshes
PressureFieldContact.Geometry.transform!
— Function.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.
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 byt
:basic_dh(R, t)