Class Cylinder

    • Field Detail

      • r

        public final double r
      • h

        public final double h
      • n

        public final int n
      • k

        public final int k
    • Constructor Detail

      • Cylinder

        public Cylinder()
        Create a right circular cylinder with radius 1 and its axis along the y-axis from y = 1 to y = -1.
      • Cylinder

        public Cylinder​(double r,
                        double h)
        Create a right circular cylinder with radius r and its axis along the y-axis from y = h to y = -h.
        Parameters:
        r - radius of the cylinder
        h - height of the cylinder (from h to -h along the y-axis)
      • Cylinder

        public Cylinder​(double r,
                        double h,
                        int n,
                        int k)
        Create a right circular cylinder with radius r and its axis along the y-axis from y = h to y = -h.

        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 top and bottom edges), 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 two circles of latitude.

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

        Parameters:
        r - radius of the cylinder
        h - height of the cylinder (from h to -h along the y-axis)
        n - number of circles of latitude around the cylinder
        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 Cylinder 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