You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Shapes/setCollisionSmoothingRadius.jl
+34Lines changed: 34 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -30,3 +30,37 @@ function setCollisionSmoothingRadius(shape::Beam{F}, collisionSmoothingRadius::F
30
30
collisionSmoothingRadius2 =min(collisionSmoothingRadius, F(0.1)*min(shape.length, shape.width, shape.thickness)) # at most 10% of the smallest edge length
31
31
return collisionSmoothingRadius2
32
32
end
33
+
34
+
35
+
setContactSphereRadius(shape::Nothing, contactSphereRadius::Nothing, ::Type{F}) where F <:Modia3D.VarFloatType= (false, F(NaN))
36
+
37
+
setContactSphereRadius(shape::Sphere{F}, contactSphereRadius::Nothing, ::Type{F}) where F <:Modia3D.VarFloatType= (false, F(shape.diameter *0.5) )
38
+
setContactSphereRadius(shape::Sphere{F}, contactSphereRadius::F, ::Type{F}) where F <:Modia3D.VarFloatType= (false, contactSphereRadius)
39
+
40
+
41
+
setContactSphereRadius(shape::Ellipsoid{F}, contactSphereRadius::Nothing, ::Type{F}) where F <:Modia3D.VarFloatType= (false, F(min(shape.lengthX, shape.lengthY, shape.lengthZ)*0.5) )
42
+
setContactSphereRadius(shape::Ellipsoid{F}, contactSphereRadius::F, ::Type{F}) where F <:Modia3D.VarFloatType= (false, contactSphereRadius )
43
+
44
+
45
+
setContactSphereRadius(shape::Cylinder{F}, contactSphereRadius::Nothing, ::Type{F}) where F <:Modia3D.VarFloatType= (false, F(min(shape.diameter, shape.length)*0.5) )
46
+
setContactSphereRadius(shape::Cylinder{F}, contactSphereRadius::F, ::Type{F}) where F <:Modia3D.VarFloatType= (false, contactSphereRadius )
47
+
48
+
49
+
setContactSphereRadius(shape::Capsule{F}, contactSphereRadius::Nothing, ::Type{F}) where F <:Modia3D.VarFloatType= (false, F(shape.diameter*0.5) )
50
+
setContactSphereRadius(shape::Capsule{F}, contactSphereRadius::F, ::Type{F}) where F <:Modia3D.VarFloatType= (false, contactSphereRadius )
51
+
52
+
53
+
setContactSphereRadius(shape::Cone{F}, contactSphereRadius::Nothing, ::Type{F}) where F <:Modia3D.VarFloatType= (false, F((shape.diameter + shape.topDiameter)*0.25) )
54
+
setContactSphereRadius(shape::Cone{F}, contactSphereRadius::F, ::Type{F}) where F <:Modia3D.VarFloatType= (false, contactSphereRadius )
55
+
56
+
57
+
setContactSphereRadius(shape::Box{F}, contactSphereRadius::Nothing, ::Type{F}) where F <:Modia3D.VarFloatType= (true, F(min(shape.lengthX, shape.lengthY, shape.lengthZ)*0.5) )
58
+
setContactSphereRadius(shape::Box{F}, contactSphereRadius::F, ::Type{F}) where F <:Modia3D.VarFloatType= (true, contactSphereRadius )
59
+
60
+
61
+
setContactSphereRadius(shape::Beam{F}, contactSphereRadius::Nothing, ::Type{F}) where F <:Modia3D.VarFloatType= (true, F(min(shape.length, shape.width, shape.thickness)*0.5) )
62
+
setContactSphereRadius(shape::Beam{F}, contactSphereRadius::F, ::Type{F}) where F <:Modia3D.VarFloatType= (true, contactSphereRadius )
63
+
64
+
65
+
setContactSphereRadius(shape::FileMesh, contactSphereRadius::Nothing, ::Type{F}) where F <:Modia3D.VarFloatType= (false, F(shape.shortestEdge *0.5) )
66
+
setContactSphereRadius(shape::FileMesh, contactSphereRadius::F, ::Type{F}) where F <:Modia3D.VarFloatType= (false, contactSphereRadius )
Copy file name to clipboardExpand all lines: src/Shapes/solid.jl
+25-4Lines changed: 25 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,8 @@
4
4
massProperties = nothing,
5
5
collision = false,
6
6
contactMaterial = "",
7
-
collisionSmoothingRadius = 0.0,
7
+
collisionSmoothingRadius = 0.001,
8
+
contactSphereRadius = nothing,
8
9
visualMaterial = VisualMaterial())
9
10
10
11
Generate a [Solid](@ref) with physical behavior of a rigid body with mass, visualization and collision properties.
@@ -35,6 +36,22 @@ Generate a [Solid](@ref) with physical behavior of a rigid body with mass, visua
35
36
36
37
- `collisionSmoothingRadius`: Defines a collision smoothing radius for surface edges, its default value is `0.001`. It takes the minimum value of your collision smoothing radius and 10% of the smallest shape length, like `min(collisionSmoothingRadius, 0.1 min(shape dimensions))`. If it is set to `0.0` no `collisionSmoothingRadius` is used. A `collisionSmoothingRadius` is used for `Box`, `Cylinder`, `Cone`, and `Beam`.
37
38
39
+
- `contactSphereRadius`: for each shape a `contactSphereRadius` is defined. So that Herz' pressure is used in [Response calculation](@ref) not only for spheres. You can define your own `contactSphereRadius`, otherwise it is computed from shape geometry (sketched in the following table).
For flat shapes, [Box](@ref) and [Beam](@ref), no `contactSphereRadius` is taken. For Herz' pressure it is needed only if two flat shapes are colliding.
54
+
38
55
- `visualMaterial`: Defines the material of the solid used for visualization. A pre-defined [Visual material](@ref)
39
56
from palettes/visualMaterials.json (e.g. `"RedTransparent"`) or a user-defined [Visual material](@ref) (e.g.
40
57
`VisualMaterial(color="DeepSkyBlue4", transparency=0.75)`) can be used.
0 commit comments