# Rounded Polygon

183 messages
123456 ... 10
Open this post in threaded view
|

## Re: Rounded Polygon

 Hi, I now have a bezier patch in 3d:         Roger. -- ** [hidden email] ** https://www.BitWizard.nl/ ** +31-15-2049110 ** **    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    ** The plan was simple, like my brother-in-law Phil. But unlike Phil, this plan just might work. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org bezier_3d.png (28K) Download Attachment
Open this post in threaded view
|

## Re: Rounded Polygon

Open this post in threaded view
|

## Re: Rounded Polygon

Open this post in threaded view
|

## Re: Rounded Polygon

 In reply to this post by Ronaldo Ronaldo wrote > adrianv < > avm4@ > > wrote: > > > However I disagree that you could meet the zero curvature constraint at > both end with degree 3 curves. To have a zero curvature at the beginning > of > the arc, the first 3 control points should co-linear. The same is true for > the ending point. If we require zero curvature at both ends all four > control points should be co-linear and the arc reduces to a straight > segment. No it doesn't.  I posted graphs a few messages back showing zero curvature order 3 beziers, and I had directly verified that the curvature was indeed zero by calculating the derivatives both symbolically and numerically, so I am reasonably sure it was correct.   With p0=p3 set to the endpoints of the arc you then set p1=p2 equal to the point of the corner.  You achieve the co-linearity condition in a degenerate fashion, since p1 and p2 are on both lines.   > Degree 4 is in fact the minimal degree for zero curvature at both ends for > a non-straight line Bezier arc. However degree 5 solution give us not only > more degrees of freedom but a better arc shape as will see bellow. Degree > 4 > solution produces an arc with a greater curvature variation and a more > pointed arc. Degree 5 shape is able to produce arcs that resemble circular > arcs. It appears that your degree 4 code can also generate a nearly circular arc: just set r1 very small, like .01 and you get something visually indistinguishable from a circle.  In fact, it looks very similar to your empirically determined 17/32 value.  I wonder what are the parameters for the order 5 bezier that reduce it to the order 4. On the left is order 4 with r1=0.01 and on the right, order 5 with r1=17/32.   -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Rounded Polygon

Open this post in threaded view
|

## Re: Rounded Polygon

Open this post in threaded view
|

## Re: Rounded Polygon

Open this post in threaded view
|

## Re: Rounded Polygon

 I understand your point because I am also unable to perceive visually curvature discontinuities. But people from visual arts have training eye to perceive it. However, even for people like us it may be noticible on shinning and reflecting surfaces.The following YouTube video gives an idea of the effect of different kinds of continuity.It was clearer to me the effect of the various kinds of continuity with the stripe view. Designers from automobile industry are very concerned with the effect of shadows and light reflexions on the surface of their models.Besides, curvature continuity is a requeriment on the design of a road track. Any discontinuity on the track is prone to an accident because a sudden wheel turn is needed to keep the vehicle on track when you cross the discontinuity. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Rounded Polygon

Open this post in threaded view
|

## Re: Rounded Polygon

 In reply to this post by Ronaldo On 15/03/2019 14:07, Ronaldo Persiano wrote: Besides, curvature continuity is a requeriment on the design of a road track. Any discontinuity on the track is prone to an accident because a sudden wheel turn is needed to keep the vehicle on track when you cross the discontinuity. Railways used to be designed with straight and curves, and it made them uncomfortable and restricted speeds, and ditto "loop the loop" on roller coasters as the sudden changes in acceleration (high jerk) caused neck injuries. Then along came what I still call clothoid curves, but wikipedia prefers Euler Spirals. https://en.wikipedia.org/wiki/Euler_spiral They are used to link straights to circles on railways, rollercoasters, and much more. https://en.wikipedia.org/wiki/Track_transition_curve _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Rounded Polygon

Open this post in threaded view
|

## Re: Rounded Polygon

 In reply to this post by Gadgetmind On 15.03.2019 17:39, Gadgetmind wrote: > Railways used to be designed with straight and curves, and it made them > uncomfortable and restricted speeds, and ditto "loop the loop" on roller > coasters as the sudden changes in acceleration (high jerk) caused neck > injuries. > > Then along came what I still call clothoid curves, but wikipedia prefers > Euler Spirals. Ditto, I learned about clothoid curves 35 years ago. A railway track with immediate transition from a straight segment with zero curvature to 1/r in a circular segment will introduce a sudden sideways acceleration. Not good. Railway tracks and motorways therefore use clothoid transition curves. I agree with those who say this does not matter for 3d printing though. Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Rounded Polygon

