Forum

Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.





Pages: [1]
Author Topic: Polar graphic Geometry,
OllyR
Newbie
Posts: 7
Permalink
Post Polar graphic Geometry,
on: June 12, 2013, 21:33
Quote

Inspired by Sandys flickr account, and on the hunt for a new arduino project, i decided to build a polargraph to play with!

I have built this as a project for myself, so want to understand what it is doing, and to have "done it myself".

http://letsmakerobots.com/node/35846
(Newest posts went on the top, so you would need to start at the bottom), and you might be able to read through my progress, from nothing, to something.
this is as far as i have got (pretty much)

i now would like to approach the drawing phase a little differently.
I currently have to manually spin the image 135 degrees in "gimp", and upload it to the processing data folder, with the "bottom" in the top left hand corner.
also, this technique does NOTHING to compensate for the effect of the images being narrow at the top, and short and fat at the bottom.

How could i get rid of this skewing effect? i guess i might need to completly rework my program?
Or can i add "compensation" in there.
Or can i somehow detect the edge of an image in processing, and "scan" across an upright image at 45 degrees?

suggestions greatly appreciated!

Cheers
Ol

sandy
Administrator
Posts: 1317
Permalink
sandy
Post Re: Polar graphic Geometry,
on: June 13, 2013, 00:11
Quote

Hey Olly - good to see your page! Jumping straight into cmyk is impressive - and pretty decent results too. I guess your input "image" is still an upside down thing, with the detail turned 45 degrees though? I wasn't quite clear how it was generated from the page.

I think your issue is that you are treating the polar grid as if it simply a rotated version of a cartesian grid, and it isn't, almost at all. A 45 degree rotate will work for a couple of pixels out of each drawing, but the rest will be off, potentially by miles, primarily because the polargraph's axes are both curved - there are no straight lines in there at all. The angles of intersections of each axis line (each concentric circle) is almost never 90 degrees, so any system that maps a set of pixels from a cartesian coordinates system will be very distorted. The fact that pixels are tall and narrow at the top of the drawing surface, and short and fat at the bottom, is evidence of that.

The solution is re-rasterisation. That's essentially what the polargraph controller software does. Create a bunch of circles emanating from each of the motor points, then compile a list of coordinates of all the places that the circles intersect. For each point of intersection, work out the cartesian position on the desired image, and pull out a brightness value from the pixel at those coordinates.

A 2D array does not have to have every row the same length, but you do need to know the size of it beforehand so you can declare it, so that limits it's usefulness. I don't ever do any array handling in the arduino code - it is so much easier to do that stuff with hashmaps and lists in Processing.

The norwegian pixel re-rasterises an input file in the arduino though, so you could have a look at that - https://github.com/euphy/polargraph_server_mega/blob/master/rove.ino

Basically the same thing, except it doesn't compile a big list of pixels before it starts drawing - it essentially moves the pen to a certain spot on the surface, and knowing where the image is, and what size it is supposed to be, it works out the position of the pen over the image, then pulls out the pixel (density), and does a squiggle based on that density. Because memory is limited on the arduino, it never stores info before or afterwards, but then I do have the luxury of having an SD card with the image file on it.

Overall, if you are thinking of any linear transformation or translation between a cartesian bitmap and the native "polargraph" coordinates, then you will always have very bendy images. Bite the bullet and break out the pythagoras 🙂

good luck!

sn

OllyR
Newbie
Posts: 7
Permalink
Post Re: Polar graphic Geometry,
on: June 22, 2013, 13:19
Quote

your analysis is exactly correct Sandy.
Ive rotate the images in Gimp (photoshop for ubunutu)
i recognise the problems, But getting my head around the polargraphic coordinates is another matter all together!

Pages: [1]
Mingle Forum by cartpauj
Version: 1.0.34 ; Page loaded in: 0.023 seconds.