Class Cylinder
- java.lang.Object
-
- renderer.scene.Model
-
- renderer.models_L.Cylinder
-
- All Implemented Interfaces:
MeshMaker
public class Cylinder extends Model implements MeshMaker
Create a wireframe model of a right circular cylinder with its axis along the y-axis.See https://en.wikipedia.org/wiki/Cylinder
This model can also be used to create right k-sided polygonal prisms.
- See Also:
CylinderSector
-
-
Field Summary
Fields Modifier and Type Field Description double
h
int
k
int
n
double
r
-
Fields inherited from class renderer.scene.Model
colorList, name, primitiveList, vertexList, visible
-
-
Constructor Summary
Constructors Constructor Description Cylinder()
Create a right circular cylinder with radius 1 and its axis along the y-axis fromy = 1
toy = -1
.Cylinder(double r, double h)
Create a right circular cylinder with radiusr
and its axis along the y-axis fromy = h
toy = -h
.Cylinder(double r, double h, int n, int k)
Create a right circular cylinder with radiusr
and its axis along the y-axis fromy = h
toy = -h
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getHorzCount()
int
getVertCount()
Cylinder
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
-
Cylinder
public Cylinder()
Create a right circular cylinder with radius 1 and its axis along the y-axis fromy = 1
toy = -1
.
-
Cylinder
public Cylinder(double r, double h)
Create a right circular cylinder with radiusr
and its axis along the y-axis fromy = h
toy = -h
.- Parameters:
r
- radius of the cylinderh
- 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 radiusr
and its axis along the y-axis fromy = h
toy = -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 haven+1
line segments. If there arek
lines of longitude, then each circle of latitude will havek
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 cylinderh
- height of the cylinder (from h to -h along the y-axis)n
- number of circles of latitude around the cylinderk
- number of lines of longitude- Throws:
IllegalArgumentException
- ifn
is less than 2IllegalArgumentException
- ifk
is less than 4
-
-
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
-
-