Jump to content
AntoineSfx

Polybevel, how to round to an actual circle arc ?

Recommended Posts

Using Polybevel, the resulting shape of a rounded corner is not really documented

In 2d, do you know how to add a round bevel to a corner of a polygon that would actually be a circle arc ?

Edited by AntoineSfx

Share this post


Link to post
Share on other sites

shape round, crank up divisions...what are you smoking ;)?

bevel.jpg

Share this post


Link to post
Share on other sites
25 minutes ago, Noobini said:

shape round, crank up divisions...what are you smoking ;)?

bevel.jpg

Indian hemp. It's a vegetable. Anyway..

The reason I need a proper circle arc is because I'm using Houdini to model pieces that will be 3d printed and need to fit another piece that is an actual circle arc of a known radius. Not sure if I want to file an RFE for this, as Polybevel is already very unstable as soon as the input is a bit complex. 

I guess I can build it myself for a one off shape, as I don't see an easy way to fix it in the general case, as it would require to compute the center of curvature and whatnot.

So if you don't know, now you know.

 

roundedbevel.jpg

Share this post


Link to post
Share on other sites

Try to extrude your 2d shape first, then bevel corner edges. The shape of bevels is close enough to a circle.

  • Thanks 1

Share this post


Link to post
Share on other sites
1 hour ago, vicvvsh said:

Try to extrude your 2d shape first, then bevel corner edges. The shape of bevels is close enough to a circle.

Interesting.

Polybevel is using a different algorithm to bevel those edges, and it results in actual circle arcs.

Share this post


Link to post
Share on other sites

Hi,

if interested, here is an older example (a bit modified) where I've tried to create a circular bevel for polylines. It is experimental so it will probably fail in some situation, but you can use custom radii and numbers of division.

Polyline_Circular_Bevel.hipnc

  • Thanks 1

Share this post


Link to post
Share on other sites

This is now a Houini Curve feature in H19

Example:

rounded.png.a784c59ce32c5e5a96dcd9f2087939a8.png

I don't think it's production ready, as the UI is a bit weird to use but:

1/ Create a Bezier curve. It has to be, If you start with a Polygon Curve, it doesn't work. This is a feature of Bezier Curves only, as this is setting the Bezier handles behind the scenes.

2/ Select the points where you want to have a rounded corner; 

3/ Invoke the radial menu (C key) and go to Change point type / create rounded corner

4/ Profit

You can even round corner from a straight segment to a curved segment..

It creates an additional manipulator point that takes care of setting the handles as they should.

Note that this is not technically a circle arc, as Bezier curves can't model circles exactly, but it's close enough for  (0.027 %  maximum deviation according to one quick test)

https://www.sidefx.com/products/whats-new-19/

 

 

Share this post


Link to post
Share on other sites

My suggestion for older versions would be to use NURBS curves
if you start from a right angled shape, with control points (vertices) at the marked blue locations and convert it to a NURBS order 3, I believe you get what you would want:
image.thumb.png.62448ea3e1461a59bf60745c6b81b4b5.png
edit: if you are using an open curve instead of a closed one, you must add at least one more vertex in the middle of any straight segment, and make sure the curve starts there

 

Edited by acey195

Share this post


Link to post
Share on other sites
4 hours ago, acey195 said:

My suggestion for older versions would be to use NURBS curves
if you start from a right angled shape, with control points (vertices) at the marked blue locations and convert it to a NURBS order 3, I believe you get what you would want:
image.thumb.png.62448ea3e1461a59bf60745c6b81b4b5.png
edit: if you are using an open curve instead of a closed one, you must add at least one more vertex in the middle of any straight segment, and make sure the curve starts there

 

No. It does not subdivide to actual circle arcs.

It's more complex than that. In your example, it would approximate to (fake) arc circles that are actually half the radius, i.e the tangent point would fall between the corners and the control point. Making it hard to use.

If you choose the approximate way, you might as well stick with the solution I used in the question, as it gives you more control over the apparent radius.

You can also use the current tool to create a rounded corner and bake it, then look at the result and see if it can be replicated using some simple logic (it's not that simple..)

 

 

Share this post


Link to post
Share on other sites

My current most flexible way for 2D shapes involves measuring distances from an underlying grid.
You can throw multiple intersecting polylines, closed polygons and meshes all at once at it.
Just make sure to not undermine the grids resolution. Blurring distances is another option.

image.png.ea2585475125b469eb13dfa3252b475d.png

round_corners.hiplc

Share this post


Link to post
Share on other sites
3 hours ago, AntoineSfx said:

No. It does not subdivide to actual circle arcs.

It's more complex than that. In your example, it would approximate to (fake) arc circles that are actually half the radius, i.e the tangent point would fall between the corners and the control point. Making it hard to use.

ok you are right, its a bit more finicky than I realized

Share this post


Link to post
Share on other sites

One idea... Extract contour with for example silhouette. Poyexpand, copy to corner point a circle with radius to match your bevel radius

Intersection analysis to cut the original piece with the circles, where they meet, tangent point...

Rebuilt the curve with the joined pieces.

Im sure some people here could give you a proper academic mathematical solution :)

________________________________________________________________

Vincent Thomas   (VFX and Art since 1998)
Senior Env and Lighting  artist & Houdini generalist & Creative Concepts

 http://fr.linkedin.com/in/vincentthomas

image.thumb.png.05bcc4ea2189f8091fcb8b147f9de079.png

Edited by vinyvince

Share this post


Link to post
Share on other sites

For convex shapes just add the minimal position on the inset curve to the direction vector between both positions.

vector pos = minpos(1, v@P);
vector dir = normalize(v@P - pos);
v@P = pos + dir * radius;

image.png.9e5256f9b97e4dc74c5fe6aed2a03b76.png

curve_arcs.hiplc

Edited by konstantin magnus

Share this post


Link to post
Share on other sites

I did the math to find a generalized solution to this, and it's working nicely.

The underlying problem is: where do I insert the control points so that a order 3 Bézier curve approximates to a circle arc.

I won't go into the math too much; it' s a generalization of the method described on the Bezier wiki: https://en.wikipedia.org/wiki/Composite_Bézier_curve

It's important to note that this formula can only work with third order Bézier Curves, i.e a Bézier curve build using a polygon with three segments, with U Order set to 4 in Convert SOP

convert3.thumb.png.4b44d7b18c4b1d20733e3be323e76959.png

You can certainly constrain a higher order Bézier curve to approximate a circle arc; all you need to do is evaluate the Bezier curve at some points and set some values to describe the kind of approximation you're looking for.

Here, the idea is: starts and ends coincide; midpoints coincide; curve is symmetrical (in u space); there is one degree of freedom left, named k

Hull is A-A'-B'-B

This is the formula for an approximation of unit circle arc in the first quadrant, the angle is a

 ( Notation is V = [ x ; y ] )

A=[ 1 ; 0 ]

A'= [ 1  ; k]

B' = [  cos(a)  + k * sin(a)   ;  sin(a)  - k*cos(a)  ]

B = [ cos(a)  ; sin(a) ]

(some basic trig here, similar to the one shown wiki)

This gives a value for k:

k =  ( - 4 / 3 ( 1 + cos(a) ) + 8 / 3 cos ( a / 2 )  )  /  sin( a )

 

asset.thumb.png.10b3254cb9cebf8eaad084655a10558e.png

 

In practice, this k value gives you the distance to corner if you want to " cut" the corner by inserting points on the adjacent segments. 

It approximates nicely up to a = 120 degrees.

Edited by AntoineSfx

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×