GeometricObject

GeometricObject - public abstract GeometricObject clone();...

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

View Full Document Right Arrow Icon
package raytracer.geometricObjects; import raytracer.utility.RGBColor; import raytracer.utility.Ray; import raytracer.utility.ShadeRec; /** this file contains the definition of the class GeometricObject * */ public abstract class GeometricObject { protected RGBColor color; // only used for Bare Bones ray tracing // ---------------------------------------------------------------------- default constructor public GeometricObject() { color = new RGBColor(RGBColor.red); } // ---------------------------------------------------------------------- copy constructor public GeometricObject (GeometricObject object) { this.color = new RGBColor(object.color); } // ---------------------------------------------------------------------- assignment operator void set (GeometricObject rhs) { if (this != rhs) this.color.set(rhs.color); } // ---------------------------------------------------------------------- abstract methods // virtual copy constructor
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: public abstract GeometricObject clone(); public abstract double hit(Ray ray, ShadeRec s); // the following three functions are only required for Chapter 3 // -------------------------------------------------------------------- set_colour public void set_color(RGBColor c) { color.set(c); } // -------------------------------------------------------------------- set_colour public void set_color(float r, float g, float b) { color.r = r; color.b = b; color.g = g; } // -------------------------------------------------------------------- get_colour public RGBColor get_color() { return (color); } public boolean equals(Object obj) { if (obj == null || this.getClass() != obj.getClass()) { return false; } else { GeometricObject other = (GeometricObject)obj; return (color.equals(other.color)); } } public String toString() { return "Geometry Object with color " + color; } }...
View Full Document

Page1 / 2

GeometricObject - public abstract GeometricObject clone();...

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