G3 “Fillet” using Evolutionary Algorithm in Rhinoceros 3D
Download G3 Fillet Script ↗
Rhinoceros is a powerful surfacing tool. But to achieve Class A surface quality in Rhino, you can only go so far with the native commands. For example, the “BlendCrv” command can be used to create different types of continuity criteria. But the tool is not really precise, especially if we want to mimic the dimension of a fillet radius. In this post, we will learn how to create a high quality curve “Fillet”. Let’s see what are our options:
Option A: _Fillet
The fillet option creates a Tangent continuity between the curve segments, also known as G1 continuity. After the operation, we will have three curves; 2 baselines and an arc or the “fillet curve”. The first control point of the fillet curve is connected to the endpoint of the base curve. And the second control point is “aligned” or tangent to the first & second control points of the base curve.
Curvature Analysis: The curvature comb is aligned to the base curve, there is a uniform curve flow, but the radius value is different at the joining position. Simply saying, the transition between the line and the arc is not smooth. From having 0 radii, we suddenly introduce a bend of 10mm radius.
This will create a highlight in the final surface quality at the point of union and this is not an optimum result if we want to achieve high surface quality like Apple products.
Option B: _BlendCrv
To create a higher quality continuity between the curve segments, we can use the BlendCrv (Blend Curve) command. It will let us switch between different types of continuity, G0 (Position), G1 (Tangency), G2 (Curvature), G3 (Torsion) and G4 (Curvature plot curvature).
The Blend Curve command also contains various control point (CVs) handles to calibrate the transition between the curves. You can press SHIFT when moving the CVs to create symmetric deformation.
Curvature Analysis: The curvature comb is aligned to the base curve, and there is a nice radius transition from 0 mm at the joining point to a higher radius value as we move along the curve. Simply saying, the transition between the line and the "arc" is very smooth. However, moving the CVs is a manual process as there is no direct input to verify how much you are deviating from the original fillet. Although this will create a high surface quality, we will be creating inaccurate results as the resulting Blend might not be within the design intent tolerance.
Option C : _BlendCrv + Gh Optimization
So, what if we want the G3 continuity, but also maintain minimum deviation from the reference Fillet? Well, there is a way to archive this. We will take advantage of Grasshopper Plugin and some help from Nature using the Evolutionary optimizer.
We will recreate the Blend problem in Grasshopper. This is a simple or complicated process depending upon your Grasshopper skills. And if you want to learn Grasshopper, check here. We will create four control points that can be moved freely on each end, a total of 8 control points and a Degree 7 single-span curve. These 4 points are our variable parameters. By moving these 4 points, we can tweak the Blend.
Evolutionary optimization : Galapagos
Once we have managed to recreate the problem inside Grasshopper, we will connect these four variables to Galapagos.
What is Galapagos?
Galapagos is a plugin that can simulate the natural process of Evolution inside the Rhinoceros 3D environment. These types of optimization algorithms are also known as Evolutionary solvers. We need two inputs for this to work; Genome & Fitness.
Genome: We will define the four parameters as the Genes (Genotype) of the blend curve (Phenotype).
Fitness: We need to evaluate each solution (Phenotype) in the simulation-based upon a fitness parameter to determine if this variation of the curve survives the next generation or not. We can do this by calculating the deviation between the Fillet and the Blend curve on 10 sample points (We can increase this parameter to 20 or 30 sample points if we want to increase our fitness function resolution). And in this example, we want to minimize the deviation.
So, when we run the solver, the 4 CVs will move randomly at the start. Galapagos will evaluate the 100 possible solutions to see which of these 100 curves has the least deviation. In the next generation, the best performing curves will “survive” and create offspring by combining the DNA or Genes of the parent curves. The curves that are performing poorly will be eliminated (just like in nature). And if we let it run a couple of generations, let’s say 200 iterations, you will notice it will slowly converge into an optimum Blend curve with a deviation of around 1 or 2 hundredths of a millimetre.
2D to 3D: These curves are building blocks of surfaces. Hence, surfaces created using these blend curves will have the same Degree and continuity along U (or V) direction. Here we can see a loft between 3 similar profiles. By analyzing the surface quality using Zebra Map, Environment Map and curvature map, we can evaluate the different characteristics of the blend.
Conclusion:
As always, we can further optimize the definition to get better results. But I think this is a good start to create a G3 blend that is closest to the fillet reference curve. We can add a generic proportion or aspect ratio between the CVs, but it might not work where the angle between the curves is not 90º. We can also set a minimum distance between the CVs to disperse them uniformly and create better surface quality.
Feel free to use the attached .gh definition and experiment with other blend types. Do tag us in your results! We will be happy to share it with our growing design community. If new functionality to the script is added, we will let you know. We hope this was useful.