Overview | Package | Class | Use | Tree | Index | Help
| Rings Version 0.3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## threeD.raytracer.primitives
Class Triangle

    java.lang.Object
      threeD.raytracer.engine.AbstractSurface
          threeD.raytracer.primitives.Triangle

All Implemented Interfaces:
  ParticleGroup, Surface

public class Triangle
extends AbstractSurface
implements ParticleGroup

A Triangle object represents a triangle in 3d space.

Constructor Summary
`Triangle()` Constructs a new Triangle object with all vertices at the origin that is black.
`Triangle(Vector p1, Vector p2, Vector p3)` Constructs a new Triangle object with the specified vertices that is black.
`Triangle(Vector p1, Vector p2, Vector p3, RGB color)` Constructs a new Triangle object with the specified vertices with the color represented by the specified RGB object.

Method Summary
`Vector` | `getNormalAt(Vector point)` Returns a Vector object that represents the vector normal to this sphere at the point represented by the specified Vector object.
`double[][]` | `getParticleVertices()`
`boolean` | `getSmooth()`
`Vector[]` | `getVertices()` Returns an array of Vector objects representing the vertices of this Triangle object.
`boolean` | `intersect(Ray ray)` Returns true if the ray represented by the specified Ray object intersects the triangle represented by this Triangle object in real space.
`Intersection` | `intersectAt(Ray ray)` Returns an Intersection object representing the points along the ray represented by the specified Ray object that intersection between the ray and the triangle represented by this Triangle object occurs.
`void` | `setSmooth(boolean s)` Sets the smooth flag which indicates if normal vectors should be interpolated.
`void` | `setVertices(Vector p1, Vector p2, Vector p3)` Sets the vertices of this Triangle object to those specified.
`java.lang.String` | `toString()`

Methods inherited from class threeD.raytracer.engine.AbstractSurface
`addShader, addTexture, addTransform, calculateTransform, getColor, getColorAt, getLocation, getParent, getRotationCoefficients, getScaleCoefficients, getShadeBack, getShadeFront, getShaderSet, getSize, getTexture, getTextures, getTextureSet, getTransform, getTransform, getTransforms, removeTexture, removeTransform, setColor, setLocation, setParent, setRotationCoefficients, setScaleCoefficients, setShadeBack, setShadeFront, setShaders, setSize, setTexture, setTextures, setTransform, setTransforms, shade`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Triangle

    public Triangle()

  Constructs a new Triangle object with all vertices at the origin that is black.

### Triangle

    public Triangle(Vector p1,
                    Vector p2,
                    Vector p3)

  Constructs a new Triangle object with the specified vertices that is black.

### Triangle

    public Triangle(Vector p1,
                    Vector p2,
                    Vector p3,
                    RGB color)

  Constructs a new Triangle object with the specified vertices with the color represented by the specified RGB object.

Method Detail

### setVertices

    public void setVertices(Vector p1,
                            Vector p2,
                            Vector p3)

  Sets the vertices of this Triangle object to those specified.

### getVertices

    public Vector[] getVertices()

  Returns an array of Vector objects representing the vertices of this Triangle object.

### setSmooth

    public void setSmooth(boolean s)

  Sets the smooth flag which indicates if normal vectors should be interpolated.

  Parameters:
    `s` - Value to use.

### getSmooth

    public boolean getSmooth()

  Returns:
    The smooth flag which indicates if normal vectors should be interpolated.

### getParticleVertices

    public double[][] getParticleVertices()

  Specified by:
    `getParticleVertices` in interface `ParticleGroup`
  See Also:
    `ParticleGroup.getParticleVertices()`

### getNormalAt

    public Vector getNormalAt(Vector point)

  Returns a Vector object that represents the vector normal to this sphere at the point represented by the specified Vector object.

  Specified by:
    `getNormalAt` in interface `Surface`

### intersect

    public boolean intersect(Ray ray)

  Returns true if the ray represented by the specified Ray object intersects the triangle represented by this Triangle object in real space.

  Specified by:
    `intersect` in interface `Surface`

### intersectAt

    public Intersection intersectAt(Ray ray)

  Returns an Intersection object representing the points along the ray represented by the specified Ray object that intersection between the ray and the triangle represented by this Triangle object occurs.

  Specified by:
    `intersectAt` in interface `Surface`

### toString

    public java.lang.String toString()

Overview | Package | Class | Use | Tree | Index | Help
| Rings Version 0.3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2003-05 Mike Murray