Class Pyramid

    • Constructor Summary

      Constructors 
      Constructor Description
      Pyramid()
      Create a right square pyramid with its base in the xz-plane, a base side length of 2, height 1, and apex on the positive y-axis.
      Pyramid​(double s, double h)
      Create a right square pyramid with its base in the xz-plane, a base length of s, height h, and apex on the positive y-axis.
      Pyramid​(double s, double h, int n, int k)
      Create a right square pyramid with its base in the xz-plane, a base length of s, height h, and apex on the positive y-axis.
      Pyramid​(double s, double h, int n, int k, boolean grid)
      Create a right square pyramid with its base in the xz-plane, a base length of s, height h, and apex on the positive y-axis.
    • Field Detail

      • s

        public final double s
      • h

        public final double h
      • n

        public final int n
      • k

        public final int k
    • Constructor Detail

      • Pyramid

        public Pyramid()
        Create a right square pyramid with its base in the xz-plane, a base side length of 2, height 1, and apex on the positive y-axis.
      • Pyramid

        public Pyramid​(double s,
                       double h)
        Create a right square pyramid with its base in the xz-plane, a base length of s, height h, and apex on the positive y-axis.
        Parameters:
        s - side length of the base in the xz-plane
        h - height of the apex on the y-axis
      • Pyramid

        public Pyramid​(double s,
                       double h,
                       int n,
                       int k)
        Create a right square pyramid with its base in the xz-plane, a base length of s, height h, and apex on the positive y-axis.
        Parameters:
        s - side length of the base in the xz-plane
        h - height of the apex on the y-axis
        n - number of lines of latitude around the body of the pyramid
        k - number of triangles in the triangle fan at the top of each side
        Throws:
        IllegalArgumentException - if n is less than 1
        IllegalArgumentException - if k is less than 1
      • Pyramid

        public Pyramid​(double s,
                       double h,
                       int n,
                       int k,
                       boolean grid)
        Create a right square pyramid with its base in the xz-plane, a base length of s, height h, and apex on the positive y-axis.

        The last parameter provides a choice between having a square grid of lines or a line fan in the base of the pyramid.

        Parameters:
        s - side length of the base in the xz-plane
        h - height of the apex on the y-axis
        n - number of lines of latitude around the body of the pyramid
        k - number of triangles in the triangle fan at the top of each side
        grid - choose either a square grid or a line fan in the base
        Throws:
        IllegalArgumentException - if n is less than 1
        IllegalArgumentException - if k is less than 1
    • Method Detail

      • remake

        public Pyramid remake​(int n,
                              int k)
        Description copied from interface: MeshMaker
        Build an instance of the Model with new values for the number of lines of latitude and longitude while keeping all the other model parameters the same.
        Specified by:
        remake in interface MeshMaker
        Parameters:
        n - number of lines of latitude for the returned Model
        k - number of lines of longitude for the returned Model
        Returns:
        a new instance of the Model with the updated parameters