Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

CoordinateTransform


Files

file  psCoord.h
 Contains basic coordinate transformation definitions and operations.
file  psSphereOps.h
 Contains spherical rotation and offset operations.

Data Structures

struct  psPlane
 Euclidiean Coordinate System. More...
struct  psSphere
 Angular Coordinate System. More...
struct  psCube
 3-Dimensional Euclidean Coordinate System More...
struct  psPlaneTransform
 2D Polynomial Transform More...
struct  psPlaneDistort
 4D Polynomial Transform More...
struct  psProjection
 Parameter set for projection/deprojection. More...
struct  psSphereRot
 Spherical Rotation Definition. More...

Defines

#define PS_PRINT_PLANE_TRANSFORM(NAME)

Enumerations

enum  psProjectionType { PS_PROJ_TAN, PS_PROJ_SIN, PS_PROJ_AIT, PS_PROJ_PAR, PS_PROJ_NTYPE }
 Projection type for projection/deprojection. More...
enum  psSphereOffsetMode { PS_SPHERICAL, PS_LINEAR }
 Mode for Offset calculation between two sky positions. More...
enum  psSphereOffsetUnit { PS_ARCSEC, PS_ARCMIN, PS_DEGREE, PS_RADIAN }
 The units of the offset. More...

Functions

psPlanepsPlaneAlloc (void)
 Allocates a psPlane.
psSpherepsSphereAlloc (void)
 Allocates a psSphere.
psCubepsCubeAlloc (void)
 Allocates a psCube.
psPlaneTransformpsPlaneTransformAlloc (int order1, int order2)
 Allocates a psPlaneTransform transform.
psPlanepsPlaneTransformApply (psPlane *out, const psPlaneTransform *transform, const psPlane *coords)
 Applies the psPlaneTransform transform to a specified coordinate.
psPlaneDistortpsPlaneDistortAlloc (int order1, int order2, int order3, int order4)
 Allocates a psPlaneDistort transform.
psPlanepsPlaneDistortApply (psPlane *out, const psPlaneDistort *distort, const psPlane *coords, float mag, float color)
 Applies the psPlaneDistort transform to a specified coordinate.
psProjectionpsProjectionAlloc (double R, double D, double Xs, double Ys, psProjectionType type)
 Allocates memory for a psProjection structure.
bool psMemCheckPlane (psPtr ptr)
 Checks the type of a particular pointer.
bool psMemCheckSphere (psPtr ptr)
 Checks the type of a particular pointer.
bool psMemCheckCube (psPtr ptr)
 Checks the type of a particular pointer.
bool psMemCheckPlaneTransform (psPtr ptr)
 Checks the type of a particular pointer.
bool psMemCheckPlaneDistort (psPtr ptr)
 Checks the type of a particular pointer.
bool psMemCheckProjection (psPtr ptr)
 Checks the type of a particular pointer.
psPlanepsProject (const psSphere *coord, const psProjection *projection)
 Projects a spherical coordinate to a linear coordinate system.
psPlanep_psProject (psPlane *out, const psSphere *coord, const psProjection *projection)
psSpherepsDeproject (const psPlane *coord, const psProjection *projection)
 Reverse projection of a linear coordinate to a spherical coordinate system.
psSpherep_psDeproject (psSphere *outSphere, const psPlane *coord, const psProjection *projection)
 Private reverse projection of a linear coordinate to a spherical coordinate system.
psPlaneTransformp_psPlaneTransformLinearInvert (psPlaneTransform *transform)
 Takes a given transform and inverts it linearly if possible.
psPlaneTransformp_psPlaneTransformLinearInvert_MHPCC (psPlaneTransform *transform)
psBool p_psIsProjectionLinear (psPlaneTransform *transform)
 Takes a transform and tests whether or not it is a linear projection.
psPlaneTransformpsPlaneTransformInvert (psPlaneTransform *out, const psPlaneTransform *in, psRegion region, int nSamples)
 inverts a given transformation.
