Package renderer.models_L
Class CylinderSector
- java.lang.Object
-
- renderer.scene.Model
-
- renderer.models_L.CylinderSector
-
- All Implemented Interfaces:
MeshMaker
public class CylinderSector extends Model implements MeshMaker
Create a wireframe model of a partial right circular cylinder with its axis along the y-axis.By a partial cylinder we mean a cylinder over a circular sector of the cylinder's base.
- See Also:
Cylinder
,CircleSector
,DiskSector
,RingSector
,ConeSector
,SphereSector
,TorusSector
-
-
Constructor Summary
Constructors Constructor Description CylinderSector()
Create half of a cylinder with radius 1 and its axis along the y-axis fromy = 1
toy = -1
.CylinderSector(double r, double h, double theta1, double theta2, int n, int k)
Create a part of the 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()
CylinderSector
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
-
CylinderSector
public CylinderSector()
Create half of a cylinder with radius 1 and its axis along the y-axis fromy = 1
toy = -1
.
-
CylinderSector
public CylinderSector(double r, double h, double theta1, double theta2, int n, int k)
Create a part of the cylinder with radiusr
and its axis along the y-axis fromy = h
toy = -h
.The partial cylinder is a cylinder over the circular sector from angle
theta1
to angletheta2
(in the counterclockwise direction).The last two parameters determine the number of lines of longitude and the number of (partial) circles of latitude in the model.
If there are
n
circles of latitude in the model, then each line of longitude will haven-1
line segments. If there arek
lines of longitude, then each (partial) circle of latitude will havek-1
line segments.There must be at least four lines of longitude and at least two circles of latitude.
- Parameters:
r
- radius of the cylinderh
- height of the cylinder (from h to -h along the y-axis)theta1
- beginning longitude angle of the sector (in radians)theta2
- ending longitude angle of the sector (in radians)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
-
remake
public CylinderSector remake(int n, int k)
Description copied from interface:MeshMaker
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.
-
-