Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.threed.jpct
Class Primitives

    java.lang.Object
      com.threed.jpct.Primitives

public class Primitives
extends java.lang.Object

Primitives offers some (lathe) primitives (basic 3D-objects). This class allows one to generate some objects for testing or other purposes quick and easy. No object editing or loading is needed. The number of faces the methods are asking for (or using the defaults) is not exactly the number of triangles the calculated object will have but rather the number of faces of the base object from which it has been constructed. But in lack of a better word, it's called "faces" here.
Except for the plane, objects created by this class don't have proper texture coordinates.
If you want proper texture coordinates for your primitives, have a look at the ExtendedPrimitives class in the util-package.

See Also:
  `ExtendedPrimitives`

Method Summary
`static Object3D` | `getBox(float scale, float scaleHeight)` Returns a box (a 3-dimensional rectangle).
`static Object3D` | `getCone(float scale)` Returns a cone with 90 faces.
`static Object3D` | `getCone(int faces, float scale)` Returns a cone with the given number of faces.
`static Object3D` | `getCone(int faces, float scale, float scaleHeight)` Returns a cone with the given number of faces.
`static Object3D` | `getCube(float scale)` Returns a cube.
`static Object3D` | `getCylinder(float scale)` Returns a cylinder with 90 faces.
`static Object3D` | `getCylinder(int faces, float scale)` Returns a cylinder with the given number of faces.
`static Object3D` | `getCylinder(int faces, float scale, float scaleHeight)` Returns a cylinder with the given number of faces.
`static Object3D` | `getDoubleCone(float scale)` Returns a double cone with 90 faces.
`static Object3D` | `getDoubleCone(int faces, float scale)` Returns a double cone with the given number of faces.
`static Object3D` | `getEllipsoid(float scale, float scaleHeight)` Returns an ellipsoid with 20 faces.
`static Object3D` | `getEllipsoid(int faces, float scale, float scaleHeight)` Returns an ellipsoid with he given number of faces.
`static Object3D` | `getPlane(int quads, float scale)` Returns a plane consisting of (quads^2)*2 polygons each "scale" units in size.
`static Object3D` | `getPyramide(float scale)` Returns a pyramide
`static Object3D` | `getPyramide(float scale, float scaleHeight)` Returns a pyramide
`static Object3D` | `getSphere(float scale)` Returns a sphere with 20 faces.
`static Object3D` | `getSphere(int faces, float scale)` Returns a sphere with the given number of faces.

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

Method Detail

### getPlane

    public static Object3D getPlane(int quads,
                                    float scale)

  Returns a plane consisting of (quads^2)*2 polygons each "scale" units in size. The plane lies within the X-Y-plane and has a depth of 0;

  Parameters:
    `quads` - the number of quads the plane has in x as well as in y direction
    `scale` - the size of each quad
  Returns:
    a plane

### getCone

    public static Object3D getCone(float scale)

  Returns a cone with 90 faces.

  Parameters:
    `scale` - the scaling of the cone
  Returns:
    a cone

### getCone

    public static Object3D getCone(int faces,
                                   float scale)

  Returns a cone with the given number of faces.

  Parameters:
    `faces` - the number of faces
    `scale` - the scaling of the cone
  Returns:
    a cone

### getCone

    public static Object3D getCone(int faces,
                                   float scale,
                                   float scaleHeight)

  Returns a cone with the given number of faces.

  Parameters:
    `faces` - the number of faces
    `scale` - the scaling of the cone
    `scaleHeight` - the height relative to the width
  Returns:
    a cone

### getCylinder

    public static Object3D getCylinder(float scale)

  Returns a cylinder with 90 faces.

  Parameters:
    `scale` - the scaling of the cylinder
  Returns:
    a cylinder

### getCylinder

    public static Object3D getCylinder(int faces,
                                       float scale)

  Returns a cylinder with the given number of faces.

  Parameters:
    `faces` - the number of faces
    `scale` - the scaling of the cylinder
  Returns:
    a cylinder

### getCylinder

    public static Object3D getCylinder(int faces,
                                       float scale,
                                       float scaleHeight)

  Returns a cylinder with the given number of faces.

  Parameters:
    `faces` - the number of faces
    `scale` - the scaling of the cylinder
    `scaleHeight` - the height relative to the width
  Returns:
    a cylinder

### getPyramide

    public static Object3D getPyramide(float scale)

  Returns a pyramide

  Parameters:
    `scale` - the scaling of the pyramide
  Returns:
    a pyramide

### getPyramide

    public static Object3D getPyramide(float scale,
                                       float scaleHeight)

  Returns a pyramide

  Parameters:
    `scale` - the scaling of the pyramide
    `scaleHeight` - the height relative to the width
  Returns:
    a pyramide

### getDoubleCone

    public static Object3D getDoubleCone(float scale)

  Returns a double cone with 90 faces.

  Parameters:
    `scale` - the scaling of the double cone
  Returns:
    a double cone

### getDoubleCone

    public static Object3D getDoubleCone(int faces,
                                         float scale)

  Returns a double cone with the given number of faces.

  Parameters:
    `faces` - the number of faces
    `scale` - the scaling of the double cone
  Returns:
    a double cone

### getCube

    public static Object3D getCube(float scale)

  Returns a cube. Please note that this cube isn't axis aligned, it's rotated 45 degrees around y.

  Parameters:
    `scale` - the scaling of the cube
  Returns:
    a cube

### getBox

    public static Object3D getBox(float scale,
                                  float scaleHeight)

  Returns a box (a 3-dimensional rectangle). Please note that this box isn't axis aligned, it's rotated 45 degrees around y.

  Parameters:
    `scale` - the scaling of the box
    `scaleHeight` - the height relative to the width (i.e. a scaleHeight-value of 1 will return a cube).
  Returns:
    a box

### getSphere

    public static Object3D getSphere(float scale)

  Returns a sphere with 20 faces.

  Parameters:
    `scale` - the scaling of the sphere
  Returns:
    a sphere

### getSphere

    public static Object3D getSphere(int faces,
                                     float scale)

  Returns a sphere with the given number of faces.

  Parameters:
    `faces` - the number of faces
    `scale` - the scaling of the sphere
  Returns:
    a sphere

### getEllipsoid

    public static Object3D getEllipsoid(float scale,
                                        float scaleHeight)

  Returns an ellipsoid with 20 faces.

  Parameters:
    `scale` - the scaling in x-direction
    `scaleHeight` - the scaling of the height relative to the width (1 creates a sphere)
  Returns:
    an ellipsoid

### getEllipsoid

    public static Object3D getEllipsoid(int faces,
                                        float scale,
                                        float scaleHeight)

  Returns an ellipsoid with he given number of faces.

  Parameters:
    `faces` - the number of faces
    `scale` - the scaling in x-direction
    `scaleHeight` - the scaling of the height relative to the width (1 creates a sphere)
  Returns:
    an ellipsoid

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD