Point3D Class Reference

A three-dimensional point in space. More...

#include <point3d.h>

List of all members.

Public Member Functions

double distance_to (const Point3D &other)
void normalize ()
 Calculate the normalized vector from the origin to the destination.
 Point3D (const Point3D &other)
 Copy constructor.
 Point3D (std::string str)
template<class _T>
 Point3D (_T _x, _T _y, _T _z)
 Creates a point in three dimenisional space.
template<class _T>
 Point3D (_T _x, _T _y)
 Creates a point on the XY plane.
 Point3D ()
 Default constructor. Places point on the origin.
template<class _T>
void set (_T x, _T y, _T z)
 Sets the coordinates of the point.
std::string to_string ()

Public Attributes

double x
 Distance from origin on the x axis.
double y
 Distance from origin on the y axis.
double z
 Distance from origin on the z axis.


Detailed Description

A three-dimensional point in space.

Definition at line 20 of file point3d.h.


Constructor & Destructor Documentation

Point3D::Point3D (  )  [inline]

Default constructor. Places point on the origin.

Definition at line 31 of file point3d.h.

template<class _T>
Point3D::Point3D ( _T  _x,
_T  _y 
) [inline]

Creates a point on the XY plane.

Definition at line 35 of file point3d.h.

template<class _T>
Point3D::Point3D ( _T  _x,
_T  _y,
_T  _z 
) [inline]

Creates a point in three dimenisional space.

Definition at line 39 of file point3d.h.

Point3D::Point3D ( std::string  str  )  [inline]

Creates a point in three space by parsing a string of the form "(x, y, z)".

Definition at line 43 of file point3d.h.

References iswhitespace(), x, y, and z.

Here is the call graph for this function:

Point3D::Point3D ( const Point3D other  )  [inline]

Copy constructor.

Definition at line 59 of file point3d.h.


Member Function Documentation

double Point3D::distance_to ( const Point3D other  )  [inline]

Returns the distance between this point and the other point. This is defined by the following function, copied from http://en.wikipedia.org/wiki/Distance#Geometry.

\[ d=\sqrt{(\Delta x)^2+(\Delta y)^2+(\Delta z)^2}=\sqrt{(x_1-x_2)^2+(y_1-y_2)^2+(z_1-z_2)^2} \]

Parameters:
other The other point to which we are determining the distance.

Definition at line 102 of file point3d.h.

References x, y, and z.

Referenced by ConcentricBumpMap::perturb_normal().

Here is the caller graph for this function:

void Point3D::normalize (  )  [inline]

Calculate the normalized vector from the origin to the destination.

Definition at line 86 of file point3d.h.

References x, y, and z.

template<class _T>
void Point3D::set ( _T  x,
_T  y,
_T  z 
) [inline]

Sets the coordinates of the point.

Definition at line 79 of file point3d.h.

References x, y, and z.

std::string Point3D::to_string (  )  [inline]

Convert to a string representation

Returns:
string representation

Definition at line 71 of file point3d.h.

References x, y, and z.

Referenced by Ray::to_string().

Here is the caller graph for this function:


Member Data Documentation

double Point3D::x

Distance from origin on the x axis.

Definition at line 24 of file point3d.h.

Referenced by CheckeredMaterial::choose_material(), cross_product(), distance_to(), dot_product(), Noise::get_noise(), Ray::normalize(), normalize(), operator *(), operator+(), operator-(), operator==(), RippleBumpMap::perturb_normal(), Point3D(), set(), Sphere::Sphere(), to_string(), and trace_rays().

double Point3D::y

Distance from origin on the y axis.

Definition at line 26 of file point3d.h.

Referenced by CheckeredMaterial::choose_material(), cross_product(), distance_to(), dot_product(), Noise::get_noise(), Ray::normalize(), normalize(), operator *(), operator+(), operator-(), operator==(), RippleBumpMap::perturb_normal(), Point3D(), set(), Sphere::Sphere(), to_string(), and trace_rays().

double Point3D::z

Distance from origin on the z axis.

Definition at line 28 of file point3d.h.

Referenced by CheckeredMaterial::choose_material(), cross_product(), distance_to(), dot_product(), Noise::get_noise(), Ray::normalize(), normalize(), operator *(), operator+(), operator-(), operator==(), RippleBumpMap::perturb_normal(), Point3D(), set(), Sphere::Sphere(), to_string(), and trace_rays().


The documentation for this class was generated from the following file:
Generated on Tue Oct 30 22:12:23 2007 for mbrt by  doxygen 1.5.2