Source: raytracer/intersection.h
|
|
|
|
/* *************************************************************************
intersection.h - description
-------------------
begin : Wed Oct 16 2002
copyright : (C) 2002 by Micha Riser
email : mriser@gmx.net
************************************************************************* */
/* *************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
************************************************************************* */
#ifndef INTERSECTION_H
#define INTERSECTION_H
#include "types.h"
#include "vector.h"
#include "ray.h"
static const DBL INTERSECTION_INFINIT_TIME = DBL_INFINITY;
static const DBL INTERSECTION_TIME_EPSILON = 1e-10;
class Texture;
class Object3D;
class Ray;
/**Describes the intersection of a ray with an object. Also provides
*information about the surface point hit.
*@author Micha Riser
*/
class Intersection {
public: // Constructors and destructor
Intersection(const Object3D* o, const Ray& r): hitobject(o), ray(r) {}
virtual ~Intersection() {};
private:
Intersection(const Intersection&);
Intersection& operator=(const Intersection&);
protected: // Private attributes
const Object3D* hitobject;
Ray ray;
public: // Public methods
/**
*@returns a pointer to the object which is hit by the ray
*/
const Object3D* hitObject() const {return hitobject;}
// Virtual methods
/**
*@returns the texture at the current intersection
*/
virtual Texture* texture();
// Pure virutal methods
/**Go to the next intersecting point.
*/
virtual void next() = 0;
/**
*@returns Current time of intersecting. If no more intersection then
*it returns INTERSECTION_TIME_INFINIT.
*/
virtual DBL currentTime() = 0;
/**
*@returns the surface normal at the current intersection
*/
virtual Vector3 normal() = 0;
};
#endif
| Generated by: micha@laptop on Thu Oct 24 20:25:24 2002, using kdoc 2.0a53. |