public class Cylinder extends CylinderSector
See https://en.wikipedia.org/wiki/Cylinder
This model can also be used to create right k-sided polygonal prisms.
CylinderSector
lineSegmentList, vertexList, visible
Constructor and Description |
---|
Cylinder()
Create a right circular cylinder with radius 1 and its
axis along the y-axis from
y = -1 to y = 1 . |
Cylinder(double r,
double h)
Create a right circular cylinder with radius
r and
its axis along the y-axis from y = -h to y = h . |
Cylinder(double r,
double h1,
double h2,
int n,
int k)
Create a right circular cylinder with radius
r and
its axis along the y-axis from y = h1 to y = h2 . |
Cylinder(double r,
double h,
int n,
int k)
Create a right circular cylinder with radius
r and
its axis along the y-axis from y = -h to y = h . |
addLineSegment, addLineSegment, addVertex, setColor, setColorRandom, setRandomColors, setRandomLineSegmentColors, toString
public Cylinder()
y = -1
to y = 1
.public Cylinder(double r, double h)
r
and
its axis along the y-axis from y = -h
to y = h
.r
- radius of the cylinderh
- height of the cylinder (from -h to h along the y-axis)public Cylinder(double r, double h1, double h2, int n, int k)
r
and
its axis along the y-axis from y = h1
to y = h2
.
The last two parameters determine the number of lines of longitude and the number of circles of latitude in the model.
Notice that if there are n
circles of latitude in the model
(including the top and bottom edges), then each line of longitude will
have n+1
line segments. If there are k
lines of longitude,
then each circle of latitude will have k
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.
r
- radius of the cylinderh1
- height (on the y-axis) of the base of the cylinderh2
- height (on the y-axis) of the top of the cylindern
- number of circles of latitude around the cylinderk
- number lines of longitudepublic Cylinder(double r, double h, int n, int k)
r
and
its axis along the y-axis from y = -h
to y = h
.
The last two parameters determine the number of lines of longitude and the number of circles of latitude in the model.
Notice that if there are n
circles of latitude in the model
(including the top and bottom edges), then each line of longitude will
have n+1
line segments. If there are k
lines of longitude,
then each circle of latitude will have k
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.
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 lines of longitude