psPlaneTransformpsPlaneTransformCombine (psPlaneTransform *out, const psPlaneTransform *trans1, const psPlaneTransform *trans2, psRegion region, int nSamples)
 Creates a single transformation that has the effect of performing trans1 followed by trans2.
bool psPlaneTransformFit (psPlaneTransform *trans, const psArray *source, const psArray *dest, int nRejIter, float sigmaClip)
 takes two arrays containing matched coordinates and returns the best-fitting transformation.
psSpherepsCubeToSphere (const psCube *cube)
 Converts from a 3-dimensional coordinate system to an angular coordinate system.
psCubepsSphereToCube (const psSphere *sphere)
 Converts from an angular coordinate system to a 3-dimensional coordinate system.
psPlanepsPlaneTransformDeriv (psPlane *out, const psPlaneTransform *transformation, const psPlane *coord)
 Calculates the derivative of the specified psPlaneTransform with respect to x and y.
psPixelspsPixelsTransform (psPixels *out, const psPixels *input, const psPlaneTransform *inToOut)
 Generates a list of pixels in the output coordinate frame that overlap the input pixels in the input coordinate frame through the specified transformation, inToOut.
psSphereRotpsSphereRotAlloc (double alphaP, double deltaP, double phiP)
 Allocator for psSphereRot.
bool psMemCheckSphereRot (psPtr ptr)
 Checks the type of a particular pointer.
psSphereRotpsSphereRotQuat (double q0, double q1, double q2, double q3)
 Allocator for psSphereRot given quaternions.
psSpherepsSphereRotApply (psSphere *out, const psSphereRot *transform, const psSphere *coord)
 Applies the psSphereTransform transform for a specified coordinate.
psSphereRotpsSphereRotCombine (psSphereRot *out, const psSphereRot *rot1, const psSphereRot *rot2)
 Combines two rotations.
psSphereRotpsSphereRotConjugate (psSphereRot *out, const psSphereRot *in)
 Returns the conjugate of a specified rotation.
psSphereRotpsSphereRotInvert (double alphaP, double deltaP, double phiP)
 Inverts the rotation.
psSpherepsSphereGetOffset (const psSphere *position1, const psSphere *position2, psSphereOffsetMode mode, psSphereOffsetUnit unit)
 Determines the offset (RA,Dec) on the sky between two positions.
psSpherepsSphereSetOffset (const psSphere *position, const psSphere *offset, psSphereOffsetMode mode, psSphereOffsetUnit unit)
 Applies the given offset to a coordinate.
psSphereRotpsSphereRotICRSToEcliptic (const psTime *time)
 Creates the appropriate transform for converting from ICRS to Ecliptic coordinate systems.
psSphereRotpsSphereRotEclipticToICRS (const psTime *time)
 Creates the appropriate transform for converting from Ecliptic to ICRS coordinate systems.
psSphereRotpsSphereRotICRSToGalactic (void)
 Creates the appropriate transform for converting from ICRS to Galactic coordinate systems.
psSphereRotpsSphereRotGalacticToICRS (void)
 Creates the appropriate transform for converting from Galactic to ICRS coordinate systems.


Define Documentation

#define PS_PRINT_PLANE_TRANSFORM NAME   ) 
 

Value:

{ \
    printf("---------------------- Plane Transform ----------------------\n"); \
    printf("x:\n"); \
    PS_POLY_PRINT_2D(NAME->x); \
    printf("y:\n"); \
    PS_POLY_PRINT_2D(NAME->y); \
} \

Definition at line 458 of file psCoord.h.


Enumeration Type Documentation

enum psProjectionType
 

Projection type for projection/deprojection.

See also:
psProject, psDeproject
Enumerator:
PS_PROJ_TAN  Tangent projection.
PS_PROJ_SIN  Sine projection.
PS_PROJ_AIT  Aitoff projection.
PS_PROJ_PAR  Par projection.
PS_PROJ_NTYPE  Number of types; must be last.

Definition at line 123 of file psCoord.h.

enum psSphereOffsetMode
 

