We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › map a line to a circle, polar coordinates
Page Index Toggle Pages: 1
map a line to a circle, polar coordinates? (Read 297 times)
map a line to a circle, polar coordinates?
Jul 11th, 2006, 12:31am
 
Hello

Trying to modify the example script on simple curves in the learning section to take a line from an image on screen and copy it into the form of a full circle with the aim of ultimately making a rectangular image into a circle / disc (sort of a polar coordinates effect).  No problem reiterating through the source image from top left to bottom right however I'm not to sure of the math to calculate the curve (which later will need to increase in radius pixel by pixel).  Seem to remember curves are culated with pi but beyond that I'm not sure where to start and simply keep getting diagonal lines.  Below is where I am (which does not work because vsa is a float) anyone able to help me with this math / whats the ratio to move down and accross by each loop??

a+
gar

PImage v_image;
float vsa;

void setup()
{
 size(700, 800);
 background(0);
 noLoop();
 
 //loadimage
 v_image = loadImage("rock1.jpg");
 image(v_image, 100, 20);
}



void draw()
{
 for(int i = 0; i < v_image.width; i++)
 {
   //vsa = (vsa - 0.5) * 1.8; //scale from -2 to 2
   //vsa = vsa * vsa;
   //if(vsa > 1) { vsa = 1; }

   copy(v_image, i + 1, 1, 1, 1, 100 + i, vsa, 1, 1);
 }
}
Page Index Toggle Pages: 1