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 doublehintkintndoubler-
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 intgetHorzCount()intgetVertCount()Coneremake(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
-
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
ncircles of latitude in the model (including the bottom edge), 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 one circle of latitude.
By setting
kto 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- 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
-
-