Drawing a spring(gluon) by Parametric Curve

Post questions on how to use or achieve an effect in Inkscape.
showinc
Posts: 3
Joined: Thu Dec 08, 2016 5:29 pm

Drawing a spring(gluon) by Parametric Curve

Postby showinc » Thu Dec 08, 2016 5:39 pm

Hi,
I want to draw a spring(gluon) by 'Parametric Curve'.
I clicked 'Create rectangles & squares' :tool_rectangle: and created a rectangle(square), and
clicked 'Select & transform objects' :tool_selector: two times.

First I followed Beenwu's method.
http://gfif.udea.edu.co/web/tiki-index. ... e=Inkscape
https://www.youtube.com/embed/YKrzqHrWlKc
Menu ’Extensions’->’Render’->’Parametric Curves...’->’Range and Sampling’ tab,
the values and checkboxes from above are like this.
-3.1
33.4
off
-10.0
10.0
-10.0
10.0
200
off
t+cos(3*t)
3*sin(3*t)
off
off
off

Then I pressed 'apply'.
The generated image was the attached file. It didn't suit my hope.

Next I tried according to Joshua Albert's parameter.
http://home.strw.leidenuniv.nl/~albert/ ... nments.pdf
Now the values and checkboxes from above are like this.
0.0
4.5
on
-10.0
10.0
-10.0
10.0
200
off
( t+cost(3*(t-pi)) ) /10
sin(-3*t) /2
off
off
off

Then I pressed 'apply', but this time a message box appeared.
Inkscape has received additional data from the script executed. The script did not return an error, but this may indicate the results will not be as expected.

Traceback (most recent call last):
File "param_curves.py", line 249, in <module>
e.affect()
File "/usr/share/inkscape/extensions/inkex.py", line 221, in affect
self.effect()
File "param_curves.py", line 233, in effect
self.options.drawaxis)))
File "param_curves.py", line 95, in drawfunction
x0 = f1(t_start)
File "<string>", line 1, in <lambda>
NameError: global name 'cost' is not defined

How can I draw a spring by this way?
Thanks.
Attachments
gluon.png
gluon.png (9.09 KiB) Viewed 3000 times
Last edited by showinc on Sat Dec 10, 2016 2:45 am, edited 1 time in total.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Drawing a spring(gluon) by Parametric Curve

Postby Lazur » Thu Dec 08, 2016 8:55 pm

Hi.

That attached image looks ok by sight.
You only need to change its attributes from filled with grey to no fill but stroke in the fill and stroke tab (Shift+Ctrl+F).

(another example)

showinc
Posts: 3
Joined: Thu Dec 08, 2016 5:29 pm

Re: Drawing a spring(gluon) by Parametric Curve

Postby showinc » Sat Dec 10, 2016 2:35 am

Thank you, Lazur.
I could draw a spring by courtesy of you.
My goal is to draw a spring along an arbitrary path.
I cut one cycle of this spring, and by
'Path Effect Editor' -> '+Add' 'Pattern Along Path'
put it along a path, then the generated image is as shown.
I've adjusted this image:
Fuse nearby ends : 500.00
But still joins are eyesores.
I want to draw more smoothly.
What way is the best to achieve this?
Can I cut the original spring at any desired point other than nodes?
Attachments
spring_along_path.png
the generated image
spring_along_path.png (18.67 KiB) Viewed 2948 times
spring_nodes.png
spring_nodes.png (43.24 KiB) Viewed 2948 times

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Drawing a spring(gluon) by Parametric Curve

Postby Lazur » Sat Dec 10, 2016 5:11 am

If you cut the loop at the bottom where it has horizontal tangents, the pattern along path lpe could generate better results.
However right now the used samples in the parametric curve extension is not plotting nodes exactly there, I would adjust that first.

On another hand it is possible to plot the desired curve in a circular shape by one go.
related topic,
related clipart.


The spirograph extension can also draw hipotrochoids alike with good settings.

Image

showinc
Posts: 3
Joined: Thu Dec 08, 2016 5:29 pm

Re: Drawing a spring(gluon) by Parametric Curve

Postby showinc » Mon Dec 12, 2016 11:13 am

Thank you, Lazur.
I found a good choice of parameters in ’Parametric Curves...’ :
-1.0
3.0
on
-10.0
10.0
-10.0
10.0
200
off
t/12+cos(t/4)
sin(t/4)
off
off
off
These parameters give us an exact one cycle of spring.
By using it and putting it along a path, I could draw a smooth spring curve as desired.

And in the first post I mistyped in Joshua Albert's parameters.
The correct parameters giving us an exact one cycle of spring are :
1.0
5.0
on
-10.0
10.0
-10.0
10.0
200
off
( t/12+cos(t/4-pi) ) /10
sin(-t/4) /2
off
off
off
Attachments
one_cycle.png
one_cycle.png (1.55 KiB) Viewed 2872 times
smooth_spring_curve.png
smooth_spring_curve.png (14.88 KiB) Viewed 2872 times


Return to “Help with using Inkscape”