Class com.oroinc.yaray.Sphere
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.oroinc.yaray.Sphere

java.lang.Object
   |
   +----com.oroinc.yaray.WorldObject
           |
           +----com.oroinc.yaray.Sphere

public class Sphere
extends WorldObject
A sphere.

Copyright © 1996, 1997 Original Reusable Objects, Inc. All rights reserved.

Author:
Daniel F. Savarese

Constructor Index

 o Sphere(Point, float, Pigment, Finish)

Method Index

 o getColor(World, Ray, Color)
Given a world description and the ray that intersects the sphere, returns the color of the sphere at the point of intersection.
 o intersect(IntersectionRay)
Determines if ray intersects sphere.

Constructors

 o Sphere
  public Sphere(Point center,
                float radius,
                Pigment pigment,
                Finish finish)

Methods

 o intersect
  public boolean intersect(IntersectionRay ray)
Determines if ray intersects sphere. If it does, checks that point of intersection is closer to origin of ray than any previous point of intersection. If it is closer, returns true, if not, returns false.

Parameters:
ray - Ray to be tested for intersection.
Returns:
true If ray intersects disc and is closer to origin than any previous point of intersection, false otherwise.
Overrides:
intersect in class WorldObject
 o getColor
  public void getColor(World world,
                       Ray intersection,
                       Color colorResult)
Given a world description and the ray that intersects the sphere, returns the color of the sphere at the point of intersection.

Parameters:
world - The world containing the sphere.
intersection - The current ray being traced.
colorResult - The color at the point of intersection if any.
Overrides:
getColor in class WorldObject

All Packages  Class Hierarchy  This Package  Previous  Next  Index