ryein / dendro

volumetric modeling for grasshopper built on top of openvdb
Mozilla Public License 2.0
65 stars 20 forks source link

Solves error on curve too short when generating volume from curves #5

Closed SamuelAl closed 4 years ago

SamuelAl commented 4 years ago

Solves issue #4

ryein commented 4 years ago

This is much better. Thanks.

There is a function in VolumeFromCurves.cs that I was wondering if I should still keep. It basically throws a message to notify the user to increase the radius. Your addition will stop it from breaking, so I didn't know if the check in the component is even necessary anymore.

            double minRadius = vSettings.VoxelSize / 0.6667;

            foreach (double radius in vRadius)
            {
                if(radius <= minRadius)
                {
                    AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Radius must be at least 33% larger than voxel size. This will compute but no volume will be created.");
                }
            }
SamuelAl commented 4 years ago

Concerning the check above, I am not sure how my fix would prevent it from breaking. The piece of code I fixed was throwing errors with short curves due to the null values returned by the DivideByLength method when the curve was too short. I am not sure how this relates to the relationship between VoxelSize and radius to generate the DendroVolume. That is a problem with the voxelization procedure having a minimum radius depending on VoxelSize specified, and it is not solved by handling short curves. But if there is something I am missing, please explain it to me! This is such an interesting project, and I would like to keep contributing and understand more and more how it works. Thank you for the opportunity!