Generating objects using cartesian equations ?

Post questions on how to use or achieve an effect in Inkscape.
Torajio
Posts: 6
Joined: Tue Jun 14, 2011 12:28 am
Location: France

Generating objects using cartesian equations ?

Postby Torajio » Tue Jun 14, 2011 1:01 am

Hi :)
I have a problem : I've use Inkscape for years now, and I've never had anything to say about how wonderful it works for what I do.
BUT. I'm weird. And today, I need a peculiar something that I can't find anywhere. I'm drawing a map of a world I conceived in my mind, but this map is not just a map. It's based on a set of geometrical objects, such as a triangle and some lines. BUT I want to use two other objects which aren't rectangles, circles, or anything that is named anywhere. BRAND NEW :D !
I love mathematics, that's why I've took something like 10 minutes to describe them using their equation :
Image

Why do I show these equations ? Well, it's my problem : Is there a way to create an object based on its equation ?
Example : The object 3x + 2y + 1 = 0 would display a line. (x-2)² + (y-3)² = 5² would display a circle.

Just asking, that would help a lot since I can't create an object that looks like what I want, it has to be really exact. The feature I'm looking for would avoid me looking for thousands exact point to get something really really precise ^^"

User avatar
tomh
Posts: 218
Joined: Sat Feb 14, 2009 10:14 pm

Re: Generating objects using cartesian equations ?

Postby tomh » Tue Jun 14, 2011 3:24 am

Extensions-> Render-> Function Plotter
Or.
Extensions-> Render-> Parametric Curves

should do what you want (I think)

Draw a rectanlge first, then open the extention(s) and enter your equation.

Torajio
Posts: 6
Joined: Tue Jun 14, 2011 12:28 am
Location: France

Re: Generating objects using cartesian equations ?

Postby Torajio » Tue Jun 14, 2011 4:11 am

Thanks for the answer, I did not know these features :) .
I tried the first one, but it only renders functions of the type y = f(x). The example of my first equation is an "ellipse" using three instead of two foci, and thus this isn't a function. It's the same for the second equation : not a function. Thus the Function Plotter cannot render these equations as is, and I don't even know how and if I could get back to y = f(x) functions which would render completely (would need two or three functions depending on the situations).

The Parametric Curves extension could be a solution, but this way I have to find the parametric equations for my objects. I've tried but didn't find anything technically valuable. I keep looking for it anyway :) .

User avatar
tomh
Posts: 218
Joined: Sat Feb 14, 2009 10:14 pm

Re: Generating objects using cartesian equations ?

Postby tomh » Tue Jun 14, 2011 9:34 am

You could also try one of the sugestions on this page:
http://en.wikipedia.org/wiki/Wikipedia: ... a_articles

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Generating objects using cartesian equations ?

Postby brynn » Tue Jun 14, 2011 11:10 am

Welcome to InkscapeForum!

I enjoy math too, but when I was in school and college, I was afraid of it. So I never got past Calculus, and only took that because it was a requirement for my degree. And I've long since forgotten most of that. Oh if only we could start life with the wisdom we gain by living it!

So anyway, I only generally follow your problem, and probably can't give you any helpful comments. But I'm curious :mrgreen: I understand that the equation describes an object. And I understand x and y, and cartesian coordinates. But what is R?

I was doing some quick research via Wikipedia, and found "cartesian oval". Is that anything similar to what you're doing? The article does give a sample equation, and it looks somewhat similar to yours (stressing "somewhat"), but doesn't contain or define R. (http://en.wikipedia.org/wiki/Cartesian_oval)

User avatar
GAngus
Posts: 83
Joined: Tue Oct 13, 2009 8:41 am
Location: NY

Re: Generating objects using cartesian equations ?

Postby GAngus » Tue Jun 14, 2011 10:15 pm

Explore the use of "GeoGebra"..... @ Geogebra.org
Another open source application that may do what you want.

Torajio
Posts: 6
Joined: Tue Jun 14, 2011 12:28 am
Location: France

Re: Generating objects using cartesian equations ?

Postby Torajio » Tue Jun 14, 2011 10:54 pm

tomh & GAngus: I already have a representation of my objects which can be seen here with different parameters examples (I used Giac-Xcas). I was looking for a feature that would allow me to create them and edit their parameters directly in Inkscape, instead of using another program and manually layering the render.

brynn: Well, it's quite simple. I based my first equation on the definition of an ellipse, which is "the locus of all points of the plane whose distances to two fixed points add to the same constant" (from Wikipédia). So if we consider A and B the two foci of the ellipse, and M a point on the ellipse, then we have MA + MB = k, with k > 0 which is arbitrary defined.
Now I decided to consider three foci, A, B and C. Thus I have MA + MB + MC = k. Then I just expressed the lengths MA, MB and MC as seen in the equation given in my first post. the R of my equation is merely the k constant, since k seemed odd to me, and I choose R as analogy to the equation of a circle (which is only an ellipse with a single focus).
To put it all in a nutshell, I generalised the equation of a circle to a "n-ellipse", an ellipse with n foci, and kept the notation R(adius) to name the constant :) .

