Tween between circle and square

Hello!

I am trying to develop a geometry that is able to “tween” smoothly between a square and a circle, using a variable filleted radius for the square. However whenever I make the outer shape more square like the geometries become distorted making it impossible to achieve the results I am looking for.

Two issues you have.

  1. Align your curve seams to get rid of the rotation in the tweening.
  2. Use the fit curve component set to degree 3 on the circle as well as the rectangle to get a better tween. Circles are degree 2 curves which don’t really tween well. Your rectangle has a fillet radius, fillets are also degree 2 curve segments which don’t tween well.

Degree two curves have few control points but rely on variable weights on the control points to make the shapes like a circle. However, tweening is directly related to control point positions and does not account for weight, this is why degree 2 curves don’t tween well, if you were curious.

If you would like more advanced tweens check my plug-in Pufferfish which is all about tween interpolation and blending.

4 Likes

Thank you Michael! I have given Putter fish a download and will explore it.

Changing the degree of each curve definitely helped, however I still have some inconsistencies.

Can you help me understand how to adjust/set the seams of each curve? Maybe that will clean up the remaining problems.

It is also possible to use a loft with options, move up one of the curve and then project on plane the result of intersection.

Pufferfish also has a component to align curve seams. (also Pufferfish won’t require fit curve or rebuilding)



Pf_Circle2Square.gh (13.1 KB)

2 Likes

Hi @johnamikesh,

The location of the curve seams will effect the output of the “tween” operation.

If you are using C#, you might also try using Curve.CreateMeanCurve instead of Curve.CreateTweenCurve.

– Dale

Does this work for Rhino V6? If I open in Rhino V5, it works fine. In V6, I get this:

Hmnn, that is strange. Maybe something changed in rhinocommon for curve closest point methods? The Align seams uses this method But clearly in your screenshot it isn’t going to the closest. I don’t have R6 at the moment to test but to be honest I haven’t paid much attention to R6 yet until things stop changing so much.

You can do the seam alignment like this with native components for this simple case of two curves.


Pf_Circle2Square-2.gh (10.5 KB)

Or maybe it is tween component? In which case I will have to investigate a bit to see what R6 changed, lots of stuff going on in that one.

1 Like

Certainly not a judgement, just an FYI, it looks like it may be in the tween through curves component. The same thing happens with that file as well. I am just starting to test out Pufferfish, nice job! I have a few ideas for how our shop might be able to use it in some of our terrain/contour/surface generation/refinement processes!

1 Like

Thanks for pointing it out, it is hard to keep track of the little behind the scenes things Rhino 6 changes. Still trying to figure out a good time when to fully transfer to R6 :smiley:

It seems to me based on your screenshot that some method I am using was changed in R6 to readjust the seam back at the discontinuity (where fillet meets straight segment) which seems weird to me since in the tween component I don’t do anything with seam editing. Some pesky method is taking its own liberty and doing so, now to find which one.

Glad that it might help your workflows, would like to see what you come up with.

Ok, I figured it out. I have a routine in my component that checks if the curve has any fillets, if the curve has fillets it explodes the curve, fits the fillets, and joins the curve back together.

In R5 Rhinocommon join curves doesn’t change the input curves seam location if no new segments are added to the curve. For some reason R6 Rhinocommon join curves resets the seam to be that point where fillet meets line segment.

Yes indeed, unless you want to pay for the privilege of beta testing and debugging, R6 isn’t ready for prime time.

This is fixed now in Pufferfish V2.2

Take a look at thie message thread - it worked perfectly for me:

1 Like