cds.astro
Class Region

java.lang.Object
  extended by cds.astro.AbstractRegion
      extended by cds.astro.Region
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CircularRegion, ConvexRegion, EllipticalRegion, ZonalRegion

public class Region
extends AbstractRegion
implements java.io.Serializable

Region is a Factory which implements the AbstractRegion and the constructors of the various regions.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class cds.astro.AbstractRegion
centroid, DISJOINT, INCLUDES, INTERSECTS, IS_PARTOF, maxrad, minrad
 
Method Summary
 double area()
          Compute area of a Region (see dedicated class)
static Region box(Astroframe frame, Coo center, double width, double height)
          Define a box from center + width + height
 int checkCircle(Coo point, double r)
          The method checkCircle verifies the intersection of Region with Circle.
 boolean checkCoo(Coo point)
          The method checkCoo verifies a point lies within a region.
static Region circle(Coo center, double radius)
          Circular Region is defined from a center + region.
static Region ellipse(Astroframe frame, Coo center, double londim, double latdim)
          Define an Elliptical region.
static Region ellipse(Coo center, double a, double b, double pa)
          Tilted elliptical region.
static Region polygon(Coo[] vertices)
          Define a polygonal region (convex).
static Region rotatedBox(Coo center, double dim1, double dim2, double posangle)
          Define a rotated box from center + sides.
 java.lang.String toString()
          Edition of a Region (see dedicated class)
static Region zone(Astroframe frame, Coo center, double width, double height)
          Zonal region defined from a center and extensions.
static Region zone(Astroframe frame, double lon0, double lon1, double lat0, double lat1)
          Define a zonal region.
 
Methods inherited from class cds.astro.AbstractRegion
check1, checkQbox
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

toString

public java.lang.String toString()
Edition of a Region (see dedicated class)

Specified by:
toString in class AbstractRegion

area

public double area()
Compute area of a Region (see dedicated class)

Specified by:
area in class AbstractRegion
Returns:
Surface of the region, in square degrees (3602/pi for the whole sphere)

checkCoo

public boolean checkCoo(Coo point)
The method checkCoo verifies a point lies within a region.

Specified by:
checkCoo in class AbstractRegion
Parameters:
point - a point we want to check
Returns:
0 (=DISJOINT) if ouside the region, 1 (INTERSECTS) if inside.

checkCircle

public int checkCircle(Coo point,
                       double r)
The method checkCircle verifies the intersection of Region with Circle.

Specified by:
checkCircle in class AbstractRegion
Parameters:
point - a position
r - radius (degrees)
Returns:
DISJOINT / INTERSECTS / INCLUDES. for no intersection / overlap / cercle fully included

circle

public static Region circle(Coo center,
                            double radius)
Circular Region is defined from a center + region. No frame argument, the circle has no orientation...

Parameters:
center - the center of the box.
radius - the radius of the circular region.
Returns:
CircularRegion.

box

public static Region box(Astroframe frame,
                         Coo center,
                         double width,
                         double height)
Define a box from center + width + height

Parameters:
frame - the frame in which the box is expressed. May be null (implies a unique coordinate frame)
center - the center of the box.
width - width of the box, in degrees
height - height of the box, in degrees
Returns:
Convex region.

rotatedBox

public static Region rotatedBox(Coo center,
                                double dim1,
                                double dim2,
                                double posangle)
Define a rotated box from center + sides. Notice that the first dimension is the height when posangle=0

Parameters:
center - the center of the box.
dim1 - first angular size of the box, in degrees
dim2 - second angular size of the box, in degrees
posangle - position angle of side1 in degrees, measured clockwise from North.
Returns:
Convex region.

polygon

public static Region polygon(Coo[] vertices)
Define a polygonal region (convex). No frame argument, the polygon has no orientation... A bad region is returned in case of non-convex result.

Parameters:
vertices - of the polygon. The number of vertices should be at least 3 (for a triangle).
Returns:
Convex region.

zone

public static Region zone(Astroframe frame,
                          double lon0,
                          double lon1,
                          double lat0,
                          double lat1)
Define a zonal region. A zone is defined in some frame, delimited by 2 parallel small circles (limits in declination or latitude) and eventually by 2 great circles (limits in right ascension or longitude). Notice that the order of lon0/lon1 is important, e.g. (359,1) extends over 2deg, while (1,359) extends over 358deg.

Parameters:
frame - Astroframe in which the limits are defined. May be null when a single frame is involved.
lon0 - Minimal longitude in specified frame
lon1 - Maximal longitude in specified frame
lat0 - Minimal latitude in specified frame
lat1 - Maximal latitude in specified frame
Returns:
Zonal region

zone

public static Region zone(Astroframe frame,
                          Coo center,
                          double width,
                          double height)
Zonal region defined from a center and extensions.

Parameters:
frame - Astroframe in which the limits are defined. May be null when a single frame is involved.
center - the center of the zone
width - width of the box, in degrees (between 0 and 360)
height - height of the box, in degrees (between 0 and 180)

ellipse

public static Region ellipse(Astroframe frame,
                             Coo center,
                             double londim,
                             double latdim)
Define an Elliptical region. A spherical ellipse is projected as an ellipse on the tangential plane.

Parameters:
frame - Astroframe in which the ellipse is defined. May be null when a single frame is involved.
center - Position of the ellipse center
londim - the dimension of the ellipse along longitude
latdim - the dimension of the ellipse along latitude
Returns:
Ellipse region

ellipse

public static Region ellipse(Coo center,
                             double a,
                             double b,
                             double pa)
Tilted elliptical region. A spherical ellipse is projected as an ellipse on the tangential plane.

Parameters:
center - Position of the ellipse center
a - the major diameter, in degrees
b - the minor diameter, in degrees
pa - position angle of major axis, in degrees, measured North to East.
Returns:
Ellipse region