Package renderer.models_L
Class TriangularPyramid
- java.lang.Object
-
- renderer.scene.Model
-
- renderer.models_L.TriangularPyramid
-
- All Implemented Interfaces:
MeshMaker
public class TriangularPyramid extends Model implements MeshMaker
Create a wireframe model of a tetrahedron as a triangular pyramid with an equilateral triangle base (centered at the origin in the xz-plane) whose three vertices are connected to a 4th vertex on the positive y-axis.- See Also:
Tetrahedron
-
-
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 TriangularPyramid()Create a regular tetrahedron having side lengthsqrt(3)/sqrt(2), with one face in the xz-plane with its center at the origin, and the 4th vertex on the positive y-axis at height 1.TriangularPyramid(double s)Create a regular tetrahedron having side lengths, with one face in the xz-plane with its center at the origin, and with the 4th vertex on the positive y-axis at heights*sqrt(2)/sqrt(3).TriangularPyramid(double r, double h)Create a tetrahedron with one face being an equilateral triangle inscribed in a circle of radiusrcentered at the origin of the xz-plane and with the 4th vertex on the y-axis at heighth.TriangularPyramid(double r, double h, int n, int k)Create a tetrahedron with one face being an equilateral triangle inscribed in a circle of radiusrcentered at the origin of the xz-plane and with the 4th vertex on the y-axis at heighth.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetHorzCount()intgetVertCount()TriangularPyramidremake(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
-
TriangularPyramid
public TriangularPyramid()
Create a regular tetrahedron having side lengthsqrt(3)/sqrt(2), with one face in the xz-plane with its center at the origin, and the 4th vertex on the positive y-axis at height 1.
-
TriangularPyramid
public TriangularPyramid(double s)
Create a regular tetrahedron having side lengths, with one face in the xz-plane with its center at the origin, and with the 4th vertex on the positive y-axis at heights*sqrt(2)/sqrt(3).- Parameters:
s- the length of the regular tetrahedron's sides
-
TriangularPyramid
public TriangularPyramid(double r, double h)
Create a tetrahedron with one face being an equilateral triangle inscribed in a circle of radiusrcentered at the origin of the xz-plane and with the 4th vertex on the y-axis at heighth.If
h = r * sqrt(2), then the tetrahedron is a regular tetrahedron. with side lengths = r * sqrt(3).Another way to state this is, if an equilateral triangle is inscribed in a circle of radius
r, then the edge length of the triangle isr*sqrt(3)and the height of the regular tetrahedron made from the triangle isr*sqrt(2).- Parameters:
r- radius of circle in xz-plane that the equilateral base is inscribed inh- coordinate on the y-axis of the apex
-
TriangularPyramid
public TriangularPyramid(double r, double h, int n, int k)
Create a tetrahedron with one face being an equilateral triangle inscribed in a circle of radiusrcentered at the origin of the xz-plane and with the 4th vertex on the y-axis at heighth.If
h = r * sqrt(2), then the tetrahedron is a regular tetrahedron. with side lengths = r * sqrt(3).Another way to state this is, if an equilateral triangle is inscribed in a circle of radius
r, then the edge length of the triangle isr*sqrt(3)and the height of the regular tetrahedron made from the triangle isr*sqrt(2).- Parameters:
r- radius of circle in xz-plane that the equilateral base is inscribed inh- coordinate on the y-axis of the apexn- number of lines of latitude around the body of the pyramidk- number of triangles in the triangle fan at the top of each side- Throws:
IllegalArgumentException- ifnis less than 1IllegalArgumentException- ifkis less than 1
-
-
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
-
remake
public TriangularPyramid remake(int n, int k)
Description copied from interface:MeshMakerBuild an instance of theModelwith new values for the number of lines of latitude and longitude while keeping all the other model parameters the same.
-
-