Class SkySurfaceTiler
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.layer.SkySurfaceTiler
-
public class SkySurfaceTiler extends java.lang.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.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.java.util.Set<java.lang.Long>
visiblePixels()
Returns a collection of pixels that are, or may be, visible on the surface.
-
-
-
Constructor Detail
-
SkySurfaceTiler
public SkySurfaceTiler(SkySurface surf, Rotation rotation, int hpxOrder)
Constructor.- Parameters:
surf
- sky surfacerotation
- additional rotation to apply to sky positions, not nullhpxOrder
- healpix order (0, 1, 2, ..)
-
-
Method Detail
-
visiblePixels
public java.util.Set<java.lang.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 thangetTileShape(long)
.- Parameters:
hpxIndex
- HEALPix index- Returns:
- true iff tile may be visible
-
getTileShape
public java.awt.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
-
-