{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Vector3D

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

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

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

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

View Full Document
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; } // ---------------------------------------------------------- assignment operator // assign a point to a vector public void set (Point3D rhs) { x = rhs.x; y = rhs.y; z = rhs.z; } // ------------------------------------------------------------------------ unary minus // this does not change the current vector // this allows ShadeRec objects to be declared as constant arguments in many shading
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### 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
Ask a homework question - tutors are online