Ray - o = new Point3D(ray.o); d = new Vector3D(ray.d); } //

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
package raytracer.utility; public class Ray { public Point3D o; // origin public Vector3D d; // direction // ---------------------------------------------------------------- default constructor public Ray () { o = new Point3D(0.0); d = new Vector3D(0.0, 0.0, 1.0); } // ---------------------------------------------------------------- constructor public Ray (Point3D origin, Vector3D dir) { o = new Point3D(origin); d = new Vector3D(dir); } // ---------------------------------------------------------------- copy constructor public Ray (Ray ray) {
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: o = new Point3D(ray.o); d = new Vector3D(ray.d); } // ---------------------------------------------------------------- assignment operator public void set (Ray rhs) { if (this != rhs) { o = new Point3D(rhs.o); d = new Vector3D(rhs.d); } } public boolean equals(Object obj) { if (obj == null || this.getClass() != obj.getClass()) { return false; } else { Ray other = (Ray)obj; return (o.equals(other.o) && d.equals(other.d)); } } public String toString() { return "Ray: origin (" + o + ")\tdir (" + d + ")"; } }...
View Full Document

Ask a homework question - tutors are online