Mode for Offset calculation between two sky positions.

See also:
psSphereGetOffset, psSphereSetOffset
Enumerator:
PS_SPHERICAL  offset corresponds to an angular offset
PS_LINEAR  offset corresponds to a linear offset

Definition at line 46 of file psSphereOps.h.

enum psSphereOffsetUnit
 

The units of the offset.

See also:
psSphereGetOffset, psSphereSetOffset
Enumerator:
PS_ARCSEC  Arcseconds.
PS_ARCMIN  Arcminutes.
PS_DEGREE  Degrees.
PS_RADIAN  Radians.

Definition at line 56 of file psSphereOps.h.


Function Documentation

psSphere* p_psDeproject psSphere outSphere,
const psPlane coord,
const psProjection projection
 

Private reverse projection of a linear coordinate to a spherical coordinate system.

Returns:
psPlane* projected coordinate
Parameters:
coord  coordinate to project
projection  parameters of the projection

psBool p_psIsProjectionLinear psPlaneTransform transform  ) 
 

Takes a transform and tests whether or not it is a linear projection.

Returns:
psS32 the order of the projection
Parameters:
transform  transform to test for linearity

psPlaneTransform* p_psPlaneTransformLinearInvert psPlaneTransform transform  ) 
 

Takes a given transform and inverts it linearly if possible.

Returns:
psPlaneTransform the linearly inverted transform
Parameters:
transform  transform to invert

psPlaneTransform* p_psPlaneTransformLinearInvert_MHPCC psPlaneTransform transform  ) 
 

Parameters:
transform  transform to invert

psPlane* p_psProject psPlane out,
const psSphere coord,
const psProjection projection
 

Parameters:
coord  coordinate to project
projection  parameters of the projection

psCube* psCubeAlloc void   ) 
 

Allocates a psCube.

Returns:
psCube* resulting cubic structure.

psSphere* psCubeToSphere const psCube cube  ) 
 

Converts from a 3-dimensional coordinate system to an angular coordinate system.

Returns:
psSphere* The former psCube in terms of a psSphere.
Parameters:
cube  psCube to convert

psSphere* psDeproject const psPlane coord,
const psProjection projection
 

Reverse projection of a linear coordinate to a spherical coordinate system.

Returns:
psPlane* projected coordinate
Parameters:
coord  coordinate to project
projection  parameters of the projection

bool psMemCheckCube psPtr  ptr  ) 
 

Checks the type of a particular pointer.

Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.

Returns:
bool: True if the pointer matches a psCube structure, false otherwise.
Parameters:
ptr  the pointer whose type to check

bool psMemCheckPlane psPtr  ptr  ) 
 

Checks the type of a particular pointer.

Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.

Returns:
bool: True if the pointer matches a psPlane structure, false otherwise.
Parameters:
ptr  the pointer whose type to check

bool psMemCheckPlaneDistort psPtr  ptr  ) 
 

Checks the type of a particular pointer.

Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.

Returns:
bool: True if the pointer matches a psPlaneDistort structure, false otherwise.
Parameters:
ptr  the pointer whose type to check

bool psMemCheckPlaneTransform psPtr  ptr  ) 
 

Checks the type of a particular pointer.

Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.

Returns:
bool: True if the pointer matches a psPlaneTransform structure, false otherwise.
Parameters:
ptr  the pointer whose type to check

bool psMemCheckProjection psPtr  ptr  ) 
 

Checks the type of a particular pointer.

Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.

Returns:
bool: True if the pointer matches a psProjection structure, false otherwise.
Parameters:
ptr  the pointer whose type to check

bool psMemCheckSphere psPtr  ptr  ) 
 

Checks the type of a particular pointer.

Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.

Returns:
bool: True if the pointer matches a psSphere structure, false otherwise.
Parameters:
ptr  the pointer whose type to check

bool psMemCheckSphereRot psPtr  ptr  ) 
 

Checks the type of a particular pointer.

Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.

Returns:
bool: True if the pointer matches a psSphereRot structure, false otherwise.
Parameters:
ptr  the pointer whose type to check