As this feature doesn't seem to exist yet, do someone think it would be useful, or my case is too marginal to consider working on it xD ?

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Generating objects using cartesian equations ?

Postby brynn » Thu Jun 16, 2011 10:25 am

Thanks for explaining, Torajio.

As far as the artist community goes, I don't think such a feature would get much use. But there are a few other extensions used by several different fields of science (I'm lumping mathematics into the science category here) that I doubt artists use much either. (i.e. - L System, Parametric Curves, Function Plotter, 3D Polyhedron, et al) (I absolutely love the Spirograph extension!) Personally I think it would be a nice addition to Inkscape, provided it would contain instructions and hopefully examples (for most of us who don't have serious math skills, lol).

That said, if there are any other programs out there, which provide such a feature, I'm guessing that developers would not take much interest. But if Inkscape were the only program offering this, I'm guessing it would more worthwhile.

I wonder if such a feature could be added to the Function Plotter? I know you said your is not a y=f(x), but isn't it still a function of sorts? Or would it fall into a different category?

chriswww
Posts: 383
Joined: Fri Nov 19, 2010 3:04 pm

Re: Generating objects using cartesian equations ?

Postby chriswww » Thu Jun 16, 2011 12:31 pm

x^2 + y^2 = r^2
becomes
f(x)=sqroot(r^2 - y^2)
But you only get half a circle as squares and square roots always produce positive result, so you mirror the result by f(x)=-sqroot(r^2 - y^2).
And you can do more fun things like antidifferentiate it several times so becomes an object with more than 3 dimensions, or apply matrix transformations, etc.
There's a firefox extension where you enter function in url bar and it produces svg plot.
The point of using inkscape for svg is to have human input into it to produce more than just calculated diagram/art...if all you need is some mathematics to generate basic svg shapes that fit a specific problem domain, it shouldn't be too difficult to generate the svg in scripting language of choice or a math/science package like "R", which can also generate the plots (and svg too if memory serves correct.) For the most part inkscape is not a particularly good tool for any precise mathematical work.

enon013
Posts: 6
Joined: Tue Jan 12, 2010 8:44 pm
Contact:

Re: Generating objects using cartesian equations ?

Postby enon013 » Fri Jul 08, 2011 9:50 pm

Explore the use of "GeoGebra"..... @ Geogebra.org
Another open source application that may do what you want.

Wow, amazing tool.
It would be very nice to have similar features integrated on Inkscape

GAngus do you know if GeoGebra is able to export in a vector format?

User avatar
GAngus
Posts: 83
Joined: Tue Oct 13, 2009 8:41 am
Location: NY

Re: Generating objects using cartesian equations ?

Postby GAngus » Fri Jul 08, 2011 11:45 pm

Yes, (but a qualified, yes)

I tried a couple tests, for you.

I was able to "export" a file created by GeoGebra, both as an SVG and an EPS.
They each opened easily in Inkscape as a grouped object .

From there, I was able to "ungroup" each one into it's individual objects.
From there I guess you could... "rearrange" them, if desired but, you would
still not have any 'mathematical' control other than graphically (vector) being able to
edit it as you would any other Inkscape file.

GeoGebra seems to have ALL the math control YOU could possibly need with creating
your "maps" (as mentioned in your 1st post) so, perhaps, once you have done all the precision stuff in GeoGebra you could load THAT into Inkscape and finish it up there ?
Adding colors, text, etc....... and end up with' the best of both worlds'.

angus

chriswww
Posts: 383
Joined: Fri Nov 19, 2010 3:04 pm

Re: Generating objects using cartesian equations ?

Postby chriswww » Mon Jul 18, 2011 1:53 am

ok..but i also want gaussian plots (3d functions), with tweening frame animation capability. seriously, inkscape is not a graphing package..not with dynamic update anyway.
but maybe you could explain a bit more about the needs. specifically, the interplay between the map as a whole and this function plot. why does the function need to be continuously (?) tweaked in the life of this svg?

Torajio
Posts: 6
Joined: Tue Jun 14, 2011 12:28 am
Location: France

Re: Generating objects using cartesian equations ?

Postby Torajio » Fri Jul 22, 2011 2:50 am

There is no real need to have a dynamically updated object. It would be fun as well. The need is to have a tool which allows to create an SVG object directly in the file using implicit plotting, instead of using another software. Even if I finally did it, but that's not very accurate. For the use I made of it, accuracy was actually not needed.
For other uses, such as truly mathematical ones, this could be a good point to have a simple "native" plugin. But thinking about it, if someone really NEEDS an implicit plotted curve, one shall already have a program to do so...
Well, I think we already have a function plotter, why not an implicit plotter so people like me can use it for weird uses :) ?

