04 January 2011

It works! IT WORKS!!

Here is a pdf of an eighth
import processing.pdf.*;

int segments = 8;
int radii = 20;
float radiispacing = 20;

float horizon = 80;

float horizondistance(float rf) {
return sqrt(rf*(rf - horizon)) 
    + 0.5* horizon * log(rf) - 0.5 * horizon * log(horizon) 
    + horizon * log(1 + sqrt(1 - horizon/rf));
}
float sqrt_grr(float rf){
  return 1.0 / sqrt(1 - horizon/rf);
}



void setup()
{ 
  size(400,600,PDF, "filename.pdf");
//  size(400,600);
  background(255);
  
}
  
void draw(){
  translate(width/2,height-radiispacing);
  noFill();  
  line(-PI/segments*horizon,0,PI/segments*horizon,0);
  for(float radius = horizon + radiispacing;
            radius < horizon + radii*radiispacing; 
            radius += radiispacing) {
    println(radius + " " + horizondistance(radius) + " " + radius*sqrt_grr(radius));
    ellipseMode(RADIUS);
    //ellipse(0,radius*sqrt_grr(radius)-horizondistance(radius),2,2);
    //ellipse(0,
    //    radius*sqrt_grr(radius)-horizondistance(radius),
    //    radius*sqrt_grr(radius),
    //    radius*sqrt_grr(radius));
    arc(0,
        radius*sqrt_grr(radius)-horizondistance(radius),
        radius*sqrt_grr(radius),
        radius*sqrt_grr(radius),
        -PI/2.0-PI/segments/sqrt_grr(radius),
        -PI/2.0+PI/segments/sqrt_grr(radius)
        );
   }
  exit();
}

1 comment: