# Dealing with curved lines in GJK

I'm currently using a GJK implementation (supported by EPA for penetration) and I'm trying to optimise the calculation times of distance calculations. One of the biggest hits is trying to solve for distance between a simple 3D shape (ie a cylinder) and a curved line in the shape of a helix (https://en.wikipedia.org/wiki/Helix).

I'm just brute forcing them by chopping the helix into a lot of smaller straight lines and solving each one against the 3D shape.

Is there a better way to do this?

The image below shows the relative shape of the objects and how they can come into contact (the red disk is the moving object). In this screenshot its contacting an end point of the curve, but it will commonly contact anywhere between the end points of the helix.

• Is the helix you speak of the path of a particle in world space? Apr 1, 2019 at 7:55
• We had a past Q&A about intersection with helices (in the context of landing on an orbiting planet) that might have some inspirations in terms of narrowing the upper & lower bounds of the helix that might be relevant to search. Apr 1, 2019 at 11:47
• No in this scenario it is an actual helix (basically a spring) that is stationary and the cylinder is the object in motion. Also the spring is big enough that the cylinder can fit between the 'loop's so to speak so i can't just take the endpoints of the spring and make an estimation. Apr 1, 2019 at 23:01

## 1 Answer

GJK only works between 2 convex objects. So you can do a simplified collision where you converted the helix to a cylinder and then partition the helix based on the result of GJK.