Author |
Message |
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Double Origin Graphing
I graphed a = 2b: So I was in a lecture about maths a few days ago and heard about these wacky things called Double Origin Graphs, where there are two origins (funnily enough) and each point on the graph is defined by the angle between each point (eg 1,2) would be a point 1 rad from origin 1 and 2 rads from origin 2. "linear functions" in this coordinate system are to the form a = nb+c, where a is angle from O1, b is angle from O2, n is any real number and c is a constant (also any real number), and come out as crazy patterns. Anyway, I decided to create something to draw graphs for double origin coordiant systems. Currently this project doesnt do recursion (and it should, as the graphs get way more funky as the revolutions tick on), or constants (which it also should, but i was neglectful). It graphs a function not as a line but as a cloud. I did this because drawing lines is for pansies and real men like their graphs with a healthy spattering of dithered neon glow, but mostly cause line drawing wasn't working , and it looked cooler this way anyway. Oh yeah, drawing is broken when O2 is under and to the left of O1. You'll get a nice black area between them. Anyone wanting to get recursion going, fix the draw function or put in a line drawing mode, be my guest. EDIT: oh yeah, quick note, there's no real text editing (read: no backspace) and I didn't put error handling in. don't try and go ahead with NaNs in the fields, it doesn't like that. YOU WILL NEED LOVE TO RUN THIS! GO AND GET IT FROM LOVE2D.ORG!I'm posting this here cause I figure you're nerds and know lua and a fair bit of maths, so you might want to have a look. The less inquisitive might just like the pictures it makes. Either way, enjoy. EDIT NEW VERSION: a = 5b, 100 recursions at a slight rotation if i remember correctly Now it actually does what it's meant to rather than creating crazy bloomy things, but I'll leave the other one there for those that want a toy. http://drop.io/doubleorigin
Last edited by Geti on Tue Jun 01, 2010 11:27 am, edited 1 time in total.
|
Thu Apr 15, 2010 6:23 am |
|
|
Daman
Joined: Fri Jan 26, 2007 3:22 am Posts: 1451
|
Re: Double Origin Graphing
what. so an entire sector of the graph isn't working? that is a pretty big discrepancy
also if you used C++ & SDL it'd be a thousand times faster
|
Thu Apr 15, 2010 12:06 pm |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Double Origin Graphing
Indeed it would. It would also take me longer to work out the bugs and I wouldn't have been able to make it in as short a time as I did. also it isnt an entire sector. it draws fine for every other orientation of the two origins (afaik). Still, feel free to debug or tweak. I'm just showing what I could do with some (wasted ) spare time in the afternoon after hearing about these things a few days ago. I'd be keen to see what someone with a heck of a lot more experience than me could do with it, in particular the recursion (with angles larger than 2pi rads being used), which is the main missing feature.
|
Thu Apr 15, 2010 12:14 pm |
|
|
alphagamer774
Joined: Wed Feb 10, 2010 4:06 am Posts: 1294 Location: Comox, BC, Canada
|
Re: Double Origin Graphing
That REALLY looks like an invisible high powered laser weapon was fired at the upper left hand corner...
|
Fri Apr 16, 2010 3:20 am |
|
|
FuzzyMelon
Joined: Sat Mar 13, 2010 5:52 am Posts: 229
|
Re: Double Origin Graphing
alphagamer774 wrote: That REALLY looks like an invisible high powered laser weapon was fired at the upper left hand corner... That's exactly what I was thinking! It's like the covenant energy sword!
|
Fri Apr 16, 2010 3:54 am |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Double Origin Graphing
So wait, it looks like something... invisible? I am confuse. Daman have you had a look at it or were you just hassling my lack of compiled language?
|
Fri Apr 16, 2010 4:58 am |
|
|
FuzzyMelon
Joined: Sat Mar 13, 2010 5:52 am Posts: 229
|
Re: Double Origin Graphing
@ geti - well the blade portion does. I'm algebra literate so I contributed the only way i knew how: piggy back style. edit: illiterate
Last edited by FuzzyMelon on Fri Apr 16, 2010 9:03 am, edited 1 time in total.
|
Fri Apr 16, 2010 5:10 am |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Double Origin Graphing
It was intended more at alpha than you, but fair enough in any case. I might construct a more verbose explanation of what it actually is in a while.
|
Fri Apr 16, 2010 8:49 am |
|
|
Daman
Joined: Fri Jan 26, 2007 3:22 am Posts: 1451
|
Re: Double Origin Graphing
yeah actually I was going to re-code it in SDL really quick after I checked it out but I haven't even touched it yet but before even looking at it Quote: each point on the graph is defined by the angle between each point how does this make any sense how is an angle going to define distance with the coordinates (pi, 2pi) do you mean it'd be pi distance from point 1(in what direction?) and 2pi distance from origin 2? would it be multiple points as there are more than one point that are those distances from the origins? actually now that I think about it you probably mean bipolar graphing? what you're talking about sounds a lot like it
|
Fri Apr 16, 2010 1:50 pm |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Double Origin Graphing
Nope, just angles. Quick, dirty explanation. Each coordinate is defined by the angles made by the line to the point from each origin. in order to do recursion, you'd need to do it the real way, and calculate the x and y coordinates for each point where the function is true rather than calculating how true it is for each x and y value (the way it's currently doing it)
|
Sat Apr 17, 2010 1:55 am |
|
|
Dr. Evil
Joined: Mon Aug 17, 2009 3:00 am Posts: 242 Location: The Great White North
|
Re: Double Origin Graphing
That... Is really cool.
Son, I am Impress.
|
Sat Apr 17, 2010 3:48 am |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Double Origin Graphing
Quick edit to fix a segfault on OSX, caused by trying to edit out of bounds imagedata, because I made assumptions about the way love handled image data (origin was treated as 1,1 rather than 0,0 because lua starts at 1 for most things. general negligence). No other changes though. Glad you like it Dr. Evil.
|
Sat Apr 17, 2010 7:36 am |
|
|
alphagamer774
Joined: Wed Feb 10, 2010 4:06 am Posts: 1294 Location: Comox, BC, Canada
|
Re: Double Origin Graphing
Well, I really couldn't give less of a ♥♥♥♥ about it's application in mathematics, but this is as cool as fractals when it comes to pictures!
|
Sun Apr 18, 2010 6:52 pm |
|
|
Daman
Joined: Fri Jan 26, 2007 3:22 am Posts: 1451
|
Re: Double Origin Graphing
Geti wrote: Nope, just angles. Quick, dirty explanation. Each coordinate is defined by the angles made by the line to the point from each origin. in order to do recursion, you'd need to do it the real way, and calculate the x and y coordinates for each point where the function is true rather than calculating how true it is for each x and y value (the way it's currently doing it) That still doesn't make any sense. Are you saying it's just drawing a line starting at each origin, and the point is where the lines drawn by those two angles/origins intersect? How would recursion come into play at all? Adding 2pi to either angle?
|
Thu Apr 22, 2010 9:39 pm |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Double Origin Graphing
no, recursion is also doing it for angles >2pi, for example 12 and 6 rads would also be a point. Yes it is essentially graphing a huge series of intersections. It makes a huge difference to the product, especially for polynomial etc equations.
|
Fri Apr 23, 2010 7:28 am |
|
|
|