Transforms between cartesian, cylindrical and spherical coordinates.
Name | Type | Description | |
cart | Mesh+Space3 | Cartesian coordinates to be converted | |
cyl | float[][3] | Cylindrical coordinates to be converted | |
sph | float[][3] | Spherical coordinates to be converted | |
Name | Type | Description | |
cart | Point Mesh | converted cartesian coordinates | |
cyl | float[][3] | converted cylindrical coordinates | |
sph | float[][3] | converted spherical coordinates | |
obj | DataObject | directly renderable cartesian output object | |
Normally coordinates in space are described by the distance a point is along three perpendicular axis. These distances are called x,y and z, and this system of describing coordinates is called the cartesian coordinate system. This is the system that is used by AVS/Express Fields to describe the position of node points. However there are alternative ways to describe positions in space. In particular the cartesian coordinate system is not well suited to describing circular or spherical objects. To help solve this problem two other coordinate systems have been developed, namely cylindrical and spherical coordinates. The macros and modules presented in this project allow the user to easily transform coordinates between these three systems.
Both spherical and cylindrical describe the position of a point by using 3 values. The spherical coordinate values are called r, theta and pi. r is the distance the point is from the origin. theta is the angle in the X-Y plane and pi is the angle in the Z plane. Similarly the cylindrical coordinate values are called r, theta and z. r is the distance the point is from the Z axis, z is the distance the point is along the Z axis and theta is the angle in the X-Y plane.
Four macros are provided to allow data to be transformed between these systems. sph2cart and cart2sph convert spherical coordinates to and from cartesian coordinates respectively. cyl2cart and cart2cyl convert cylindrical coordinates to and from cartesian coordinates respectively. This project does not allow direct transformation between cylindrical and spherical coordinates. However this can be easily achieved by combining two macros i.e. sph2cart and cart2cyl.
cart
Mesh containing 3-dimensional cartesian coordinates that should be transformed. Please note that allowing a Mesh to be processed is a convenience to the user. Internally the low-level module operates directly upon the coordinate array contained within the Mesh. All other data contained within the Mesh is ignored. If you do not wish to transform Mesh data you should use the low-level modules directly.
sph[][3]
Floating point array containing the spherical coordinates that should be transformed. Each element in the array should contain the coordinates in this order: r, theta, pi.
cyl[][3]
Floating point array containing the cylindrical coordinates that should be transformed. Each element in the array should contain the coordinates in this order: r, theta, z.
cart
Point mesh containing the original points transformed into cartesian coordinates. This mesh can be directly used by other visualization modules.
sph[][3]
Floating point array containing the original points transformed into spherical coordinates. This array contains the spherical coordinates in the following order: r, theta, pi.
cyl[][3]
Floating point array containing the original points transformed into cylindrical coordinates. This array contains the cylindrical coordinates in the following order: r, theta, z.
obj
The GDobject version of the cartesian point mesh output, suitable for direct connection to the viewer. This output is only provided by the sph2cart and cyl2cart modules.
The four functional macros presented here each encapsulate a single low-level module that contains the procedural code necessary to perform the transformation.
No user interface or user macros are provided as they are not necessary for this project.
Two example applications are provided. The CylindricalCoordsEg application generates a series of cylindrical coordinates that represent a spiral. These coordinates are converted into cartesian coordinates and displayed in a normal viewer. The cartesian coordinates are then converted back into cylindrical coordinates and displayed on a polar graph. Similarly the SphericalCoordsEg application generates a series of spherical coordinates that follow a path around the surface of a sphere. These coordinates are converted into cartesian coordinates and displayed using the glyph module.
The low-level XformMods library containing the low-level modules does not specify a process. By default the express process will be used.
iac_proj/xform/xfrmmods.v contains the V definitions of the spherical_to_cartesian, cartesian_to_spherical, cylindrical_to_cartesian and cartesian_to_cylindrical modules.
iac_proj/xform/xfrmmacs.v contains the V definitions of the sph2cart, cart2sph, cyl2cart and cart2cyl functional macros, and the CylindricalCoordsEg and SphericalCoordsEg example applications.
Jeremy Maccelari, visualn@iafrica.com
Andrew Dodd, International AVS Centre
International AVS Centre Manchester Visualization Centre Manchester Computing University of Manchester Oxford Road Manchester United Kingdom M13 9PL