astro
Class Aperture

java.lang.Object
  extended by astro.Aperture

public class Aperture
extends Object

This class uses an recursive algorithm to determine the area of intersection of a quadratic pixel with an arbitrary aperture. The algorithm can be outlined as follows:

This algorithm is rather efficient, as splitting is done only at the aperture's border, it's only weakness is that there is no way of exactely determining the error made, the maximum error is 0.5 times number of final splites times 1/2^(2nmax). Generally, this would be 1/2^(nmax+1). For a circular aperture at 0,0, radius 1 some test were made
 splitlevel     area                  error
        1        0.5                   0.2853981633974483
        3        0.71875               0.06664816339744828
        5        0.775390625           0.010007538397448279
        7        0.7843017578125       0.001096405584948279
       10        0.7853221893310547    7.59740663935915E-5
       15        0.7853977028280497    4.605693986192705E-7
       20        0.7853981612443022    2.1531461058543755E-9
 
For a circular aperture at 100.123, 100.574, diameter 10.23 adding all pixel areas and comparing it to the total known area of (5.115)^2*PI
 splitlevel     area                  error (dA/A)
        1        82.5                  0.0037067217670689635
        3        82.25                 6.784747207682614E-4
        5        82.1943359375         1.7091601457346031E-6
        7        82.1939697265625      2.7462799894133292E-6
       10        82.19415760040283     4.6054141904468886E-7
       15        82.19419539812952     6.823752873478206E-10
       20        82.19419545471465     6.056810455152413E-12
 
Default split level is 10. Note that Sun's implementation of the PathIterator of an ellipse only uses 4*6 points, making it unfavourable to use code like this:
 annulus = new Area(Ellipse2D(80., 80., 20., 20.);
    annulus.subtract(new Area(Ellipse2D(90., 90., 10., 10.)
 
Better results are acheived with two Apertures made from Ellipses and then manually subtract the results.


Nested Class Summary
static class Aperture.Circular
          Test the aperture class on a criculare aperture at center zero, zero and with radius 1.
static class Aperture.Circular100
          Test the aperture class on a circulare aperture at center 100, 100 and with radius 10, for x,y = 0->200
private  class Aperture.Pixel
          A subpixel of the CCD-pixel.
 
Field Summary
private  Shape aperture
          The aperture area.
private  int splitmax
          The maximum split level, defaults to 10.
 
Constructor Summary
Aperture(Shape pinhole)
          Constructs a new aperture class from a given Area that defines the aperture.
Aperture(Shape pinhole, int split)
          Constructs a new aperture class from a given Area that defines the aperture.
 
Method Summary
 double getInsideAperture(Point2D center)
          Returns the fractional part of the 1x1 pixel located at the central point passed to this argument within the aperture.
 double getInsideAperture(Point2D center, double width, double height)
          Returns the fractional part of the pixel with the given dimensions located at the central point passed to this argument within the aperture.
private  double intersect(Aperture.Pixel parent, Shape with)
          The recursive method that takes a pixel and returns its aperture weight or splits the pixel further if intersection is signaled and the maximum split level is not reached.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

splitmax

private int splitmax
The maximum split level, defaults to 10.


aperture

private Shape aperture
The aperture area.

Constructor Detail

Aperture

public Aperture(Shape pinhole)
Constructs a new aperture class from a given Area that defines the aperture. Fractional area inside the aperture for a pixel at a given position can now be retrieved with #getInsideApertue.


Aperture

public Aperture(Shape pinhole,
                int split)
Constructs a new aperture class from a given Area that defines the aperture. Fractional area inside the aperture for a pixel at a given position can now be retrieved with #getInsideApertue. If the argument is already an area, no new object is created.

Method Detail

getInsideAperture

public double getInsideAperture(Point2D center)
Returns the fractional part of the 1x1 pixel located at the central point passed to this argument within the aperture.

See Also:
#getInsideApertue(Point2D, double, double).

getInsideAperture

public double getInsideAperture(Point2D center,
                                double width,
                                double height)
Returns the fractional part of the pixel with the given dimensions located at the central point passed to this argument within the aperture.

See Also:
#getInsideApertue(Point2D)

intersect

private double intersect(Aperture.Pixel parent,
                         Shape with)
The recursive method that takes a pixel and returns its aperture weight or splits the pixel further if intersection is signaled and the maximum split level is not reached.