# Class SkySurfaceTiler

java.lang.Object
uk.ac.starlink.ttools.plot2.layer.SkySurfaceTiler

public class SkySurfaceTiler extends Object
Understands the geometry of HEALPix tiles on a given SkySurface.

Note: this class is intended for use when the number of tiles is moderately small. Use of resources (memory, runtime?) is likely to be linear in the number of pixels at the required order appearing within the given surface.

Note: instances of this class are not safe for concurrent use from multiple threads.

Since:
  31 Mar 2016
Author:
  Mark Taylor

## Constructor Summary

Constructors
Constructor
Description
`SkySurfaceTiler(SkySurface surf, Rotation rotation, int hpxOrder)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`Polygon`
`getTileShape(long hpxIndex)`
Returns the shape of the given tile on the sky surface.
`boolean`
`isVisible(long hpxIndex)`
Indicates whether a given tile is considered to be visible on this tiler's plot surface.
`Set<Long>`
`visiblePixels()`
Returns a collection of pixels that are, or may be, visible on the surface.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SkySurfaceTiler

public SkySurfaceTiler(SkySurface surf, Rotation rotation, int hpxOrder)
Constructor.

Parameters:
  `surf` - sky surface
  `rotation` - additional rotation to apply to sky positions, not null
  `hpxOrder` - healpix order (0, 1, 2, ..)

## Method Details

### visiblePixels

public Set<Long> visiblePixels()
Returns a collection of pixels that are, or may be, visible on the surface. It may contain false positives, but an attempt is made to keep that number low. Calling this method is cheap (the same object is returned every time), and iterating over the result is a sensible way to find all the visible pixels.

Returns:
  an unmodifiable set of HEALPix indices for pixesl that are, or may be visible on the surface.

### isVisible

public boolean isVisible(long hpxIndex)
Indicates whether a given tile is considered to be visible on this tiler's plot surface. False positives are permitted (but preferably not too many). This should be faster to execute than `getTileShape(long)`.

Parameters:
  `hpxIndex` - HEALPix index
Returns:
  true iff tile may be visible

### getTileShape

public Polygon getTileShape(long hpxIndex)
Returns the shape of the given tile on the sky surface. The result is an approximation using integer graphics coordinates.

Calling this method is not an efficient way to determine whether a given pixel is visible; use `isVisible` instead.

Parameters:
  `hpxIndex` - HEALPix index
Returns:
  shape of indicated tile on graphics plane, or null if known to be invisible