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 CSG

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

All Implemented Interfaces:
  Surface

public class CSG
extends AbstractSurface

A CSG object represents an object produced using a boolean combination of two surfaces.

Field Summary
`static int` | `DIFFERENCE` Integer code for boolean difference (A - B).
`static int` | `INTERSECTION` Integer code for boolean intersection (A & B).
`static int` | `UNION` Integer code for boolean union (A + B).

Constructor Summary
`CSG(AbstractSurface a, AbstractSurface b, int type)` Constructs a new CSG object using the specified Surface objects.

Method Summary
`Vector` | `getNormalAt(Vector point)` Returns a Vector object that represents the vector normal to the 3d surface at the point represented by the specified Vector object.
`boolean` | `intersect(Ray ray)` This method calls intersectAt to determine the value to return.
`Intersection` | `intersectAt(Ray ray)` Returns an Intersection object that represents the values for t that solve the vector equation p = o + t * d where p is a point of intersection of the specified ray and the surface.
`double[]` | `interval(double[] intersect)`
`double[][]` | `intervalDifference(double[] ia, double[] ib)`
`double[]` | `intervalIntersection(double[] ia, double[] ib)`

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, toString, wait, wait, wait`

Field Detail

### UNION

    public static final int UNION

  Integer code for boolean union (A + B).

  See Also:
    Constant Field Values

### DIFFERENCE

    public static final int DIFFERENCE

  Integer code for boolean difference (A - B).

  See Also:
    Constant Field Values

### INTERSECTION

    public static final int INTERSECTION

  Integer code for boolean intersection (A & B).

  See Also:
    Constant Field Values

Constructor Detail

### CSG

    public CSG(AbstractSurface a,
               AbstractSurface b,
               int type)

  Constructs a new CSG object using the specified Surface objects.

Parameters:
  `a` - Surface A.
  `b` - Surface B.
  `type` - The type of boolean operation to perform (UNION, DIFFERENCE, INTERSECTION).
Throws:
  `java.lang.IllegalArgumentException` - If the type code is not valid.

Method Detail

### getNormalAt

    public Vector getNormalAt(Vector point)

  Description copied from interface: `Surface`
  Returns a Vector object that represents the vector normal to the 3d surface at the point represented by the specified Vector object.

  Returns:
    null.

### intersect

    public boolean intersect(Ray ray)

  This method calls intersectAt to determine the value to return.

  See Also:
    `Surface.intersect(threeD.raytracer.engine.Ray)`

### intersectAt

    public Intersection intersectAt(Ray ray)

  Description copied from interface: `Surface`
  Returns an Intersection object that represents the values for t that solve the vector equation p = o + t * d where p is a point of intersection of the specified ray and the surface.

  See Also:
    `Surface.intersectAt(threeD.raytracer.engine.Ray)`

### interval

    public double[] interval(double[] intersect)

### intervalDifference

    public double[][] intervalDifference(double[] ia,
                                         double[] ib)

### intervalIntersection

    public double[] intervalIntersection(double[] ia,
                                         double[] ib)

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