psPixels* psPixelsTransform psPixels out,
const psPixels input,
const psPlaneTransform inToOut
 

Generates a list of pixels in the output coordinate frame that overlap the input pixels in the input coordinate frame through the specified transformation, inToOut.

psPixelsTransform is more complicated than simply transforming the input pixels, but requires the evaluation of the derivatives of the transformation in order to obtain the list of all pixels in the output coordinate frame that possibly overlap the pixel in the input coordinate frame. In the event that input or inToOut are NULL, the function shall generate an error and return NULL. If out is non-NULL it shall be modified and returned; otherwise a new psPixels shall be allocated and returned.

Returns:
psPixels*: the list of overlapping pixels.
Parameters:
out  output list of overlapping pixels
input  input list of pixels
inToOut  specified transformation

psPlane* psPlaneAlloc void   ) 
 

Allocates a psPlane.

Returns:
psPlane* resulting plane structure.

psPlaneDistort* psPlaneDistortAlloc int  order1,
int  order2,
int  order3,
int  order4
 

Allocates a psPlaneDistort transform.

Returns:
psPlaneDistort* resulting plane distort transform
Parameters:
order1  The order of the w term in the transform.
order2  The order of the x term in the transform.
order3  The order of the y term in the transform.
order4  The order of the z term in the transform.

psPlane* psPlaneDistortApply psPlane out,
const psPlaneDistort distort,
const psPlane coords,
float  mag,
float  color
 

Applies the psPlaneDistort transform to a specified coordinate.

Returns:
psPlane* resulting coordinate based on transform
Parameters:
out  a psPlane to recycle. If NULL, a new one is generated.
distort  the transform to apply
coords  the coordinate to apply the transform above.
mag  third term -- maybe magnitude
color  forth term -- maybe color

psPlaneTransform* psPlaneTransformAlloc int  order1,
int  order2
 

Allocates a psPlaneTransform transform.

Returns:
psPlaneTransform* resulting plane transform
Parameters:
order1  The order of the x term in the transform.
order2  The order of the y term in the transform.

psPlane* psPlaneTransformApply psPlane out,
const psPlaneTransform transform,
const psPlane coords
 

Applies the psPlaneTransform transform to a specified coordinate.

Returns:
psPlane* resulting coordinate based on transform
Parameters:
out  a psPlane to recycle. If NULL, a new one is generated.
transform  the transform to apply
coords  the coordinate to apply the transform above.

psPlaneTransform* psPlaneTransformCombine psPlaneTransform out,
const psPlaneTransform trans1,
const psPlaneTransform trans2,
psRegion  region,
int  nSamples
 

Creates a single transformation that has the effect of performing trans1 followed by trans2.

psPlaneTransformCombine takes two transformations (trans1 and trans2) and returns a single transformation that has the effect of performing trans1 followed by trans2. In the event that the input transformation is linear, an exact solution may be calculated; otherwise nSamples samples in each axis, covering the region specified by region shall be used as a grid to fit the best inverse transformation. The function shall return NULL if it was unable to generate the transformation; otherwise it shall return the transformation.

Returns:
psPlaneTransform* resulting transformation
Parameters:
out  a transform to recycle, or NULL if one is to be created.
trans1  first transform to combine
trans2  first transform to combine
region  region to cover (for non-linear transforms)
nSamples  number of samples on each axis (for non-linear transforms)

psPlane* psPlaneTransformDeriv psPlane out,
const psPlaneTransform transformation,
const psPlane coord
 

Calculates the derivative of the specified psPlaneTransform with respect to x and y.

Returns:
psPlane* The derivative.

bool psPlaneTransformFit psPlaneTransform trans,
const psArray source,
const psArray dest,
int  nRejIter,
float  sigmaClip
 

takes two arrays containing matched coordinates and returns the best-fitting transformation.

