Class Cube2


  • public class Cube2
    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 each face of the cube cut up by an n by m grid of 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, Cube3, Cube4
    • Constructor Detail

      • Cube2

        public Cube2()
        Create a cube with its center at the origin, having edge length 2, with its corners at (±1, ±1, ±1). and with two perpendicular grid lines going across the middle of each of the cube's faces.
      • Cube2

        public Cube2​(int xGrid,
                     int yGrid,
                     int zGrid)
        Create a cube with its center at the origin, having edge length 2, with its corners at (±1, ±1, ±1), and with each of the cube's faces containing the given number of grid lines parallel to the x, y, and z directions.
        Parameters:
        xGrid - number of grid lines perpendicular to the x-axis
        yGrid - number of grid lines perpendicular to the y-axis
        zGrid - number of grid lines perpendicular to the z-axis
        Throws:
        IllegalArgumentException - if xGrid is less than 0
        IllegalArgumentException - if yGrid is less than 0
        IllegalArgumentException - if zGrid is less than 0