blob: 106c524839f39e1f74e75eb64bdb9780003a1aa3 (
plain) (
tree)
|
|
/******************************************************************/
/* This file is part of the homework assignments for CSCI-427/527 */
/* at The College of William & Mary and authored by Pieter Peers. */
/* No part of this file, whether altered or in original form, can */
/* be distributed or used outside the context of CSCI-427/527 */
/* without consent of either the College of William & Mary or */
/* Pieter Peers. */
/******************************************************************/
#ifndef _SURFACESAMPLE_H_
#define _SURFACESAMPLE_H_
#include "transformation3d.h"
#include <ostream>
class surfaceSample {
public:
surfaceSample(void);
surfaceSample(const vec3d& position, const vec3d& normal, const float pdf);
surfaceSample(const surfaceSample& ss);
///////////////
// Operators //
///////////////
surfaceSample& operator=(const surfaceSample& ss);
surfaceSample operator*(float pdf) const;
surfaceSample& operator*=(float pdf);
////////////////
// Inspectors //
////////////////
const vec3d& position(void) const;
const vec3d& normal(void) const;
float pdf(void) const;
/////////////
// Methods //
/////////////
surfaceSample& transform(const transformation3d& t);
surfaceSample& inverseTransform(const transformation3d& t);
/////////////
// Friends //
/////////////
friend void swap(surfaceSample& a, surfaceSample& b) { a._swap(b); }
friend surfaceSample transform(const surfaceSample& s, const transformation3d& t) { surfaceSample result(s); return result.transform(t); }
friend surfaceSample inverseTransform(const surfaceSample& s, const transformation3d& t) { surfaceSample result(s); return result.inverseTransform(t); }
friend std::ostream& operator<<(std::ostream& s, const surfaceSample& ss)
{
s << "SurfaceSample: " << ss._position << "with normal: " << ss._normal << ", and PDF: " << ss._pdf;
return s;
}
private:
/////////////////////
// Private Methods //
/////////////////////
void _swap(surfaceSample& s);
void _assign(const surfaceSample& s);
//////////////////
// Data Members //
//////////////////
vec3d _position;
vec3d _normal;
float _pdf;
};
#endif /* _SURFACESAMPLE_H_ */
|