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 and I didn't put error handling in. don't try and go ahead with NaNs in the fields, it doesn't like that.
DROPBOX HERE
Double Origin Graphing
Double Origin Graphing
Last edited by Geti on Sat Apr 17, 2010 6:34 am, edited 1 time in total.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Double Origin Graphing
I don't understand any of the maths behind it, but it is interesting nonetheless.
Any chance of using colors instead of shades of gray?
Any chance of using colors instead of shades of gray?
When I write def I mean function.
Re: Double Origin Graphing
Well, yes. Currently it just draws the "cloud" based on how close a is to nb, where a is the angle to origin 1 and b is the angle to origin 2 (n is the coefficient you provide). without recursion, the biggest missing feature, you get no really interesting patterns though. eh.
what would you like for colours? like a gradient or something?
what would you like for colours? like a gradient or something?
Re: Double Origin Graphing
That looks really cool!
Never heard of double origin graphs before and a quick google search wasn't very helpful. What are they normally used for? Did you talk about triple origin graphs (then in 3d i think) or even n-origin graphs? Interesting stuff.
Never heard of double origin graphs before and a quick google search wasn't very helpful. What are they normally used for? Did you talk about triple origin graphs (then in 3d i think) or even n-origin graphs? Interesting stuff.
Re: Double Origin Graphing
We didn't talk about n or 3 origin graphs, it was more a passing reference than a discussion on the coordinate system, more about looking at things differently than anything. I found them pretty interesting though, so i'll probably expand this at some point.
I don't think they're actually used for anything, either. You could probably find uses if you tried. It's just another way of defining a point's location given reference points. you just need 2 of them.
I don't think they're actually used for anything, either. You could probably find uses if you tried. It's just another way of defining a point's location given reference points. you just need 2 of them.
- Thursdaybloom
- Citizen
- Posts: 81
- Joined: Mon Feb 15, 2010 3:43 am
- Location: Australia
Re: Double Origin Graphing
This crashes every time I try and use it. As it says generating graph Love closes ad I get the OSX "program has quit unexpectedly" message. Is this just me or have other OSX users had this happen?
-
- Prole
- Posts: 1
- Joined: Wed Apr 14, 2010 9:29 pm
Re: Double Origin Graphing
Me too. OS X 10.5.8 PPC, 0.6.2. Every time.Thursdaybloom wrote:This crashes every time I try and use it. As it says generating graph Love closes ad I get the OSX "program has quit unexpectedly" message. Is this just me or have other OSX users had this happen?
Re: Double Origin Graphing
Yeah. It crashes on my Mac too. Which is a problem, since I'm responsible for the Mac port
The issue is easily fixable in the Lua code itself: change the for loops in getgraph to go from 0 to 511, instead of 1 to 512. The changed version is how it should be anyway - graphics origins are generally at (0,0) - as 512 is out of bounds, and thus trying to access it, on Mac OS X at least, causes a segfault. This is probably something that should be checked for by LÖVE - setPixel naively trusts the coordinates it's passed, instead of doing any sort of bounds-checking. The fact that it only crashes on Mac OS X, however, confuses me.
The issue is easily fixable in the Lua code itself: change the for loops in getgraph to go from 0 to 511, instead of 1 to 512. The changed version is how it should be anyway - graphics origins are generally at (0,0) - as 512 is out of bounds, and thus trying to access it, on Mac OS X at least, causes a segfault. This is probably something that should be checked for by LÖVE - setPixel naively trusts the coordinates it's passed, instead of doing any sort of bounds-checking. The fact that it only crashes on Mac OS X, however, confuses me.
Re: Double Origin Graphing
Oh. I thought the imagedata coordinates would be consistent with lua's general use of 1 rather than 0 as a starting point, apologies anyone on OSX. I'll update the drop.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Double Origin Graphing
You never noticed the window starts at (0,0) as well?
Who is online
Users browsing this forum: No registered users and 1 guest