thewildotter
Posts: 2
Joined: Tue Sep 25, 2018 4:47 am

Re: Generating objects using cartesian equations ?

Postby thewildotter » Tue Sep 25, 2018 6:01 am

Torajio,
I found a free embroidery software package called Ink/Stitch which is an extension of InkScape. I have been using the Extensions>Render>Parametric Equations feature of Inkscape to generate single top thread, running stitch artwork for that embroidery. I was a Physics Major in college and I too appreciate artwork which comes exactly from equations. Basically, I have used conversions from polar coordinates to Cartesian coordinates to generate phase synchronized spiral equations which I then plug into Inkscape. I have done lots of these searching for ones that look good in embroidery. Some of the good ones have three fold radial symmetry so I still have some of my breadcrumbs lying around in case I decide that I want to implement them on my embroidery machine. One of them is visually close to what you have described. If you really love math a lot you can probably poke around with my expressions to see if you can use them to get a clue about how to express what you really want in parametric equations. I suspect that some of the trig transforms can get you from your equations to mine and vice-versa if you remove the spiral tweaks out of mine. I leave that as your challenge unless you want more hints.

This picture has the full set of values I used to generate the three lobed flower on the left with the Parametric Extension of Inkscape. You do have to draw a rectangle and select it before you push the button as others have mentioned. Notice that the outer silhouette has curves less tightly focused than the inner silhouette. You may want to see what intermediate turn of the spiral most closely matches your most symmetric triad of "ellipses" just for grins and giggles. I think you can get to the Parametric Equations you really want with some good mathematical thinking about what numbers control what features with my screenshot hint. Math is beautiful. Inkscape is a great artwork platform.

I have also expressed Quartic Bezier functions in parametric equations to generate some other embroidery artwork. A thing of beauty is a joy forever. Good luck on your quest. Oops ! My screenshot is to big for this forum so I have attached an svg file for you to look at and the Parametric Curves screen has the following values in order: 60.0, 420.0, -9.0, 9.0, -9.0, 9.0, 999, no boxes checked anywhere, and X-Function:
((t/(pi*pi*pi))+sin(3*t))*((cos(t)/(pi)))*2
and Y-Function:
((t/(pi*pi*pi))+sin(3*t))*((sin(t)/(pi)))*2
Draw a square, select your square, and hit the Parametric Curves "Apply" button.
____________________
thewildotter
ellipse3fold.svg
(85.23 KiB) Downloaded 169 times



ellipse3fold.pdf
(21.28 KiB) Downloaded 161 times

thewildotter
Posts: 2
Joined: Tue Sep 25, 2018 4:47 am

Re: Generating objects using cartesian equations ? Guide for Parametric Equations

Postby thewildotter » Fri Sep 28, 2018 7:53 am

Parametric Equations Guide (ca 2012)

I have found this nice :geek: guide by ragstian in old threads. It has several equation variations which are instructive. They demonstrate a lot about what equations achieve what shapes. :D :o
________________________
thewildotter


Return to “Help with using Inkscape”