Package renderer.models_L
Class Pyramid
- java.lang.Object
-
- renderer.scene.Model
-
- renderer.models_L.Pyramid
-
- All Implemented Interfaces:
MeshMaker
public class Pyramid extends Model implements MeshMaker
Create a wireframe model of a right square pyramid with its base in the xz-plane and its apex on the positive y-axis.- See Also:
PyramidFrustum
-
-
Field Summary
Fields Modifier and Type Field Description double
h
int
k
int
n
double
s
-
Fields inherited from class renderer.scene.Model
colorList, name, primitiveList, vertexList, visible
-
-
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 ofs
, heighth
, 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 ofs
, heighth
, 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 ofs
, heighth
, and apex on the positive y-axis.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getHorzCount()
int
getVertCount()
Pyramid
remake(int n, int k)
Build an instance of theModel
with 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
-
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 ofs
, heighth
, and apex on the positive y-axis.- Parameters:
s
- side length of the base in the xz-planeh
- 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 ofs
, heighth
, and apex on the positive y-axis.- Parameters:
s
- side length of the base in the xz-planeh
- height of the apex on the y-axisn
- number of lines of latitude around the body of the pyramidk
- number of triangles in the triangle fan at the top of each side- Throws:
IllegalArgumentException
- ifn
is less than 1IllegalArgumentException
- ifk
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 ofs
, heighth
, 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-planeh
- height of the apex on the y-axisn
- number of lines of latitude around the body of the pyramidk
- number of triangles in the triangle fan at the top of each sidegrid
- choose either a square grid or a line fan in the base- Throws:
IllegalArgumentException
- ifn
is less than 1IllegalArgumentException
- ifk
is less than 1
-
-
Method Detail
-
getHorzCount
public int getHorzCount()
- Specified by:
getHorzCount
in interfaceMeshMaker
- Returns:
- the number of lines of latitude that the
Model
contains
-
getVertCount
public int getVertCount()
- Specified by:
getVertCount
in interfaceMeshMaker
- Returns:
- the number of lines of longitude that the
Model
contains
-
-