REGION Specification Language

The production rules below form the complete specification for the grammar that generates region descriptions. The Parser.compile() method creates instances of Regions from strings of this language.

The so called (disjunctive) normal form is a specification that contains references to regions and convexes only. Any region object created by the API, when formatted into text will always produce a normal form string representation. For example, a rectangle

RECT LATLON 37 -109.55  41 -102.05

becomes the intersection of four halfspaces in a convex

REGION CONVEX
  0 0 1 0.60181502315204827
  0 0 -1 -0.65605902899050728
  0.94234983075993228 -0.33462934190941329 0 0
  -0.97796579112795223 0.20876520635268361 0 0
  

Notation

{...}*   0 or more instances of the syntax element between the braces
{...}2   exactly 2 instances of the syntax element between the braces
{...}3+  3 or more instances of the syntax element between the braces
null    the empty string

R        is degrees in arcminutes.
D        is a real number between -1 and 1

regionSpec REGION {areaSpec}* | areaSpec
areaSpec circleSpec | rectSpec | polySpec | hullSpec | convexSpec
convexSpec CONVEX J2000 {ra dec D}*
    | CONVEX LATLON {lat lon D}*
  | CONVEX CARTESIAN {x y z D}*
  | CONVEX {x y z D}*
    | null
rectSpec RECT J2000 {ra dec}2
    | RECT LATLON {lat lon}2
  | RECT CARTESIAN {x y z }2
circleSpec CIRCLE J2000 ra dec R
    | CIRCLE LATLON lat lon R
  | CIRCLE CARTESIAN x y z R
polySpec POLY J2000 {ra dec}3+
    | POLY LATLON {lat lon}3+
  | POLY CARTESIAN {x y z}3+
hullSpec CHULL J2000 {ra dec}3+
    | CHULL LATLON {lat lon}3+
  | CHULL CARTESIAN {x y z}3+