POV-Ray : Newsgroups : povray.general : Bezier problem Server Time
2 Nov 2024 00:24:57 EDT (-0400)
  Bezier problem (Message 1 to 9 of 9)  
From: Sebastian Strand
Subject: Bezier problem
Date: 15 Apr 2000 12:27:07
Message: <38f8985b@news.povray.org>
Hi,

I'm making a macro that involves a bezier_spline prism. What I need to know
is how I should place the control points of a bezier spline to make it
resemble a quarter circle as closely as possible.

Just to clarify, this is how they points are placed:
O-------o

             o
             |
             |
             |
             O

Big O's are endpoints, small o's control points. If I place the control
points halfway to the corner I come pretty close to a circle, but I hope
there is a more mathematical way to do it, I'm not very fond of guessing :)








Post a reply to this message

From: John VanSickle
Subject: Re: Bezier problem
Date: 15 Apr 2000 19:38:19
Message: <38F9005F.7562EA25@erols.com>
Sebastian Strand wrote:
> 
> Hi,
> 
> I'm making a macro that involves a bezier_spline prism. What I need to know
> is how I should place the control points of a bezier spline to make it
> resemble a quarter circle as closely as possible.
> 
> Just to clarify, this is how they points are placed:
> O-------o
> 
>              o
>              |
>              |
>              |
>              O
> 
> Big O's are endpoints, small o's control points. If I place the control
> points halfway to the corner I come pretty close to a circle, but I hope
> there is a more mathematical way to do it, I'm not very fond of guessing :)

There is.  If r is the radius of the quarter circle, then the distance from
the little-o control points to its big-O control point will be:

  4/3*(sqrt(2)-1) * r

The spline will be an exact quarter circle.  Your spline might look like:

Hope this helps,
John
-- 
ICQ: 46085459


Post a reply to this message

From: Ron Parker
Subject: Re: Bezier problem
Date: 16 Apr 2000 00:04:26
Message: <slrn8fifha.1v7.ron.parker@linux.parkerr.fwi.com>
On Sat, 15 Apr 2000 19:50:55 -0400, John VanSickle wrote:
>There is.  If r is the radius of the quarter circle, then the distance from
>the little-o control points to its big-O control point will be:
>
>  4/3*(sqrt(2)-1) * r
>
>The spline will be an exact quarter circle.  Your spline might look like:

In the MetaFont Book, IIRC, Knuth states that it's impossible to create
a circle using Bezier curves.  Is this not true?

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
These are my opinions.  I do NOT speak for the POV-Team.


Post a reply to this message

From: Sebastian Strand
Subject: Re: Bezier problem
Date: 16 Apr 2000 10:48:33
Message: <38f9d2c1$1@news.povray.org>
"John VanSickle" <van### [at] erolscom> wrote in
news:38F9005F.7562EA25@erols.com...
> There is.  If r is the radius of the quarter circle, then the distance
from
> the little-o control points to its big-O control point will be:
>
>   4/3*(sqrt(2)-1) * r


Thanks, works perfectly.







Post a reply to this message

From: David Wilkinson
Subject: Re: Bezier problem
Date: 16 Apr 2000 12:51:42
Message: <s5mjfsk20eac3h8phevllib325mjcfeujn@4ax.com>
On 16 Apr 2000 00:04:26 -0400, ron### [at] povrayorg (Ron Parker) wrote:

>On Sat, 15 Apr 2000 19:50:55 -0400, John VanSickle wrote:
>>There is.  If r is the radius of the quarter circle, then the distance from
>>the little-o control points to its big-O control point will be:
>>
>>  4/3*(sqrt(2)-1) * r
>>
>>The spline will be an exact quarter circle.  Your spline might look like:
>
>In the MetaFont Book, IIRC, Knuth states that it's impossible to create
>a circle using Bezier curves.  Is this not true?

I also thought that it was impossible to get an exact circular arc represention
using Bezier curves, but I have just used John's expression to render a bezier
prism overlaid with a cylinder.  With a difference in radius of 0.001, using an
orthographic camera and AA I get a uniformly thick line of difference. So
experimentally anyway,  John's expression is good enough for me.

I have been faced with the problem in the past of a near approximation to a
circular arc using Bezier curves and your expression John, is a great help.
Thanks
David
dav### [at] hamiltonitecom
http://www.hamiltonite.com/


Post a reply to this message

From: John VanSickle
Subject: Re: Bezier problem
Date: 16 Apr 2000 21:57:14
Message: <38FA7273.A48417D5@erols.com>
Ron Parker wrote:
> 
> On Sat, 15 Apr 2000 19:50:55 -0400, John VanSickle wrote:
> >There is.  If r is the radius of the quarter circle, then the
> >distance from the little-o control points to its big-O control point
> >will be:
> >
> >  4/3*(sqrt(2)-1) * r
> >
> 
> In the MetaFont Book, IIRC, Knuth states that it's impossible to
> create a circle using Bezier curves.  Is this not true?

