Searching \ for '[OT]: graphics: how many Bezier controls to make 1' in subject line. ()
Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=how+many+bezier
Search entire site for: 'graphics: how many Bezier controls to make 1'.

Exact match. Not showing close matches.
'[OT]: graphics: how many Bezier controls to make 1'
2000\10\09@080247 by

Hi,

I am doing something that requires an animation curve which must be
sinusoidal. I can only use Bezier curves to set up the graph. I have come
up with a solution that uses two Bezier curves to make a 1/2 sinus but the
result is not 'sinusoidal' enough. The Bezier control I am using uses the
pivot + 2 points input method (the 2 control points are on a line that
passes through the pivot point on the curve being traced).

Am I trying something impossible here ? Assuming that I'd use enough <any>
curves I could approximate a sinus, no ?

thanks,

Peter

--

Obviously, with enough Bezier's you can make a 'practically perfect' sine
curve.

Just imagine that you make your Bezier's straight lines and then use a
piecewise linear approximation to the sine.

Ugly, but it proves the point.

The neat thing about Bezier's is you have quite a bit of control about the
shape, if you can figure out the correct control points. This should let you
get the same accuracy with far fewer segments than straight lines would
allow for.

Good luck figuring out the math.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

{Original Message removed}
To my knowledge, beziers are based on a largely polynomial equation.  If you
want to produce a sinewave using a bezier, the closer you want to be, the more
beziers (or the more complex each bezier needs to be)

According to Don Lancaster, a Bezier curve is a type of cubic spline.  He has
quite a bit of information on cubic splines and bezier curves here:
http://www.tinaja.com/cubic01.html
This page includes a PDF in which "Jim Fitzsimmons TEX tutorial shows an eight
step approximation to a full sinewave that uses Bezier cubic splines. Each
spline curve fits 45 degrees and exactly matches value and slope at end points."
here:
http://www.tinaja.com/glib/bezsine.pdf

It seems as though Don's column is no longer included in poptronics (the
incestuous marriage of Electronics Now and Popular Electronics).  Anyone know
and care to comment why?

"Peter L. Peres" wrote:
{Quote hidden}

--

What program are you trying to draw in?  I would approach this by drawing an
EXACT sinusoid in a real CAD program like AutoCad, then porting it to the
other graphics program.

-- Lawrence Lile
{Original Message removed}
At 08:36 AM 10/10/00 -0500, you wrote:
>What program are you trying to draw in?  I would approach this by drawing an
>EXACT sinusoid in a real CAD program like AutoCad, then porting it to the
>other graphics program.

Or, in Adobe Illustrator 7.0+, just open the below very simple file as a
parsed EPS, lock it, then trace over it with Bezier curves to your required
accuracy.

Best regards,

----
%!
% draw half a sine wave

72 72 dup scale % make it 1" x 1"
/inc 0.1 def  % increment in degrees
/x 0 def
/y 0 def
/stx 1 def
/sty 1 def

stx sty moveto
0 inc 180
{
/x exch def
/y x sin def
} for
0 setlinewidth
stroke
%showpage

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Spehro Pefhany --"it's the network..."            "The Journey is the reward"
speffinterlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Contributions invited->The AVR-gcc FAQ is at: http://www.bluecollarlinux.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

>good luck with the math

Gee, thanks ;-). Except there is no math, this is a graphical input system
and I need to drag & twist until the curve looks sinus and then the
program animates using the curve. This is not my idea, I assure you. There
may be another way to do it but I haven't figured it out yet.

I have gotten reasonably nice results with only 2 Beziers, with the pivots
at the peaks of the 1/2 sinus. I have tried a third at the zero crossing
but it made things worse. Oh, well.

Peter

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

>According to Don Lancaster, a Bezier curve is a type of cubic spline.  He
>has quite a bit of information on cubic splines and bezier curves here:
>http://www.tinaja.com/cubic01.html

Thanks !

Peter

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

>what program

It's an animation program that was never meant to be used the way I am using
it ;-). Your idea is good but if there had been a way to do that I would not
have posted the question ... and yet there might be a way. I'll try to get
hold of the people who wrote this thing.

thanks,

Peter

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

>EPS sinus algorythm

Thank you for the algorythm, but that is not an option. Anyway nice of you
to post Fort^H^H^H^H Post Script source files inline. It reminds people of
things ;-)

Peter

PS: My latest saying:

Unix has a lot of four letter commands with twenty page apologies.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

I imagine the system will import postscript files.  If so, then you can make it
into a math problem.  Figure out the bezier(s) mathematically, describe them in
postscript, and import them into your program.

If your program doesn't import postscript (or HPGL, or another generic ascii
vector language), then bang your head against a wall repeatedly, and chant,
"It's not worth the pain!  It's not worth the pain!"

"Peter L. Peres" wrote:
{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
use listservmitvma.mit.edu?body=SET%20PICList%20DIGEST

At 09:52 AM 10/12/00 -0400, you wrote:
>I imagine the system will import postscript files.  If so, then you can
make it
>into a math problem.  Figure out the bezier(s) mathematically, describe
them in
>postscript, and import them into your program.
>
>If your program doesn't import postscript (or HPGL, or another generic ascii
>vector language), then bang your head against a wall repeatedly, and chant,
>"It's not worth the pain!  It's not worth the pain!"

Yes, using the simple program I posted to generate an almost perfect sine
as short line segments and tracing over it,  I was able to nicely describe a
1/2 sine-wave in Illustrator using about 8 bezier curves, in about 2 minutes.
Error was maybe 0.1%.

The coefficients could be extracted from the generated Postscript code (the
.ai file is a kind of Postscript with some predefined shortcuts) but that
would take a lot more time (for me anyway) and there are doubtless some
strange scale factors that would be involved.

As far as actually optimizing bezier curves to match a sine wave, this could
be done either mathematically (maybe!) or numerically, and I'd suggest the
latter. Any kind of program that will do multi-dimensional optimization
should be able to do it. I'd still start with Illustrator to pick a good
starting point for where the Bezier curves should begin and end.

Best regards,

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Spehro Pefhany --"it's the network..."            "The Journey is the reward"
speffinterlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Contributions invited->The AVR-gcc FAQ is at: http://www.bluecollarlinux.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
use listservmitvma.mit.edu?body=SET%20PICList%20DIGEST

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...