Class Cone

    • Field Detail

      • r

        public final double r
      • h

        public final double h
      • n

        public final int n
      • k

        public final int k
    • Constructor Detail

      • Cone

        public Cone()
        Create a right circular cone with its base in the xz-plane, a base radius of 1, height 1, and apex on the positive y-axis.
      • Cone

        public Cone​(double r,
                    double h)
        Create a right circular cone with its base in the xz-plane, a base radius of r, height h, and apex on the y-axis.
        Parameters:
        r - radius of the base in the xz-plane
        h - height of the apex on the y-axis
      • Cone

        public Cone​(double r,
                    double h,
                    int n,
                    int k)
        Create a right circular cone with its base in the xz-plane, a base radius of r, height h, and apex on the y-axis.

        The last two parameters determine the number of lines of longitude and the number of circles of latitude in the model.

        If there are n circles of latitude in the model (including the bottom edge), then each line of longitude will have n+1 line segments. If there are k lines of longitude, then each circle of latitude will have k line segments.

        There must be at least three lines of longitude and at least one circle of latitude.

        By setting k to be a small integer, this model can also be used to create k-sided polygonal pyramids.

        Parameters:
        r - radius of the base in the xz-plane
        h - height of the apex on the y-axis
        n - number of circles of latitude around the cone
        k - number of lines of longitude
        Throws:
        IllegalArgumentException - if n is less than 2
        IllegalArgumentException - if k is less than 4
    • Method Detail

      • remake

        public Cone 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