|  | 
 
  
    | 
      
        |  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();
 }
 }
 |  
            |  |  |  |  
  
    | 
      
        | 
          
            | 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
 |  
            |  |  |  |  
 |