# How can GH find the maximum incircles in 3D irregular areas?

Continuing the discussion from How can GH find the maximum incircles in an irregular area?:

I met a new problem. now the areas are in 3D. I need find the maximum incircles for each semi-closed part (I should find three or four incircles according to the shapes) using GH.

I applied the code from previous dicussion, but it doesn’t work because it’s for 2D. In 3D, the circle has wrong directions.

Any suggestin and help is so appreciated!

cirlces.3dm (65.4 KB)

I realized that 2D incircles may not be suitable.
Here I create cylinder to show my idea.
Thank you all for any suggestions!

Hello
if you have a cylinder, you have an axis, if you have an axis you can project your curves on a plane having the Z parallel to the axis, then apply the 2D algorithm and extrude circles to cylinders.

What I need is how GH can create these cylinders?
I manually created the cylinder just for showing my idea.

I guess @laurent_delrieu means you should project your 3d curve zu get a planar curve and then use the 2d script.

1 Like

Thank you for your explanation, @flokart!
I did projection work. However, the shape size changes since there are curvature (the whole model has many these shapes around a curved tube): the shape at inner curvature will be enlarged, while the shape at outer curvature will be reduced.
That’s the reason I just want to keep the 3D shape.

Something like this ? Not perfect but could be enough for shape not too curved

biggest cylinder project.gh (22.7 KB)

The other way is to have a surface (mesh) representation of you curve without inner points.
Use ( A = Mesh.CreateFromClosedPolyline(polyline)

Then unroll it with a tool keeping the same mesh topology. For some reasons Ngon plugin transform a Mesh to a Brep that is the same topology as the mesh but when cast to mesh it doesn’t work !!! I here use my own tool that is in an unpublished Nautilus version. You can try some others tools as unrolling a mesh with no inner points is quite trivial.

Find the max circle on the unrolled part (2D)

Deconstruct the circle to points then using MeshMap from Kangaroo place the points on the 3D shape then use circle fit as the points on 3D shape are not on a plane. There is no guaranty that it will be good but it is not far from what you want.

biggest cylinder project V2.gh (37.1 KB)

2 Likes

That’s really a fantastic solution, @laurent_delrieu!
Thank you so much for your kind help!
And hope you publish your new tool soon
Have a nice day!

1 Like