Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Plane Class Reference

#include <plane.h>

List of all members.

Public Methods

 Plane ()
 Plane (VECTOR n, VECTOR p)
 ~Plane ()
float Distance (VECTOR x)
bool Intersection (VECTOR ray_point, VECTOR ray_dir, VECTOR *res)

Public Attributes

VECTOR normal
VECTOR point
float dist


Constructor & Destructor Documentation

Plane::Plane  
 

Definition at line 4 of file plane.cpp.

References dist, normal, and point.

00004              {
00005         normal = VECTOR(0,0,0);
00006         point = VECTOR(0,0,0);
00007         dist = 0.0;
00008 }

Plane::Plane VECTOR    n,
VECTOR    p
 

Definition at line 10 of file plane.cpp.

References dist, VECTOR::dot(), normal, and point.

00010                                {
00011         normal = n;
00012         point = p;
00013         dist = -normal.dot(point);
00014 }

Plane::~Plane   [inline]
 

Definition at line 13 of file plane.h.

00013 {};


Member Function Documentation

float Plane::Distance VECTOR    x
 

Definition at line 17 of file plane.cpp.

References VECTOR::dot(), normal, and point.

00017                         {
00018         VECTOR help = x - point;
00019         return fabsf(normal.dot(point));
00020 }

bool Plane::Intersection VECTOR    ray_point,
VECTOR    ray_dir,
VECTOR   res
 

Definition at line 23 of file plane.cpp.

References dist, and VECTOR::dot().

00023                                                                  {
00024         float dir_norm = ray_dir.dot(normal);
00025         if (fabsf(dir_norm) < 0.001) return false; // parallel
00026         float t = -(ray_point.dot(normal)+dist)/(dir_norm);
00027         *res = ray_point + t*ray_dir;
00028         return true;
00029 }


Member Data Documentation

float Plane::dist
 

Definition at line 10 of file plane.h.

Referenced by Intersection(), and Plane().

VECTOR Plane::normal
 

Definition at line 8 of file plane.h.

Referenced by Distance(), Plane(), Raycaster::Raycast(), Perspective::RotateX(), Raycaster::RotateX(), Perspective::RotateY(), Raycaster::RotateY(), Perspective::RotateZ(), Raycaster::RotateZ(), and Raycaster::SetViewingMatrix().

VECTOR Plane::point
 

Definition at line 9 of file plane.h.

Referenced by Distance(), Plane(), Perspective::Raycast(), Raycaster::Raycast(), Perspective::RotateX(), Raycaster::RotateX(), Perspective::RotateY(), Raycaster::RotateY(), Perspective::RotateZ(), and Raycaster::RotateZ().


The documentation for this class was generated from the following files:
Generated on Thu Jan 23 12:32:16 2003 by doxygen1.3-rc2