Package renderer.models_L
Class SquareGrid
- java.lang.Object
-
- renderer.scene.Model
-
- renderer.models_L.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.
-
-
Field Summary
Fields Modifier and Type Field Description intkintndoubler-
Fields inherited from class renderer.scene.Model
colorList, name, primitiveList, vertexList, visible
-
-
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 withngrid 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 withngrid lines parallel to the x-axis and withkgrid lines parallel to the y-axis.SquareGrid(int n)Create a square in the xy-plane with corners(±1, ±1, 0)and withngrid 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 withngrid lines parallel to the x-axis and withkgrid lines parallel to the y-axis.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetHorzCount()intgetVertCount()SquareGridremake(int n, int k)Build an instance of theModelwith new values for the number of lines of latitude and longitude while keeping all the other model parameters the same.-
Methods inherited from class renderer.scene.Model
addColor, addPrimitive, addVertex, getPrimitive, toString
-
-
-
-
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 withngrid lines parallel to each of the x and y axes.- Parameters:
n- number of grid lines parallel to the axes- Throws:
IllegalArgumentException- ifnis less than 0
-
SquareGrid
public SquareGrid(int n, int k)
Create a square in the xy-plane with corners(±1, ±1, 0)and withngrid lines parallel to the x-axis and withkgrid lines parallel to the y-axis.If there are
ngrid lines parallel to the x-axis, then each grid line parallel to the y-axis will haven+1line segments. If there arekgrid lines parallel to the y-axis, then each grid line parallel to the x-axis will havek+1line segments.- Parameters:
n- number of grid lines parallel to the x-axisk- number of grid lines parallel to the y-axis- Throws:
IllegalArgumentException- ifnis less than 0IllegalArgumentException- ifkis 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- ifris 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 withngrid lines parallel to each of the x and y axes.- Parameters:
r- determines the corners of the squaren- number of grid lines parallel to the axes- Throws:
IllegalArgumentException- ifnis less than 0IllegalArgumentException- ifris 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 withngrid lines parallel to the x-axis and withkgrid lines parallel to the y-axis.If there are
ngrid lines parallel to the x-axis, then each grid line parallel to the y-axis will haven+1line segments. If there arekgrid lines parallel to the y-axis, then each grid line parallel to the x-axis will havek+1line segments.- Parameters:
r- determines the corners of the squaren- number of grid lines parallel to the x-axisk- number of grid lines parallel to the y-axis- Throws:
IllegalArgumentException- ifnis less than 0IllegalArgumentException- ifkis less than 0IllegalArgumentException- ifris less than or equal to 0
-
-
Method Detail
-
getHorzCount
public int getHorzCount()
- Specified by:
getHorzCountin interfaceMeshMaker- Returns:
- the number of lines of latitude that the
Modelcontains
-
getVertCount
public int getVertCount()
- Specified by:
getVertCountin interfaceMeshMaker- Returns:
- the number of lines of longitude that the
Modelcontains
-
remake
public SquareGrid remake(int n, int k)
Description copied from interface:MeshMakerBuild an instance of theModelwith new values for the number of lines of latitude and longitude while keeping all the other model parameters the same.
-
-