Is there a package that deals with contact search/contact detection?
I want to check for collision between two 3D cylinders, and there are a bunch of edge cases that are a bit tricky to code, so I was hoping there exist a package already.
Modia3D seems to have contact detection… anyone know if it has an API so I can simply call is_contact(cyl1, cyl2)
?
Meshes.jl seems promising indeed. It seems like they have an generic 3d collision detection alg, but it does not work for Cyliders…
using Meshes
c1 = Cylinder(1.0, Segment((0., 0., 0.), (1.,1.,1.)))
c2 = Cylinder(0.5, Segment((0.1, 0.1, 0.1), (1.,1.,1.)))
I = hasintersect(c1, c2)
ERROR: LoadError: MethodError: no method matching center(::Cylinder{Float64})
Closest candidates are:
center(::Point) at ~/.julia/packages/Meshes/C9CHD/src/points.jl:152
center(::Box) at ~/.julia/packages/Meshes/C9CHD/src/primitives/box.jl:34
center(::Ball) at ~/.julia/packages/Meshes/C9CHD/src/primitives/ball.jl:23
...
Stacktrace:
[1] centroid(g::Cylinder{Float64})
@ Meshes ~/.julia/packages/Meshes/C9CHD/src/geometries.jl:41
[2] hasintersect(g1::Cylinder{Float64}, g2::Cylinder{Float64})
@ Meshes ~/.julia/packages/Meshes/C9CHD/src/intersections.jl:164
I think I will try to use a simplified polygon/hexahedron mesh instead of cylinders ( I dont need the collision to be super accurate). Still open for suggestion on other packages/algorithms however.