0
$\begingroup$

I have found here similar questions for other languages like SVG but they don't quite answer this particular question.

I want to find a good approximation of the first 90 degrees of a sine curve with bezier in postscript. I have found the full 360 curve, I tried to subdivide it using a known algorithm but the result is not exactly 90 degrees. Then by try and error I got something acceptable (blue curve over the red one) but when I scale it horizontally, it doesn't fit with the sine curve (black curve) so I am confuse about if a scalable bezier approximation is possible.

Encapsulated postscript of my intended approximation of a sine curve

This is the PostScript code:

1 0 0 setrgbcolor

% Full 360 degree period curve
0 0  moveto
0.4673 3.4641 0.5327 -3.4641 1 0 curveto
stroke

% 90 degree aprox
0 0 1 setrgbcolor
0 0 moveto
0.116825 0.866025 0.20 1.0  0.25 1 curveto
stroke

% Same as above but scaled 4x horizontally
0 0  moveto
0.4673 0.866025  0.8 1  1 1 curveto
stroke

I will appreciate any hint.

$\endgroup$

1 Answer 1

0
$\begingroup$

After exploring closer, the wrong curve turns to be the blue one, created after the answer to this question in the math community:

https://math.stackexchange.com/questions/4235124/getting-the-most-accurate-bezier-curve-that-plots-a-sine-wave

Although it is possible to approximate the whole sine period with a single bezier segment, it is not recommended and there is nothing wrong to use two segments, as recommended in the following link:

http://www.telegraphics.net/sw/info/sinehow.html

That's what I did so I considere this question solved.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.