Plane - } //...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include "Plane.h" # const double Plane::kEpsilon = 0.001; c // ---------------------------------------------------------------------- default constructor c Plane::Plane(void) P : GeometricObject(), a(0.0), n(0, 1, 0) n {} { // ---------------------------------------------------------------------- constructor c : GeometricObject(), a(point), n(normal) { n.normalize(); } // ---------------------------------------------------------------- copy constructor c Plane::Plane(const Plane& plane) : GeometricObject(plane), a(plane.a), n(plane.n) n {} { // ---------------------------------------------------------------- clone / GeometricObject* Plane::clone(void) const { return (new Plane(*this));
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } // ---------------------------------------------------------------- assignment operator o Plane& Plane::operator= (const Plane& rhs) { if (this == &rhs) return (*this); r GeometricObject::operator= (rhs); G a = rhs.a; n = rhs.n; n return (*this); } // ---------------------------------------------------------------- destructor / Plane::~Plane(void) P {} { // ----------------------------------------------------------------- hit / bool Plane::hit(const Ray& ray, double& tmin, ShadeRec& sr) const { P float t = (a - ray.o) * n / (ray.d * n); f if (t > kEpsilon) { tmin = t; sr.normal = n; sr.local_hit_point = ray.o + t * ray.d; s return (true); r } return(false); }...
View Full Document

This note was uploaded on 02/19/2010 for the course CS 390 taught by Professor Hu during the Spring '10 term at Westminster UT.

Page1 / 2

Plane - } //...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online