psPlaneTransformFit takes two arrays containing matched coordinates (i.e., coordinates in the source array correspond to the coordinates in the dest array) and returns the best-fitting transformation. The source and dest will contain psCoords. In the event that the number of coordinates in each is not identical, the function shall generate a warning, and extra coordinates in the longer of the two shall be ignored. The trans transform may not be NULL, since it specifies the desired order, polynomial type and any polynomial terms to mask. nRejIter rejection iterations shall be performed, wherein coordinates lying more than sigmaClip standard deviations from the fit shall be rejected.

Returns:
bool TRUE if successful, otherwise FALSE.
Parameters:
trans  desired order, polynomial type, & polynomial mask terms
source  coordinates matching those in dest
dest  coordinates matching those in source
nRejIter  number of rejection iterations to be performed
sigmaClip  coordinates above this number of standard deviations will be rejected

psPlaneTransform* psPlaneTransformInvert psPlaneTransform out,
const psPlaneTransform in,
psRegion  region,
int  nSamples
 

inverts a given transformation.

It may assume that the input transformation is one-to-one, and that the inverse transformation may be specified through using polynomials of the same type and order as the forward transformation. In the event that the input transformation is linear, an exact solution may be calculated; otherwise nSamples samples in each axis, covering the region specified by region shall be used as a grid to fit the best inverse transformation. The function shall return NULL if it was unable to generate the inverse transformation; otherwise it shall return the inverse transformation. In the event that out is NULL, a new psPlaneTransform shall be allocated and returned.

Returns:
psPlaneTransform* the resulting inverted transform
Parameters:
out  a transform to recycle, or NULL if one is to be created.
in  transform to invert
region  region to fit for non-linear transform inversion
nSamples  number of samples in each axis for fit

psPlane* psProject const psSphere coord,
const psProjection projection
 

Projects a spherical coordinate to a linear coordinate system.

Returns:
psPlane* projected coordinate
Parameters:
coord  coordinate to project
projection  parameters of the projection

psProjection* psProjectionAlloc double  R,
double  D,
double  Xs,
double  Ys,
psProjectionType  type
 

Allocates memory for a psProjection structure.

Returns:
psProjection* psProjection structure
Parameters:
R  Right-ascension of projection center.
D  Declination of projection center.
Xs  Scale in x-dimension
Ys  Scale in y-dimension

psSphere* psSphereAlloc void   ) 
 

Allocates a psSphere.

Returns:
psSphere* resulting sphere structure.

psSphere* psSphereGetOffset const psSphere position1,
const psSphere position2,
psSphereOffsetMode  mode,
psSphereOffsetUnit  unit
 

Determines the offset (RA,Dec) on the sky between two positions.

Both an offset mode and an offset unit may be defined. The mode may be either PS_SPHERICAL, in which case the specified offset corresponds to an offset in angles, or it may be PS_LINEAR, in which case the offset corresponds to a linear offset in a local projection. The offset unit may be in one of PS_ARCSEC, PS_ARCMIN, PS_DEGREE, and PS_RADIAN, which specifies the units of the offset only.

Returns:
psSphere* the offset between position1 and position2
Parameters:
position1  first position for calculating offset
position2  second position for calculating offset
mode  type of offset can be PS_SPHERICAL or PS_LINEAR
unit  specifies the units of offset only

psSphereRot* psSphereRotAlloc double  alphaP,
double  deltaP,
double  phiP
 

Allocator for psSphereRot.

Returns:
psSphereRot* newly allocated psSphereRot
Parameters:
alphaP  north pole latitude
deltaP  north pole longitude
phiP  defines the longitude in the input system of the equatorial intersection between the two systems (e.g, the first point of Ares).

psSphere* psSphereRotApply psSphere out,
const psSphereRot transform,
const psSphere coord
 

Applies the psSphereTransform transform for a specified coordinate.

Returns:
psSphere* resulting coordinate based on transform
Parameters:
out  a psSphere to recycle. If NULL, a new one is generated.
transform  the transform to apply
coord  the coordinate to apply the transform above.x

psSphereRot* psSphereRotCombine psSphereRot out,
const psSphereRot rot1,
const psSphereRot rot2
 

