Accurate Sine Wave PATH?

Asked by isnb

How do I draw a path that has the exact shape of a sine wave?

To clarify, I don't want to draw an approximation of sine wave, using the inaccurate hand/mouse movements. Rather, I would like to draw a sine wave (or control its properties) similar to the way I draw a circle, a rectangle, etc.

Is this possible in InkScape?

Question information

Language:
English Edit question
Status:
Answered
For:
Inkscape Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
isnb (member57140223) said :
#1

:-)

From http://www.inkscape.org/faq.php :

How can sine curves be made in Inkscape?

Inkscape includes an extension called Function Plotter. It can be used to create sine curves or any other function graphs. To access it, go to the Effects menu, and then the Render submenu. Other software, such as Xfig, KiG, or KSEG can also be used to create complex curves and then export to SVG for use in Inkscape.

Effects > Render > Function Plotter...

Now I have to figure out all the mind boggling input fields... :-)

Help would be appreciated.

Revision history for this message
Alvin Penner (apenner) said :
#2

- draw a rectangle, make sure that it is selected or highlighted
- click on Effects | Render | Function Plotter
- in the Function textbox, type sin(x)
- for y value of rectangle bottom, type -1
- for y value of rectangle top, type +1
- similarly you can customize the start and end x values to suit your taste.

The actual refresh, or update, process for the sine wave is not entirely clear to me, I find the most convenient thing is to simply delete the rectangle entirely and draw a new one, the Plotter routine will remember all your settings so you can simply hit Apply again, once you have a new empty rectangle selected.

Revision history for this message
isnb (member57140223) said :
#3

Thank you for your answer. It was very helpful for figuring out the myriad of options there and generating my first sine wave. However, the generated sine wave appears modulated, not on a straight line - and its amplitude far exceeds the dimensions of the rectangle. What am I doing wrong?

Here is a snapshot of what I received:

http://img75.imageshack.us/my.php?image=modulatedsinewavewl2.png

And here are the settings that I used to generate it:

http://img170.imageshack.us/my.php?image=modulatedsinewavedlgni1.png

Any idea why the generated sine wave appears like that?

Thanks!

Revision history for this message
isnb (member57140223) said :
#4

Ah! I think that I got it. :-)

Here is what I did:

1) I unchecked the "Multiply x-range by 2*pi" checkbox (and specified and End x-value of 360)

2) I increased the number of Samples from 8 to 128

3) I checked the "Isotropic scaling" checkbox.

I think that #3 was the most important one. It's so confusing... what does "Isotropic scaling" mean?

Revision history for this message
isnb (member57140223) said :
#5

This is really weird: the "Multiply x-range by 2*pi" checkbox is the one that effects the sine wave "modulation"... Why???

To better explain: If I check that "Multiply x-range by 2*pi" checkbox, then the sine wave draws around a perfectly horizontal line. Otherwise, it draws around another sine wave... Weird. What's the connection between modulation and changing the unit system to be radian based???

Revision history for this message
Alvin Penner (apenner) said :
#6

you are probably seeing the effects of what is known as "aliasing", which is what happens when you don't sample a signal fast enough to catch all the variations. Try using a smaller x range and a larger number of samples.

for example, start x = 0, end x = 2, check mark on multiply range by 2*pi, samples = 8 , will give you a well-behaved sine wave with exactly 2 full cycles.

Revision history for this message
Ian Gibbs (realflash-uk) said :
#7

This is more easily done with Effects -> Render -> Parametric Curves

Set the X-Function to t and the Y-Function to sin(t) and hit Live preview

This should generate a constant amplitude sine wave of length one cycle like you are expecting. To get two cycles, set End t-value to 2. After you close the dialogue, you can then play with stroke properties and resize the box to change the width and height of the rendered curve as you would expect.

Can you help with this problem?

Provide an answer of your own, or ask isnb for more information if necessary.

To post a message you must log in.