Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

vuSpherical Class Reference

A class for representing 3d spherical coordinates. More...

#include <vuSpherical.h>

Collaboration diagram for vuSpherical:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 vuSpherical ()
 Default constructor making a zero spherical.
 vuSpherical (const vuSpherical &v)
 Copy constructor.
 vuSpherical (float longitude, float latitude, float radius)
 Constructor initializing to a 3d spherical.
 vuSpherical (const float *v)
 Constructor initializing the spherical from an array of floats.
 vuSpherical (vuVector &vector)
 ~vuSpherical ()
 The destructor.
vuSphericaloperator= (const vuSpherical &v)
 The assignment operator.
vuSphericaloperator= (const float *v)
 Assigns a 3d float array (longitude,latitude,radius) to the spherical.
float getLongitude ()
 Getting the longitude.
float getLatitude ()
 Getting the latitude.
float getRadius ()
 Getting the radius.
void setLongitude (float _val)
 Getting the longitude.
void setLatitude (float _val)
 Getting the latitude.
void setRadius (float _val)
 Getting the radius.
float norm (void) const
 Performs the 1-norm (manhattan norm) on the spherical.
float norm2 (void) const
 Performs the 2-norm on the vector.
vuSphericalmakeUnit (void)
 Normalizes the vector to a length of 1.
floatoperator[] (dword index)
 The access operator.
const floatoperator[] (dword index) const
 The const access operator.
floatgetData (void)
 Returns the data pointer.
float const * getData (void) const
 const version of getData()
bool operator== (const vuSpherical &v) const
 An equality operator.
bool operator!= (const vuSpherical &v) const
 An inequality operator.
void print ()
 prints values to the stdout
vuVector getVector ()
 returns a cartesian vector

Private Member Functions

void ensure (float &longitude, float &latitude, float &radius)

Private Attributes

float val [3]

Friends

ostream & operator<< (ostream &out, const vuSpherical &v)
 writes the three elements to a stream; separated by whitespaces
istream & operator>> (istream &in, vuSpherical &v)
 reads a spherical from a stream

Detailed Description

A class for representing 3d spherical coordinates.

A spherical coordinate consists of two angles (longitude, latitude) and a length (radius).

The formal notation is: vuSpherical = [longitude, latitude, radius]

longitude: angle in x-y-plane, starting with x-axis (counterclockwise) latitude: angle in y-z-plane, starting with y-axis (+z=>+PI/2, -z=>-PI/2) radius: length of vector

0 <= longitude < 2*PI -PI <= latitude <= +PI 0 <= radius < infinity

Definition: if (radius==0), then longitude=0 and latitude=0

Definition at line 32 of file vuSpherical.h.


Constructor & Destructor Documentation

vuSpherical::vuSpherical  ) 
 

Default constructor making a zero spherical.

Definition at line 8 of file vuSpherical.cpp.

References val.

vuSpherical::vuSpherical const vuSpherical v  ) 
 

Copy constructor.

Definition at line 14 of file vuSpherical.cpp.

References val.

vuSpherical::vuSpherical float  longitude,
float  latitude,
float  radius
 

Constructor initializing to a 3d spherical.

Definition at line 22 of file vuSpherical.cpp.

References val.

vuSpherical::vuSpherical const float v  ) 
 

Constructor initializing the spherical from an array of floats.

Parameters:
v An array of 3 floating point values corresponding to longitude, latitude, radius.

Definition at line 29 of file vuSpherical.cpp.

References val.

vuSpherical::vuSpherical vuVector vector  ) 
 

Constructor initializing the spherical from an vuVector, by transforming the vector into a spherical.

Definition at line 36 of file vuSpherical.cpp.

References M_PI, M_PI_2, vuVector::norm(), and val.

Here is the call graph for this function:

vuSpherical::~vuSpherical  ) 
 

The destructor.

Definition at line 75 of file vuSpherical.cpp.


Member Function Documentation

void vuSpherical::ensure float longitude,
float latitude,
float radius
[inline, private]
 

