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 doublehintkintndoubler-
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 = 1toy = -1.Cylinder(double r, double h)Create a right circular cylinder with radiusrand its axis along the y-axis fromy = htoy = -h.Cylinder(double r, double h, int n, int k)Create a right circular cylinder with radiusrand its axis along the y-axis fromy = htoy = -h.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetHorzCount()intgetVertCount()Cylinderremake(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
-
Cylinder
public Cylinder()
Create a right circular cylinder with radius 1 and its axis along the y-axis fromy = 1toy = -1.
-
Cylinder
public Cylinder(double r, double h)
Create a right circular cylinder with radiusrand its axis along the y-axis fromy = htoy = -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 radiusrand its axis along the y-axis fromy = htoy = -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
ncircles of latitude in the model (including the top and bottom edges), then each line of longitude will haven+1line segments. If there areklines of longitude, then each circle of latitude will havekline segments.There must be at least three lines of longitude and at least two circles of latitude.
By setting
kto 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- ifnis less than 2IllegalArgumentException- ifkis less than 4
-
-
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
-
-