Open this post in threaded view
|

## Re: Rounded Polygon

 Very nice research! I am already waiting for the episode 2 :)Is there any mechanism other than assert() to generate warning or error messages?  Assert seems kind of clumsy, since it prints the test, and it is always a fatal error instead of a warning.  Yes, you may insert an echo. I usually do something like this:let( x = test? echo(a,b,c) 0 : 0 )As echo() accepts HTML codes you are able to use a background color similar to the OpenSCAD warnings. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Rounded Polygon

 Ronaldo wrote > Very nice research! I am already waiting for the episode 2 :) Maybe not as exciting as the first plot, but I did plot the shape of the curve as I varied the curvature parameter.  It changes so slightly that it's hard to see if I put too many curves on the graph, so I'm showing curvature parameters of just 0, 0.5, and 1.  What changes a lot is the location of p0 and p4.  For this case, I have set the tip of the rounded corner to be 2 units back from the corner.  The bezier curve intersects the edge of the right angle corner 4.5 units away from the corner when the curve parameter is 1 (red line), 7.5 units when the parameter is 0.5 (green line), and a whopping 22.6 units if you set the parameter to zero (blue line).  So choosing a smaller curvature parameter causes it to really vary the curvature slowly.  This I think makes those small values not very useful, since you are very likely to run out of room on your object for the curve.     > Is there any mechanism other than assert() to generate warning or error >> messages?  Assert seems kind of clumsy, since it prints the test, and it >> is >> always a fatal error instead of a warning. >> > > Yes, you may insert an echo. I usually do something like this: So with tagging I can get the color, but it's not going to be included in the warning count.  I normally find that all the warning message scroll off the message area due to the statistics report at the end.  Has anybody ever talked about adding a warning command to the language, or extending echo to have a warning flag that makes it count on the warning list? -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Rounded Polygon

Open this post in threaded view
|

## Re: Rounded Polygon

 This may be more graphs than anyone wants to look at, but I did an analysis of order 5 smoothing to see if it presented any obvious benefits.  Since there are now two parameters, it's more to look at.  I'm defining has h1 the location of P1 and P4 as the fraction of the distance away from the apex towards P0 and P5, and I define h2 as the fractional distance from the apex to P1 or P4.   In this case, unlike the previous plot the curvatures are calculated for the *scaled* roundovers that are shown on the left side.   It looks to me like the cases h2=0.5 and maybe h2=0.7 are the most promising, so focusing on those and comparing to the order 4 case I have the following: After examining these various plots I am hard pressed to see an obvious benefit to using order 5.  There is only one matter left to consider.  It turns out that if you like h2=0.7 you may be able to achieve a roundover in a shorter space by using order 5.  But note that this is only true for h1 values above about 0.4.  If h1 gets small then order 4 is much more efficient.   Here is a comparison of a few selected "nice" looking parameter sets, where d gives the location of p0 relative to the apex (so smaller is better).   So maybe the argument could be made for the blue curve, which gives d 5% smaller than the next best option.  But really it's not much difference. Again, it seems hard to justify using 5th order, and especially with the worsening behavior as the h1 parameter shrinks.   So have I beat this to death yet?   -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Rounded Polygon

 adrianv wrote > So have I beat this to death yet?   I realized that the curvature plots should really be done as arc-length vs curvature instead of Bezier parameter vs curvature.  The curves with larger parameter value have parameterizations that move very slowly near the end points, so my previous plots underestimate the slope of the curvature there. Also plotting based on arc-length makes it easier to understand the trade off of really long curves to shorter ones.  I can post updated plots if anybody actually wants to see them.   -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Rounded Polygon

 I would like to see them. I would expect a parametric slow down where the curvature is greater due to smaller norms of the parametric derivatives there. adrianv <[hidden email]> wrote: The curves with larger parameter value have parameterizations that move very slowly near the end points, so my previous plots underestimate the slope of the curvature there. Also plotting based on arc-length makes it easier to understand the trade off of really long curves to shorter ones.  I can post updated plots if anybody actually wants to see them.  _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org