Close

Intersecting cylinders in Processing

A project log for Individualised nasal CPAP cannula for preterm kids

Preterm infants come in lots of different sizes. Nasal CPAP cannula come in few sizes. Read on to see if we can 3D print a solution.

Ben HartmannBen Hartmann 09/21/2015 at 09:110 Comments

So one unresolved issue with the current model is that the 2 small nares cylinders do not 'cut holes' in the main horizontal cylinder where they intersect. The discussion below is really only a record of my attempts to learn how Processing draws complex shapes. Its not a tutorial.

Within the beginShape/endShape (which I use to draw the cylinder) it is possible to describe a contour which essentially cuts out a negative shape in any 2D or 3D shape.

I found the maths describing the curve of intersection of 2 cylinders here (see equations 13, 14 and 15). Wrote some code to see if I could draw the curve of intersection in Processing. As I was writing the code it was clear that this method would not work with using the beginShape/beginContour functions of Processing. The cylinders are drawn as 60 sided approximations of a cylinder - and the math I was using to describe the intersection could not account for this. The image kind of shows the problem - I've used a red stoke and white fill to show how the cylinder is drawn and then tried to cut out the intersections switching to a green stroke - clearly it don't cut out the intersection...

Discussions