Draw a "perfect" heart shape using Parametric Curves
Draw a "perfect" heart shape using Parametric Curves
Last edited by ragstian on Sat Jan 24, 2015 1:45 am, edited 3 times in total.
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar
( ͡° ͜ʖ ͡°)
RGDS
Ragnar
Re: Draw a perfect heart shape using Parametric Curves
Works like a charm...
Very useful, thank you !
Didier
Very useful, thank you !
Didier
- flamingolady
- Posts: 687
- Joined: Wed Jun 10, 2009 1:40 pm
Re: Draw a perfect heart shape using Parametric Curves
hi Ragnar,
I was able to make the perfect heart - yay, love this.
Of course I am getting errors in doing the growing heart - can't figure out what I'm doing wrong (oh lawdy, here we go again). Here's the numbers I'm using for growing:
13*cos(t)-5*cos(2*t)-2*cos(3*t)-cos(4*t)))*exp(t0.001)
(16(sin(t)*sin(t)*sin(t)))*exp(t*0.001)
I'm getting back an error notice. any ideas?
EDIT: here's the error notice:
Traceback (most recent call last):
File "param_curves.py", line 249, in <module>
e.affect()
File "C:\Program Files (x86)\Inkscape\share\extensions\inkex.py", line 215, in affect
self.effect()
File "param_curves.py", line 233, in effect
self.options.drawaxis)))
File "param_curves.py", line 70, in drawfunction
f1 = eval('lambda t: ' + fx.strip('"'))
File "<string>", line 1
lambda t: 16(sin(t)*sin(t)*sin(t)))*exp(t*0.001)
SyntaxError: invalid syntax
thanks,
dee
I was able to make the perfect heart - yay, love this.
Of course I am getting errors in doing the growing heart - can't figure out what I'm doing wrong (oh lawdy, here we go again). Here's the numbers I'm using for growing:
13*cos(t)-5*cos(2*t)-2*cos(3*t)-cos(4*t)))*exp(t0.001)
(16(sin(t)*sin(t)*sin(t)))*exp(t*0.001)
I'm getting back an error notice. any ideas?
EDIT: here's the error notice:
Traceback (most recent call last):
File "param_curves.py", line 249, in <module>
e.affect()
File "C:\Program Files (x86)\Inkscape\share\extensions\inkex.py", line 215, in affect
self.effect()
File "param_curves.py", line 233, in effect
self.options.drawaxis)))
File "param_curves.py", line 70, in drawfunction
f1 = eval('lambda t: ' + fx.strip('"'))
File "<string>", line 1
lambda t: 16(sin(t)*sin(t)*sin(t)))*exp(t*0.001)
SyntaxError: invalid syntax
thanks,
dee
Re: Draw a perfect heart shape using Parametric Curves
Hi dee
Yes I got an idéa (or two);
- 1. First of all my guide might be a little "unpolished" - sorry for that - it's now updated - go download again.
- 2. Secondly you got two "typos" in your equation for the y-Function.
( Unfortunately - Inkscape (and programming in general) are quite unforgiving dealing with those kind of errors )
Errors with missing characters in red; (13*cos(t)-5*cos(2*t)-2*cos(3*t)-cos(4*t)))*exp(t*0.001)
To find such errors start reading the "tail" (last part) of the error message for clues.
Try this;
("Cut and paste" the blue text directly from this page)
x-Function; (16*(sin(t)*sin(t)*sin(t)))*exp(t*0.01)
y-Function; (13*cos(t)-5*cos(2*t)-2*cos(3*t)-cos(4*t))*exp(t*0.01)
Set;
start t-value; 0
end t-value; 50
x-value of rectangle's left;-250
x-value of rectangle's right; 250
y-value of rectangle's bottom;-210
y-value of rectangle's top; 210
Samples; 1000
Stroke on original rectangle to; 0.5 px.
Some examples of what the "regular" heart can be used for;
Click image for larger version.
Twist of "Family bumper sticker" - popular here in the states;
Click image for larger version.
Guess how many kids in our family?
A clue here; Kids
Good Luck Drawing Hearts!
RGDS
Ragnar
Yes I got an idéa (or two);
- 1. First of all my guide might be a little "unpolished" - sorry for that - it's now updated - go download again.
- 2. Secondly you got two "typos" in your equation for the y-Function.
( Unfortunately - Inkscape (and programming in general) are quite unforgiving dealing with those kind of errors )
Errors with missing characters in red; (13*cos(t)-5*cos(2*t)-2*cos(3*t)-cos(4*t)))*exp(t*0.001)
To find such errors start reading the "tail" (last part) of the error message for clues.
Try this;
("Cut and paste" the blue text directly from this page)
x-Function; (16*(sin(t)*sin(t)*sin(t)))*exp(t*0.01)
y-Function; (13*cos(t)-5*cos(2*t)-2*cos(3*t)-cos(4*t))*exp(t*0.01)
Set;
start t-value; 0
end t-value; 50
x-value of rectangle's left;-250
x-value of rectangle's right; 250
y-value of rectangle's bottom;-210
y-value of rectangle's top; 210
Samples; 1000
Stroke on original rectangle to; 0.5 px.
Some examples of what the "regular" heart can be used for;
Click image for larger version.
Twist of "Family bumper sticker" - popular here in the states;
Click image for larger version.
Guess how many kids in our family?
A clue here; Kids
Good Luck Drawing Hearts!
RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar
( ͡° ͜ʖ ͡°)
RGDS
Ragnar
Re: Draw a "perfect" heart shape using Parametric Curves
Nice tutorial Ragnar! However, if I would have to start from scratch with such an object, I would just use the Bézier tool to draw a rough version of either the left or right part of the heart. Then I would clone the path, flip it horizontally, and snap it to the other half. Modifying the original will then result in a nice symmetrical heart shape .
By the way, I just noticed how strange it is that the clones are not updated in real time — when I move a node of the original, the corresponding node of the clone is moved only after I release the original node. We can therefore actually snap a node of the original to a node of one of its clones — but after releasing it, the node of the clone moves to its new position and is therefore not connected to the original node anymore .
By the way, I just noticed how strange it is that the clones are not updated in real time — when I move a node of the original, the corresponding node of the clone is moved only after I release the original node. We can therefore actually snap a node of the original to a node of one of its clones — but after releasing it, the node of the clone moves to its new position and is therefore not connected to the original node anymore .
Re: Draw a "perfect" heart shape using Parametric Curves
Hi.
You should have stopped reading the tutorial after the second line!
Two first lines of the tutorial:
Ever tried to draw a “perfect heart” in Inkscape?
I can’t do it – your mileage might vary!
Doing it manually - with inferior result - I would have done it your way as well!
RGDS
Ragnar
Nice tutorial Ragnar! However, if I would have to start from scratch with such an object,
I would just use the Bézier tool to draw a rough version of either the left or right part of the heart.
Then I would clone the path, flip it horizontally, and snap it to the other half. Modifying the original will then result in a nice symmetrical heart shape .
You should have stopped reading the tutorial after the second line!
Two first lines of the tutorial:
Ever tried to draw a “perfect heart” in Inkscape?
I can’t do it – your mileage might vary!
Doing it manually - with inferior result - I would have done it your way as well!
RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar
( ͡° ͜ʖ ͡°)
RGDS
Ragnar
- flamingolady
- Posts: 687
- Joined: Wed Jun 10, 2009 1:40 pm
Re: Draw a "perfect" heart shape using Parametric Curves
Ragnar,
hmm, still can't quite get the growing heart, here's the latest denial:
Traceback (most recent call last):
File "param_curves.py", line 249, in <module>
e.affect()
File "C:\Program Files (x86)\Inkscape\share\extensions\inkex.py", line 215, 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>
TypeError: 'int' object is not callable
I've never been able to draw a perfect heart either, usually use Ailurus's method, but still have to get the ends to match, so this is a good method for me.
Ragnar - oh gee, 5 kids! wow, and 4 girls, you're outnumbered by women, lol (and they have beautiful hair and braids too). I do like your bumper sticker of hearts and your winged heart too.
hmm, still can't quite get the growing heart, here's the latest denial:
Traceback (most recent call last):
File "param_curves.py", line 249, in <module>
e.affect()
File "C:\Program Files (x86)\Inkscape\share\extensions\inkex.py", line 215, 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>
TypeError: 'int' object is not callable
I've never been able to draw a perfect heart either, usually use Ailurus's method, but still have to get the ends to match, so this is a good method for me.
Ragnar - oh gee, 5 kids! wow, and 4 girls, you're outnumbered by women, lol (and they have beautiful hair and braids too). I do like your bumper sticker of hearts and your winged heart too.
Re: Draw a "perfect" heart shape using Parametric Curves
Hi dee
Never give up!
You are (most likely) missing a "times operator" - " * " - multiplication sign!
Most likely after the first 16 in the x-Function - your line;
(16(sin(t)*sin(t)*sin(t)))*exp(t*0.01)
My line;
(16*(sin(t)*sin(t)*sin(t)))*exp(t*0.01)
Good Luck again!!
This again proves that I'am not an artist - it was supposed to look like two swans!!
RGDS
Ragnar
Never give up!
You are (most likely) missing a "times operator" - " * " - multiplication sign!
Most likely after the first 16 in the x-Function - your line;
(16(sin(t)*sin(t)*sin(t)))*exp(t*0.01)
My line;
(16*(sin(t)*sin(t)*sin(t)))*exp(t*0.01)
Good Luck again!!
your winged heart too.
This again proves that I'am not an artist - it was supposed to look like two swans!!
RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar
( ͡° ͜ʖ ͡°)
RGDS
Ragnar
- flamingolady
- Posts: 687
- Joined: Wed Jun 10, 2009 1:40 pm
Re: Draw a "perfect" heart shape using Parametric Curves
yep, that was the culprit. not sure how it happened though because I copied your text, oh well. Love the result of the growing hearts!
ok, I do see the swans now that you mentioned it. I think if the wings went a little closer to the heart that it would look a little more like a swan from the start. I'm never good with trying to figure these things out though, so I'm not a good judge of it!
thanks again,
dee
ok, I do see the swans now that you mentioned it. I think if the wings went a little closer to the heart that it would look a little more like a swan from the start. I'm never good with trying to figure these things out though, so I'm not a good judge of it!
thanks again,
dee
Re: Draw a "perfect" heart shape using Parametric Curves
Hi.
Glad you got it working!
The x-Function can be simplified to; 16*pow(sin(t),3)*exp(t*0.01)
Could not get it to work the first time I tried, not sure why.
RGDS
Ragnar
Glad you got it working!
The x-Function can be simplified to; 16*pow(sin(t),3)*exp(t*0.01)
Could not get it to work the first time I tried, not sure why.
RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar
( ͡° ͜ʖ ͡°)
RGDS
Ragnar
Re: Draw a "perfect" heart shape using Parametric Curves
Off topic:
Oh Ragnar, when you showed the photo of the braided ponytails, I somehow missed the caption ("our girls"). 4 girls -- my, my! And a son too, it looks like. What a nice family Wow Dee, look at you with all that complex math, lol! I love how you're always up for a challenge!
Basics - Help menu > Tutorials
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
- flamingolady
- Posts: 687
- Joined: Wed Jun 10, 2009 1:40 pm
Re: Draw a "perfect" heart shape using Parametric Curves
still off topic - yeah, I missed 'our girls' too, quite a nice family!
Brynn - I have no idea what it all means, totally forgot all the sine, cosine, stuff, it makes me crazy, but, I am able to copy the numbers, lol. Wish I understood more of which number makes the left part of the heart fat, vs which part makes it longer, which part is the right side, etc! But yes, I don't mind asking even if
I look foolish (why change it up at this point in life afterall, lol).
Brynn - I have no idea what it all means, totally forgot all the sine, cosine, stuff, it makes me crazy, but, I am able to copy the numbers, lol. Wish I understood more of which number makes the left part of the heart fat, vs which part makes it longer, which part is the right side, etc! But yes, I don't mind asking even if
I look foolish (why change it up at this point in life afterall, lol).
Re: Draw a "perfect" heart shape using Parametric Curves
I followed the instructions but when I hit apply nothing happened.
Re: Draw a "perfect" heart shape using Parametric Curves
Something should have happened.
You drew a rectangle, then if you applied the extension,
at least it got erased right?
So what if you click on the "view all"- icon? Can it be that you were zoomed out?
Or what if the stroke and fill is totally transparent/white that you use?
Switch to outlines only and see if there is anything on the canvas.
If neither works, try to use different sized rectangles for the extension -maybe you used a too small one?
Or you just typed in the right functions to be applied with a typo?
You drew a rectangle, then if you applied the extension,
at least it got erased right?
So what if you click on the "view all"- icon? Can it be that you were zoomed out?
Or what if the stroke and fill is totally transparent/white that you use?
Switch to outlines only and see if there is anything on the canvas.
If neither works, try to use different sized rectangles for the extension -maybe you used a too small one?
Or you just typed in the right functions to be applied with a typo?
Last edited by Lazur URH on Tue Oct 01, 2013 11:48 am, edited 2 times in total.
Re: Draw a "perfect" heart shape using Parametric Curves
Hi artgeek
When you say "nothing" happened do you mean you did not get a heart shape or no error messages etc?
Make sure the square box is selected. A very common mistake in using parametric curves is typing mistakes, ( I do them all the time!),
to avoid these try cut & paste the formula from the PDF file to the Inkscape. (or copy (CTRL-C) from this thread and paste (CTRL-V))
If you look further down in this post you will see that omitting just a multiplication sign in the x-Function input field causes this to fail.
Good Luck.
RGDS
Ragnar
When you say "nothing" happened do you mean you did not get a heart shape or no error messages etc?
Make sure the square box is selected. A very common mistake in using parametric curves is typing mistakes, ( I do them all the time!),
to avoid these try cut & paste the formula from the PDF file to the Inkscape. (or copy (CTRL-C) from this thread and paste (CTRL-V))
If you look further down in this post you will see that omitting just a multiplication sign in the x-Function input field causes this to fail.
Good Luck.
RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar
( ͡° ͜ʖ ͡°)
RGDS
Ragnar