# Spherical.Htm.Trixel Class Reference

Trixel static methods operate on HtmID's mostly. More...

List of all members.

## Static Public Member Functions

static Int64 CartesianToHid20 (Cartesian v)
Convert a normalized Cartesian to a level 20 HtmID. if the paramater is a Cartesian.Nan, then 0, an invalid HtmID is returned (there are no integer NaNs).
static Int64 CartesianToHid (double x, double y, double z, int depth)
Convert a Cartesian coordinate to a HID.
static String XyzToHidName (double x, double y, double z, int depth)
Find the string representation of the HtmID to a given level of a unit vector.
static String ToString (Int64 hid)
Convert a HtmID to its textual representation.
static bool IsAncestor (Int64 grandpa, Int64 hid)
Decide whether or not a node in the tree of a given HtmID is an ancestor of another node.
static bool NameToTriangle (char[] name, out Cartesian c0, out Cartesian c1, out Cartesian c2)
Convert the location given by (x, y, z) to the symbolic text name of the HID WARNING: x, y, z are assumed to be normalized, so this function doesn't waste time normalizing.

Convert the named trixel to a triangle described by three vertices. The vertices are given by three arrays of three doubles. The coordinates of the triangles are given in the order (x, y, z) and so that the location is on the surface of a unit sphere.

static void ToTriangle (Int64 hid, out Cartesian a, out Cartesian b, out Cartesian c)
static bool IsValid (Int64 hid)
Decide if the given 64-bit integer is a valid HtmID.
static int ToName (char[] name, long hid)
Convert a 64-bit HID to a text desciption of the trixel.
static Int64 NameToHid (string sname)
Convert the trixel from text to 64 bit HID.
static Int64 Truncate (Int64 htmid, int level)
Truncate the HID to fewer bits The HID of a trixel implicitly contains the level of the trixel. When you need a lower level trixel that contains the trixel of the given HID, this function gives it to you. If the level of the given htmid is less than or equal to the desired level, then there is no change.
static Int64Pair Extend (Int64 htmid, int level)
Extend given HID to a desired level. The opposite of truncate. However, because there are many descendents, the result is a range of consecutive HIDs. The low and hi values are returned in the out variables.
static int LevelOfHid (Int64 htmid)
Returns the level number of an HID
Parameters:
 htmid The HID
Returns:
The level number or -1
.

## Public Attributes

const int TrixelNameLength = 32
Maximum number of characters in text descriptions Whenever character arrays are used to keep the text description of a trixel, they must be exactly eMaxNameSize characters long.

## Static Public Attributes

static readonly double Epsilon2 = 2.0e-8
This tolerance is used for comparing angles.
static readonly double Epsilon = 1.0e-14
This tolerance is used for comparing fractional roots.
static readonly double DblTolerance = 2.0 * Spherical.Constant.DoublePrecision
Twice the double precision tolerance.

## Detailed Description

Trixel static methods operate on HtmID's mostly.

operations needed to convert between location and HtmID several representations of a HtmID, and locations expressed in Cartesian, J2000 (ra/dec) geographic lat/lon space. Since functions in the Spherical assembly convert to and from J2000 or geographic coordinates, only XYZ is handled by this class

## Member Function Documentation

 static Int64 Spherical.Htm.Trixel.CartesianToHid20 ( Cartesian v ) ` [static]`

Convert a normalized Cartesian to a level 20 HtmID. if the paramater is a Cartesian.Nan, then 0, an invalid HtmID is returned (there are no integer NaNs).

Parameters:
 v
Returns:
64 bit HtmID

 static Int64 Spherical.Htm.Trixel.CartesianToHid ( double x, double y, double z, int depth ) ` [static]`

Convert a Cartesian coordinate to a HID.

Given a Cartesian coordinate and a level number, it returns the 64 bit HID. WARNING! x, y, z are assumed to be normalized, so this function doesn't waste time normalzing.

Parameters:
 x X coordinate of location y Y coordinate of location z Z coordinate of location depth The level of the HID
Returns:
64-bit HID

 static String Spherical.Htm.Trixel.XyzToHidName ( double x, double y, double z, int depth ) ` [static]`

