Vector3D - package raytracer.utility; public class Vector3D...

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

View Full Document Right Arrow Icon
package raytracer.utility; public class Vector3D { public double x, y, z; // ---------------------------------------------------------- default constructor public Vector3D() { x = y = z = 0.0; } // ---------------------------------------------------------- constructor public Vector3D(double a) { x = y = z = a; } // ---------------------------------------------------------- constructor public Vector3D(double a, double b, double c) { x = a; y = b; z = c; } // ---------------------------------------------------------- copy constructor public Vector3D(Vector3D vector) { x = vector.x; y = vector.y; z = vector.z; } // ---------------------------------------------------------- constructor // constructs a vector from a normal public Vector3D(Normal n) { x = n.x; y = n.y; z = n.z; } // ---------------------------------------------------------- constructor // constructs a vector from a point // this is used in the ConcaveHemisphere hit functions public Vector3D(Point3D p) { x = p.x; y = p.y; z = p.z; } // ---------------------------------------------------------- assignment operator
Background image of page 1

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

View Full DocumentRight Arrow Icon
public void set (Vector3D rhs) { if (this != rhs) { x = rhs.x; y = rhs.y; z = rhs.z; } } // ----------------------------------------------------------- assignment operator // assign a Normal to a vector public void set (Normal rhs) { x = rhs.x; y = rhs.y; z = rhs.z;
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the 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 / 5

Vector3D - package raytracer.utility; public class Vector3D...

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

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