FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Bugs
   Software Bugs
(Moderator: fry)
   accuracy error in positioning?
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: accuracy error in positioning?  (Read 419 times)
metaphorz


accuracy error in positioning?
« on: Nov 6th, 2004, 10:22pm »

A student noticed this interesting anomoly. Copy
and paste this (either 68 or 69 versions of
Processing), run, and you'll notice that some circles
are perfectly circumscribed, but there are minor
visual errors in most of them (i.e., the circle edge
will overlap a side of a square). Looks like it could
be 1 or perhaps 2 pixels of error.
 
 
int numOfObjects = 40;//60;
int attributes[][];
int newAttributes[][];
 
void setup()
{
  attributes = new int[numOfObjects][9];
  newAttributes = attributes;
  size(800, 800);
 
  for (int i = 0; i < numOfObjects; i++)
  {
    attributes[i][0] = (int) random(0, width); // center x coordinate
    attributes[i][1] = (int) random(0, height); // center y coordinate
    attributes[i][2] = 200; // red saturation
    attributes[i][3] = 200; // green saturation
    attributes[i][4] = 200; // blue saturation
    attributes[i][5] = 30; // rectangle width
    attributes[i][6] = 30; // rectangle height
    attributes[i][7] = 30; // ellipse width
    attributes[i][8] = 30; // ellipse height
  }
}
 
void loop()
{
  ellipseMode(CENTER_DIAMETER);
  rectMode(CENTER_DIAMETER);
 
  for (int i = 0; i < numOfObjects; i++)
  {
 
  }
 
  //attributes = newAttributes;
 
  for (int i = 0; i < numOfObjects; i++)
  {
    fill(attributes[i][2], attributes[i][3], attributes[i][4]);
    rect(attributes[i][0], attributes[i][1], attributes[i][5], attributes[i][6]);
    push();
    translate(attributes[i][0], attributes[i][1]);
    push();
    ellipse(0, 0, attributes[i][7], attributes[i][8]);
    pop();
    pop();
  }
}
 
fjen

WWW
Re: accuracy error in positioning?
« Reply #1 on: Nov 7th, 2004, 7:55pm »

might be related to this ellipse-bug:
 
http://processing.org/discourse/yabb/board_Proce55ing_software__bugs_action_display_num_1096391864.html
 
/F
 
metaphorz


Re: accuracy error in positioning?
« Reply #2 on: Nov 8th, 2004, 1:21am »

Yes, I think you are right, after trying out
your code. BTW, nice/small zoom capability
on the 2nd example!
 
-pf
 
Pages: 1 

« Previous topic | Next topic »