public class Clip extends Sampler
Consider an original image of data in some projection and a new map of an overlapping region with some projection, coordinate system, etc. Assume that the flux within a given pixel in the original image is constant over the area of the pixel. The flux within each pixel in the new map should be the integral of the flux in the region occupied by each pixel in the map.
The instance methods of this class are not thread-safe, however it is possible to generate a separate Clip sampler object for each thread to resample the same input image.
Developed by Tom McGlynn, NASA/GSFC October 3, 2002
Modifier and Type | Field and Description |
---|---|
protected double |
drizzArea
Drizzle Area
|
protected double |
drizzOffset
Drizzle offset
|
protected int |
recurse |
Constructor and Description |
---|
Clip() |
Modifier and Type | Method and Description |
---|---|
double |
clipRectPoly(double xmin,
double ymin,
double xmax,
double ymax,
double[] polyx,
double[] polyy)
This method provides an interface to the simplified
Sutherland-Hodges clipper for use outside the sampling context.
|
static double |
convexArea(int n,
double[] x,
double[] y)
Calculate the area of a convex polygon.
|
java.lang.String |
getDescription()
Get the description of this component.
|
java.lang.String |
getName()
Get the name of this component.
|
double[] |
lastX() |
double[] |
lastY() |
protected static void |
printVert(int n,
double[] x,
double[] y,
java.lang.String label)
Debugging routine that prints a list of vertices.
|
int |
rectClip(int n,
double[] x,
double[] y,
double[] nx,
double[] ny,
double minX,
double minY,
double maxX,
double maxY)
Clip a polygon by a non-rotated rectangle.
|
void |
sample(int pix)
Implement the sample function of the Sampler class.
|
void |
samplePixel(int pix,
double[] x,
double[] y)
Sample a single map pixel.
|
void |
setDrizzle(double drizzle)
Set the drizzle factor for sampling
|
void |
setInput(Image in)
Set the input image for the sampling
|
void |
setIntensive(boolean intensive) |
void |
setOutput(Image outImage)
Set the output image for the sampling
|
double |
weight()
Return the weight associated with the last sampling.
|
protected int recurse
protected double drizzOffset
protected double drizzArea
public void setOutput(Image outImage)
Sampler
public java.lang.String getName()
Component
public java.lang.String getDescription()
Component
public void setIntensive(boolean intensive)
public void setInput(Image in)
Sampler
public void setDrizzle(double drizzle)
drizzle
- The drizzle factor should range from 0 to 1 and
indicates the length of the side of the pixel
inside the original image pixel in which the
flux is assumed to be contained.public static double convexArea(int n, double[] x, double[] y)
n
- The number of vertices in the polygon.x
- The x coordinates of the verticesy
- The y coordinates of teh verticespublic int rectClip(int n, double[] x, double[] y, double[] nx, double[] ny, double minX, double minY, double maxX, double maxY)
n
- Number of vertices in the polygon.x
- X values of verticesy
- Y values of verticesnx
- X values of clipped polygonny
- Y values of clipped polygonminX
- Minimum X-valueminY
- Minimum Y-valuemaxX
- MAximum X-valuemaxY
- Maximum Y-valueprotected static void printVert(int n, double[] x, double[] y, java.lang.String label)
n
- The number of vertices in the polygonx
- X coordinatesy
- Y coordinatespublic void sample(int pix)
public double weight()
public void samplePixel(int pix, double[] x, double[] y)
x
- The x values of the corners of the pixel [4]y
- The y values of the corners of the pixel [4]public double clipRectPoly(double xmin, double ymin, double xmax, double ymax, double[] polyx, double[] polyy)
polyx
- The vertices of an (assumed convex) polygon.polyy
- The vertices of an (assumed convex) polygon.public double[] lastX()
public double[] lastY()