Class SquareGrid

  • All Implemented Interfaces:
    MeshMaker

    public class SquareGrid
    extends Model
    implements MeshMaker
    Create a wireframe model of a square in the xy-plane centered at the origin.
    • Constructor Summary

      Constructors 
      Constructor Description
      SquareGrid()
      Create a square in the xy-plane with corners (±1, ±1, 0).
      SquareGrid​(double r)
      Create a square in the xy-plane with corners (±r, ±r, 0).
      SquareGrid​(double r, int n)
      Create a square in the xy-plane with corners (±r, ±r, 0) and with n grid lines parallel to each of the x and y axes.
      SquareGrid​(double r, int n, int k)
      Create a square in the xy-plane with corners (±r, ±r, 0) and with n grid lines parallel to the x-axis and with k grid lines parallel to the y-axis.
      SquareGrid​(int n)
      Create a square in the xy-plane with corners (±1, ±1, 0) and with n grid lines parallel to each of the x and y axes.
      SquareGrid​(int n, int k)
      Create a square in the xy-plane with corners (±1, ±1, 0) and with n grid lines parallel to the x-axis and with k grid lines parallel to the y-axis.
    • Field Detail

      • r

        public final double r
      • n

        public final int n
      • k

        public final int k
    • Constructor Detail

      • SquareGrid

        public SquareGrid()
        Create a square in the xy-plane with corners (±1, ±1, 0).
      • SquareGrid

        public SquareGrid​(int n)
        Create a square in the xy-plane with corners (±1, ±1, 0) and with n grid lines parallel to each of the x and y axes.
        Parameters:
        n - number of grid lines parallel to the axes
        Throws:
        IllegalArgumentException - if n is less than 0
      • SquareGrid

        public SquareGrid​(int n,
                          int k)
        Create a square in the xy-plane with corners (±1, ±1, 0) and with n grid lines parallel to the x-axis and with k grid lines parallel to the y-axis.

        If there are n grid lines parallel to the x-axis, then each grid line parallel to the y-axis will have n+1 line segments. If there are k grid lines parallel to the y-axis, then each grid line parallel to the x-axis will have k+1 line segments.

        Parameters:
        n - number of grid lines parallel to the x-axis
        k - number of grid lines parallel to the y-axis
        Throws:
        IllegalArgumentException - if n is less than 0
        IllegalArgumentException - if k is less than 0
      • SquareGrid

        public SquareGrid​(double r)
        Create a square in the xy-plane with corners (±r, ±r, 0).
        Parameters:
        r - determines the corners of the square
        Throws:
        IllegalArgumentException - if r is less than or equal to 0
      • SquareGrid

        public SquareGrid​(double r,
                          int n)
        Create a square in the xy-plane with corners (±r, ±r, 0) and with n grid lines parallel to each of the x and y axes.
        Parameters:
        r - determines the corners of the square
        n - number of grid lines parallel to the axes
        Throws:
        IllegalArgumentException - if n is less than 0
        IllegalArgumentException - if r is less than or equal to 0
      • SquareGrid

        public SquareGrid​(double r,
                          int n,
                          int k)
        Create a square in the xy-plane with corners (±r, ±r, 0) and with n grid lines parallel to the x-axis and with k grid lines parallel to the y-axis.

        If there are n grid lines parallel to the x-axis, then each grid line parallel to the y-axis will have n+1 line segments. If there are k grid lines parallel to the y-axis, then each grid line parallel to the x-axis will have k+1 line segments.

        Parameters:
        r - determines the corners of the square
        n - number of grid lines parallel to the x-axis
        k - number of grid lines parallel to the y-axis
        Throws:
        IllegalArgumentException - if n is less than 0
        IllegalArgumentException - if k is less than 0
        IllegalArgumentException - if r is less than or equal to 0
    • Method Detail

      • remake

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