# Class SphereNet

java.lang.Object
uk.ac.starlink.ttools.plot2.geom.SphereNet

public class SphereNet extends Object
Calculates line segments forming longitude and latitude lines for a sphere around the data origin of a cube surface.

Since:
  15 Aug 2018
Author:
  Mark Taylor

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`SphereNet.Line3d`
Represents a set of 3-d points that can be joined together to make a grid line.

## Constructor Summary

Constructors
Constructor
Description
`SphereNet(CubeSurface surf)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`double`
`getDefaultRadius()`
Returns a reasonable radius for the sphere if none is explicitly specified.
`SphereNet.Line3d[]`
`getLatitudeLines(double dRadius, int nLat)`
Returns an array of line specifications representing lines of latitude.
`SphereNet.Line3d[]`
`getLongitudeLines(double dRadius, int nLon)`
Returns an array of line specifications representing lines of longitude.

### Methods inherited from class Object

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

## Constructor Details

### SphereNet

public SphereNet(CubeSurface surf)
Constructor.

Parameters:
  `surf` - surface on which grid lines will be specified

## Method Details

### getDefaultRadius

public double getDefaultRadius()
Returns a reasonable radius for the sphere if none is explicitly specified. The general idea is to have something that will be visible. If the data origin is within the visible region, then the largest sphere that will fit is used, otherwise it's a sphere for which at least part of the surface appears in the visible region.

Returns:
  reasonable radius for sphere in data units

### getLongitudeLines

public SphereNet.Line3d[] getLongitudeLines(double dRadius, int nLon)
Returns an array of line specifications representing lines of longitude.

Parameters:
  `dRadius` - radius in data units
  `nLon` - number of equally spaced great circles required; note this is half the number of meridians
Returns:
  `nLon`-element array of meridian specifiers

### getLatitudeLines

public SphereNet.Line3d[] getLatitudeLines(double dRadius, int nLat)
Returns an array of line specifications representing lines of latitude.

Parameters:
  `dRadius` - radius in data units
  `nLat` - number of equally spaced latitude lines in the north (or south) hemisphere; excludes the equator
Returns:
  `1+nLat*2`-element aray of parallel specifiers