# Semi-Cylinder Geometry with Radiused Corners

Hi all,

I’m curious how you all would go about creating a custom geometry for a semi-cylinder where the two corners have a radius that can be controlled. Here is a picture of the basic shape I am trying to replicate, and the end goal is for this shape to be subtracted from a full cylinder with a Boolean operation.

Similarly I’m wondering if it would be possible to create a similar controllable radius effect on the “corners” for a crescent shape like this one.

Thank you!

Addon to create special / extended geometries - #12 by hofk

threejsResources/MoonPhases/MoonPhases.html at f7ecc1c0584c475225570dea6f5cd2f32dda96d3 · hofk/threejsResources · GitHub

This example shows you how you can shape a cylinder geometry according to your wishes. You only need the appropriate formulas for calculating the coordinates, i.e. a little elementary knowledge of geometry.

Skinned mesh with dynamic knees

BendCylinderToKnee

Here you can see the position of the vertices and the indices. NumberingHelperExamples

Other examples
TorusFlat
SpiralFromCylinder
SineWaveGrooveRing

I’d first define the profile as a 2D shape, then I’d extrude it into 3D.

2 Likes

I have been playing around with trying to create the 2D shape but I can’t quite seem to get it quite right. I am using 3 different absarc to create the major radius of the semi circle, and the two rounded corners. Using some basic geometry I am trying to position everything accordingly to the set radius of the corners and control the start and end positions of the major semi-circle, but as you can see the result doesn’t work quite right.

Here is a codepen: https://codepen.io/nateyy/pen/mdYeKqq

Does anyone have a better approach or any advice for where I might be going wrong?
Thanks!

I tried to look at your code. I’m not sure I have the time to digest all the Math in it.

Here is what I had in mind, when I proposed to extrude a 2D shape. This is a line of semi-cylinders with increasing roundness of corners. The class `SemiCyinderGeometry` is defined in lines 35-56:

https://codepen.io/boytchev/full/gOJrwBa

3 Likes

This is incredibly helpful to see how you have constructed the SemiCylinderGeometry, thank you so much for helping out here!

1 Like

`x = Math.sqrt(R*R-2*R*r)`
Love the elegance and simplicity
Costed me a couple of cups of coffee to realize why it is so, as I’m not a math guy at all

3 Likes

I am also not a math guy, how would you go about creating a crescent shape with round-able points? I am assuming it would be constructed with 4 absarcs, one for each major curve and one for each rounded point, but I am unsure of the math needed to calculate the properties for those rounded point absarcs.

I suspect the following logic is what I need to derive the cresent shape given user specified inputs of each major radius and the radius of the desired rounded corner, but I am struggling to translate this to three.

5 Likes