Class Cone
- java.lang.Object
-
- renderer.scene.Model
-
- renderer.models_L.Cone
-
- All Implemented Interfaces:
MeshMaker
public class Cone extends Model implements MeshMaker
Create a wireframe model of a right circular cone with its base parallel to the xz-plane and its apex on the positive y-axis.See https://en.wikipedia.org/wiki/Cone
This model can also be used to create right k-sided polygonal pyramids.
- See Also:
ConeFrustum
-
-
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 Cone()
Create a right circular cone with its base in the xz-plane, a base radius of 1, height 1, and apex on the positive y-axis.Cone(double r, double h)
Create a right circular cone with its base in the xz-plane, a base radius ofr
, heighth
, and apex on the y-axis.Cone(double r, double h, int n, int k)
Create a right circular cone with its base in the xz-plane, a base radius ofr
, heighth
, and apex on the y-axis.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getHorzCount()
int
getVertCount()
Cone
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
-
Cone
public Cone()
Create a right circular cone with its base in the xz-plane, a base radius of 1, height 1, and apex on the positive y-axis.
-
Cone
public Cone(double r, double h)
Create a right circular cone with its base in the xz-plane, a base radius ofr
, heighth
, and apex on the y-axis.- Parameters:
r
- radius of the base in the xz-planeh
- height of the apex on the y-axis
-
Cone
public Cone(double r, double h, int n, int k)
Create a right circular cone with its base in the xz-plane, a base radius ofr
, heighth
, and apex on the y-axis.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 bottom edge), 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 one circle of latitude.
By setting
k
to be a small integer, this model can also be used to create k-sided polygonal pyramids.- Parameters:
r
- radius of the base in the xz-planeh
- height of the apex on the y-axisn
- number of circles of latitude around the conek
- 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
-
-