Definition at line 165 of file vuSpherical.cpp.

float const * vuSpherical::getData void   )  const
 

const version of getData()

Definition at line 97 of file vuSpherical.cpp.

float* vuSpherical::getData void   ) 
 

Returns the data pointer.

The data is stored as a four dimensional float array. The getData() function can both retrieve and modify; it is similar to the [] operator. To warrant the return of a const pointer (for use in other const member functions) explicitly cast the pointer returned to (const).

float vuSpherical::getLatitude  )  [inline]
 

Getting the latitude.

Definition at line 61 of file vuSpherical.h.

Referenced by vu1611_2< SIZE, TYPE >::preview().

float vuSpherical::getLongitude  )  [inline]
 

Getting the longitude.

Definition at line 59 of file vuSpherical.h.

Referenced by vu1611_2< SIZE, TYPE >::preview().

float vuSpherical::getRadius  )  [inline]
 

Getting the radius.

Definition at line 63 of file vuSpherical.h.

vuVector vuSpherical::getVector  ) 
 

returns a cartesian vector

Definition at line 150 of file vuSpherical.cpp.

References val.

vuSpherical & vuSpherical::makeUnit void   ) 
 

Normalizes the vector to a length of 1.

This simply sets the radius to 1.

Definition at line 113 of file vuSpherical.cpp.

References val.

float vuSpherical::norm void   )  const
 

Performs the 1-norm (manhattan norm) on the spherical.

Definition at line 101 of file vuSpherical.cpp.

References val.

float vuSpherical::norm2 void   )  const
 

Performs the 2-norm on the vector.

This is the same as the length operator or radius.

Definition at line 107 of file vuSpherical.cpp.

References val.

bool vuSpherical::operator!= const vuSpherical v  )  const
 

An inequality operator.

Definition at line 126 of file vuSpherical.cpp.

References operator==().

Here is the call graph for this function:

vuSpherical& vuSpherical::operator= const float v  ) 
 

Assigns a 3d float array (longitude,latitude,radius) to the spherical.

vuSpherical & vuSpherical::operator= const vuSpherical v  ) 
 

The assignment operator.

Definition at line 80 of file vuSpherical.cpp.

References val.

bool vuSpherical::operator== const vuSpherical v  )  const
 

An equality operator.

Definition at line 120 of file vuSpherical.cpp.

References val.

Referenced by operator!=().

const float & vuSpherical::operator[] dword  index  )  const
 

The const access operator.

Definition at line 92 of file vuSpherical.cpp.

References dword, and val.

float& vuSpherical::operator[] dword  index  ) 
 

The access operator.

void vuSpherical::print  ) 
 

prints values to the stdout

Definition at line 131 of file vuSpherical.cpp.

References val.

void vuSpherical::setLatitude float  _val  )  [inline]
 

Getting the latitude.

Definition at line 69 of file vuSpherical.h.

void vuSpherical::setLongitude float  _val  )  [inline]
 

Getting the longitude.

Definition at line 67 of file vuSpherical.h.

void vuSpherical::setRadius float  _val  )  [inline]
 

Getting the radius.

Definition at line 71 of file vuSpherical.h.


Friends And Related Function Documentation

ostream& operator<< ostream &  out,
const vuSpherical v
[friend]
 

writes the three elements to a stream; separated by whitespaces

Definition at line 136 of file vuSpherical.cpp.

istream& operator>> istream &  in,
vuSpherical v
[friend]
 

reads a spherical from a stream

Definition at line 142 of file vuSpherical.cpp.


Member Data Documentation

float vuSpherical::val[3] [private]
 

The coordinates of the vector stored as a floating point array: longitude, latitude, radius

Definition at line 120 of file vuSpherical.h.

Referenced by getVector(), makeUnit(), norm(), norm2(), operator<<(), operator=(), operator==(), operator>>(), operator[](), print(), and vuSpherical().


The documentation for this class was generated from the following files:
Generated on Wed Dec 15 21:22:03 2004 for vuVolume by  doxygen 1.3.9.1