Shape.java :  » Scripting » gml-tracer » de » hauschild » gmltracer » tracer » Java Open Source

Java Open Source » Scripting » gml tracer 
gml tracer » de » hauschild » gmltracer » tracer » Shape.java
package de.hauschild.gmltracer.tracer;

import java.util.List;

import org.apache.commons.math.geometry.Vector3D;

/**
 * The base interface for all shapes describing object in the ray traced scene.
 * 
 * @author Klaus Hauschild
 * @since 1.0.0
 */
public interface Shape {

  /**
   * Gets the surface properties.
   * 
   * @param intersection
   *          the intersection
   * @return the surface properties
   */
  SurfaceProperties getSurfaceProperties(final Vector3D intersection);

  /**
   * Tests for intersection between the ray and it self. If there is a intersection information about will be provided,
   * <code>null</code> otherwise.
   * 
   * @param ray
   *          the ray to test
   * @return the intersection
   */
  Intersection intersect(final Ray ray);

  /**
   * Tests for intersection between the ray and it self. If there is a intersection information about will be provided,
   * <code>null</code> otherwise. All shapes contained in the given list will be ignored for the intersection test.
   * 
   * @param ray
   *          the ray to test
   * @param shapesToIgnore
   *          the shapes to ignore
   * @return the intersection
   */
  Intersection intersect(final Ray ray, final List<Shape> shapesToIgnore);

  /**
   * Rotates the shape around the x-axis.
   * 
   * @param degrees
   *          the degrees to rotate
   */
  void rotateX(final double degrees);

  /**
   * Rotates the shape around the y-axis.
   * 
   * @param degrees
   *          the degrees to rotate
   */
  void rotateY(final double degrees);

  /**
   * Rotates the shape around the z-axis.
   * 
   * @param degrees
   *          the degrees to rotate
   */
  void rotateZ(final double degrees);

  /**
   * Scales the shape by the given values in x-, y- and z-direction.
   * 
   * @param x
   *          the value of x-scaling
   * @param y
   *          the value of y-scaling
   * @param z
   *          the value of z-scaling
   */
  void scale(final double x, final double y, final double z);

  /**
   * Translates the shape by the given values in x-, y- and z-direction.
   * 
   * @param x
   *          the value of x-translation
   * @param y
   *          the value of y-translation
   * @param z
   *          the value of z-translation
   */
  void translate(final double x, final double y, final double z);

  /**
   * Scales the shape by the given values uniformly in all directions.
   * 
   * @param scale
   *          the value of uniform scaling
   */
  void uniformScale(final double scale);
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.