It is indeed impossible to create an entire circle with a single
Bezier curve.  However, the Bezier above creates a quarter of a
circle.  I did the math two or three years back, and it boiled
down to a constant radius over that quarter circle.

Regards,
John
-- 
ICQ: 46085459


Post a reply to this message

From: Ron Parker
Subject: Re: Bezier problem
Date: 16 Apr 2000 23:51:53
Message: <slrn8fl36d.2gg.ron.parker@linux.parkerr.fwi.com>
On Sun, 16 Apr 2000 22:09:55 -0400, John VanSickle wrote:
>Ron Parker wrote:
>> 
>> On Sat, 15 Apr 2000 19:50:55 -0400, John VanSickle wrote:
>> >There is.  If r is the radius of the quarter circle, then the
>> >distance from the little-o control points to its big-O control point
>> >will be:
>> >
>> >  4/3*(sqrt(2)-1) * r
>> >
>> 
>> In the MetaFont Book, IIRC, Knuth states that it's impossible to
>> create a circle using Bezier curves.  Is this not true?
>
>It is indeed impossible to create an entire circle with a single
>Bezier curve.  However, the Bezier above creates a quarter of a
>circle.  I did the math two or three years back, and it boiled
>down to a constant radius over that quarter circle.

Here's the quote I was looking for, from Chapter 3 of the MetaFont Book:

  For example, the four-point method can produce an approximate
  quarter-circle with less than 0.06% error; it never yields an
  exact circle, but the difference between four such quarter-
  circles and a true circle are imperceptible.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
These are my opinions.  I do NOT speak for the POV-Team.


Post a reply to this message

From: Diego Krota
Subject: Re: Bezier problem
Date: 19 Apr 2000 14:40:31
Message: <38FDFE63.35B303B3@geocities.com>
John VanSickle wrote:
> 
> Sebastian Strand wrote:
> >
> > Hi,
> >
> > I'm making a macro that involves a bezier_spline prism. What I need to know
> > is how I should place the control points of a bezier spline to make it
> > resemble a quarter circle as closely as possible.
> >
> > Just to clarify, this is how they points are placed:
> > O-------o
> >
> >              o
> >              |
> >              |
> >              |
> >              O
> >
> > Big O's are endpoints, small o's control points. If I place the control
> > points halfway to the corner I come pretty close to a circle, but I hope
> > there is a more mathematical way to do it, I'm not very fond of guessing :)
> 
> There is.  If r is the radius of the quarter circle, then the distance from
> the little-o control points to its big-O control point will be:
> 
>   4/3*(sqrt(2)-1) * r
> 
> The spline will be an exact quarter circle.  Your spline might look like:
> 
> Hope this helps,
> John
> --
> ICQ: 46085459
For my app, D-form (http://www.geocities.com/dkrota/D-form.html) I
searched for this formula but never found it.
Thanks!

Did you have also the formula for an half circle???

Regards

(---------------------------------------------------------------)
( Diego Krota   http://www.geocities.com/SiliconValley/Way/2419 )
(---------------------------------------------------------------)
(      Never do anything you wouldn't be caught dead doing      )
(---------------------------------------------------------------)


Post a reply to this message

From: Alessandro Falappa
Subject: Re: Bezier problem
Date: 25 Apr 2000 03:24:22
Message: <MPG.1363a74893d0fa42989680@news.povray.org>
In povray.general, ron### [at] povrayorg said:
> On Sat, 15 Apr 2000 19:50:55 -0400, John VanSickle wrote:
> >There is.  If r is the radius of the quarter circle, then the distance from
> >the little-o control points to its big-O control point will be:
> >
> >  4/3*(sqrt(2)-1) * r
> >
> >The spline will be an exact quarter circle.  Your spline might look like:
> 
> In the MetaFont Book, IIRC, Knuth states that it's impossible to create
> a circle using Bezier curves.  Is this not true?

Yes, taht is indeed sure but in a strict mathematical sense.

A bezier spline, which is a third degree polynomial, cannot closely 
approximate a circle segment, which is described by a second degree 
>rational< polynomial.

However the maximum error you have by approximating a circle segment with a 
bezier spline with John VanSickle control points configuration is of the 
order of 0.01 (I don't remember the exact value) which is should be 
unnoticeable to the eye for practical rendering purposes.

The only critical situation which comes to my mind is possible seaming 
cracks between cylinders or spheres and objects using bezier spline form.

Alessandro


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.