Class Cube4


  • public class Cube4
    extends Model
    Create a wireframe model of a cube with its center at the origin, having edge length 2, and with its corners at (±1, ±1, ±1).

    This version of the cube model has the top and bottom faces of the cube cut up by a triangle fan and the front, back, right, and left faces cut up by a grid of perpendicular lines.

    Here is a picture showing how the cube's eight corners are labeled.

    
                      v4=(-1,1,-1)
                      +---------------------+ v5=(1,1,-1)
                     /|                    /|
                    / |                   / |
                   /  |                  /  |
                  /   |                 /   |
                 /    |                /    |
             v7 +---------------------+ v6  |
                |     |               |     |
                |     |               |     |
                |     | v0=(-1,-1,-1) |     |
                |     +---------------|-----+ v1=(1,-1,-1)
                |    /                |    /
                |   /                 |   /
                |  /                  |  /
                | /                   | /
                |/                    |/
                +---------------------+
                v3=(-1,-1,1)          v2=(1,-1,1)
    
    See Also:
    Cube, Cube2, Cube3
    • Constructor Detail

      • Cube4

        public Cube4()
        Create a cube with its center at the origin, having edge length 2, with its corners at (±1, ±1, ±1). with a triangle fan of eight triangles in top and bottom faces, and two perpendicular lines cutting each of the front, back, right, and left faces.
      • Cube4

        public Cube4​(int xCount,
                     int yGrid,
                     int zCount)
        Create a cube with its center at the origin, having edge length 2, with its corners at (±1, ±1, ±1), and with the top and bottom faces containing a triangle fan with the given number of triangles along each of the x, and z directions.

        There must be at least one triangle along the x and z directions.

        Parameters:
        xCount - number of triangles along the x-direction
        yGrid - number of grid lines perpendicular to the y-axis
        zCount - number of triangles along the z-direction
        Throws:
        IllegalArgumentException - if xCount is less than 1
        IllegalArgumentException - if yGrid is less than 0
        IllegalArgumentException - if zCount is less than 1