Find the string representation of the HtmID to a given level of a unit vector.

The vector must be normalized.

Parameters:
 x double y double z double depth int
Returns:
text representation of HtmID

 static String Spherical.Htm.Trixel.ToString ( Int64 hid ) ` [static]`

Convert a HtmID to its textual representation.

Parameters:
 hid 64-bit HtmID
Returns:
The textual representation

 static bool Spherical.Htm.Trixel.IsAncestor ( Int64 grandpa, Int64 hid ) ` [static]`

Decide whether or not a node in the tree of a given HtmID is an ancestor of another node.

Parameters:
 grandpa 64-bit HtmID, candidate for ancestry hid 64-bit HtmID who is the potential descendant
Returns:
true if grandpa is an ancestor of hid

 static bool Spherical.Htm.Trixel.NameToTriangle ( char[] name, out Cartesian c0, out Cartesian c1, out Cartesian c2 ) ` [static]`

Convert the location given by (x, y, z) to the symbolic text name of the HID WARNING: x, y, z are assumed to be normalized, so this function doesn't waste time normalizing.

Convert the named trixel to a triangle described by three vertices. The vertices are given by three arrays of three doubles. The coordinates of the triangles are given in the order (x, y, z) and so that the location is on the surface of a unit sphere.

Parameters:
 name The text description of the trixel c0 The X coordinate c1 The Y coordinate c2 The Z coordinate
Returns:
true, if the conversion succeeded, false otherwise

 static void Spherical.Htm.Trixel.ToTriangle ( Int64 hid, out Cartesian a, out Cartesian b, out Cartesian c ) ` [static]`

Parameters:
 hid a b c

 static bool Spherical.Htm.Trixel.IsValid ( Int64 hid ) ` [static]`

Decide if the given 64-bit integer is a valid HtmID.

Parameters:
 hid 64-bit input number
Returns:
true if given number is a valid HtmID, false otherwise

 static int Spherical.Htm.Trixel.ToName ( char[] name, long hid ) ` [static]`

Convert a 64-bit HID to a text desciption of the trixel.

Parameters:
 name An array of HtmTrixel.eMaxNameSize (a const in this class) character The array is null terminated. hid The HID
Returns:
The size, or the length of the text

 static Int64 Spherical.Htm.Trixel.NameToHid ( string sname ) ` [static]`

Convert the trixel from text to 64 bit HID.

Parameters:
 sname The string with the text representation of the trixel.
Returns:
The 64 bit HID

 static Int64 Spherical.Htm.Trixel.Truncate ( Int64 htmid, int level ) ` [static]`

Truncate the HID to fewer bits The HID of a trixel implicitly contains the level of the trixel. When you need a lower level trixel that contains the trixel of the given HID, this function gives it to you. If the level of the given htmid is less than or equal to the desired level, then there is no change.

Parameters:
 htmid level
Returns:
HID of lower level trixel

 static Int64Pair Spherical.Htm.Trixel.Extend ( Int64 htmid, int level ) ` [static]`

Extend given HID to a desired level. The opposite of truncate. However, because there are many descendents, the result is a range of consecutive HIDs. The low and hi values are returned in the out variables.

Parameters:
 htmid HID to extend level New level to which to extend
Returns:
A pair of 64-bit HtmIDs

## Member Data Documentation

 readonly double Spherical.Htm.Trixel.Epsilon2 = 2.0e-8` [static]`

This tolerance is used for comparing angles.

 readonly double Spherical.Htm.Trixel.Epsilon = 1.0e-14` [static]`

This tolerance is used for comparing fractional roots.

 readonly double Spherical.Htm.Trixel.DblTolerance = 2.0 * Spherical.Constant.DoublePrecision` [static]`

Twice the double precision tolerance.

 const int Spherical.Htm.Trixel.TrixelNameLength = 32

Maximum number of characters in text descriptions Whenever character arrays are used to keep the text description of a trixel, they must be exactly eMaxNameSize characters long.

The documentation for this class was generated from the following file:
• Trixel.cs

May 27, 2007 György Fekete V 3.1.2