Combines two rotations.

Combines two rotations to produce a single rotation which is the equivalent of applying the first rotation and then the second. The output rotation may be supplied, or will be allocated if NULL.

Returns:
psSphereRot* New psSphereRot that is the combination of the input psSphereRots
Parameters:
out  a psSphereRot to recycle or NULL
rot1  first rotation to combine
rot2  second rotation to combine

psSphereRot* psSphereRotConjugate psSphereRot out,
const psSphereRot in
 

Returns the conjugate of a specified rotation.

Stores the conjugate of a specified rotation in an existing psSphereRot* or creates a new psSphereRot* if NULL. The conjugate of a rotation given in quaternions is -q0, -q1, -q2, q3.

Returns:
psSphereRot* the Conjugate of the specified psSphereRot, in.
Parameters:
out  a psSphereRot to recycle or NULL
in  the psSphereRot from which to obtain the conjugate

psSphereRot* psSphereRotEclipticToICRS const psTime time  ) 
 

Creates the appropriate transform for converting from Ecliptic to ICRS coordinate systems.

Returns:
psSphereRot* transform for Ecliptic->ICRS coordinate systems
Parameters:
time  the time for which the resulting transform will be valid

psSphereRot* psSphereRotGalacticToICRS void   ) 
 

Creates the appropriate transform for converting from Galactic to ICRS coordinate systems.

Returns:
psSphereRot* new sphere rotation for Galactic to ICRS transformations.

psSphereRot* psSphereRotICRSToEcliptic const psTime time  ) 
 

Creates the appropriate transform for converting from ICRS to Ecliptic coordinate systems.

Returns:
psSphereRot* transform for ICRS->Ecliptic coordinate systems
Parameters:
time  the time for which the resulting transform will be valid

psSphereRot* psSphereRotICRSToGalactic void   ) 
 

Creates the appropriate transform for converting from ICRS to Galactic coordinate systems.

Returns:
psSphereRot* new sphere rotation for ICRS to Galactic transformations.

psSphereRot* psSphereRotInvert double  alphaP,
double  deltaP,
double  phiP
 

Inverts the rotation.

A given rotation is inverted by creating a psSphereRot using -phiP, -deltaP, -alphaP.

Returns:
psSphereRot* Inverted input psSphereRot
Parameters:
alphaP  north pole latitude
deltaP  north pole longitude
phiP  defines the longitude in the input system of the equatorial intersection between the two systems (e.g, the first point of Ares).

psSphereRot* psSphereRotQuat double  q0,
double  q1,
double  q2,
double  q3
 

Allocator for psSphereRot given quaternions.

Normalizes a given quaternion and returns the cooresponding newly allocated psSphereRot object.

Returns:
psSphereRot* newly allocated psSphereRot
Parameters:
q0  q0
q1  q1
q2  q2
q3  q3

psSphere* psSphereSetOffset const psSphere position,
const psSphere offset,
psSphereOffsetMode  mode,
psSphereOffsetUnit  unit
 

Applies the given offset to a coordinate.

Both an offset mode and an offset unit may be defined. The mode may be either PS_SPHERICAL, in which case the specified offset corresponds to an offset in angles, or it may be PS_LINEAR, in which case the offset corresponds to a linear offset in a local projection. The offset unit may be in one of PS_ARCSEC, PS_ARCMIN, PS_DEGREE, and PS_RADIAN, which specifies the units of the offset only.

Returns:
psSphere* the original position with the given offset applied.
Parameters:
position  coordinate of origin
offset  coordinate of offset to apply
mode  corresponds to an offset in angles or local projection
unit  specifies the units of offset only

psCube* psSphereToCube const psSphere sphere  ) 
 

Converts from an angular coordinate system to a 3-dimensional coordinate system.

Returns:
psCube* The former psSphere in terms of a psCube.
Parameters:
sphere  psSphere to convert


Generated on Mon Jul 3 14:15:13 2006 for Pan-STARRS Foundation Library by  doxygen 1.4.4