Package renderer.models_L
Class Octahedron
- java.lang.Object
-
- renderer.scene.Model
-
- renderer.models_L.Octahedron
-
- All Implemented Interfaces:
MeshMaker
public class Octahedron extends Model implements MeshMaker
Create a wireframe model of a regular octahedron with its center at the origin, having side lengthsqrt(2) = 1.4142
,with its center plane given by the four vertices(±1, 0, ±1)
. and with the top and bottom vertices being(0, ±1, 0)
.- See Also:
Tetrahedron
,Cube
,Icosahedron
,Dodecahedron
-
-
Field Summary
Fields Modifier and Type Field Description int
n1
int
n2
int
n3
-
Fields inherited from class renderer.scene.Model
colorList, name, primitiveList, vertexList, visible
-
-
Constructor Summary
Constructors Constructor Description Octahedron()
Create a regular octahedron with its center at the origin, having side lengthsqrt(2) = 1.4142
, with its center plane given by the four vertices(±1, 0, ±1)
.Octahedron(int n)
Create a regular octahedron with its center at the origin, having side lengthsqrt(2) = 1.4142
, with its center plane given by the four vertices(±1, 0, ±1)
.Octahedron(int n1, int n2, int n3)
Create a regular octahedron with its center at the origin, having side lengthsqrt(2) = 1.4142
, with its center plane given by the four vertices(±1, 0, ±1)
.Octahedron(int n1a, int n1b, int n2a, int n2b, int n3a, int n3b)
Create a regular octahedron with its center at the origin, having side lengthsqrt(2) = 1.4142
, with its center plane given by the four vertices(±1, 0, ±1)
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getHorzCount()
int
getVertCount()
Octahedron
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
-
Octahedron
public Octahedron()
Create a regular octahedron with its center at the origin, having side lengthsqrt(2) = 1.4142
, with its center plane given by the four vertices(±1, 0, ±1)
. and with the top and bottom vertices being(0, ±1, 0)
.
-
Octahedron
public Octahedron(int n)
Create a regular octahedron with its center at the origin, having side lengthsqrt(2) = 1.4142
, with its center plane given by the four vertices(±1, 0, ±1)
. and with the top and bottom vertices being(0, ±1, 0)
.Add line segments fanning out from the top and bottom vertices to the sides around the center plane.
- Parameters:
n
- number of lines fanning out from the top and bottom on each side of the octahedron- Throws:
IllegalArgumentException
- ifn1
is less than 0IllegalArgumentException
- ifn2
is less than 0
-
Octahedron
public Octahedron(int n1, int n2, int n3)
Create a regular octahedron with its center at the origin, having side lengthsqrt(2) = 1.4142
, with its center plane given by the four vertices(±1, 0, ±1)
. and with the top and bottom vertices being(0, ±1, 0)
.Add line segments fanning out from each vertex to its opposite sides.
- Parameters:
n1
- number of lines fanning out from the top and bottom on each side of the octahedronn2
- number of lines fanning out from v0 and v2 on each side of the octahedronn3
- number of lines fanning out from v1 and v3 on each side of the octahedron- Throws:
IllegalArgumentException
- ifn1
is less than 0IllegalArgumentException
- ifn2
is less than 0IllegalArgumentException
- ifn3
is less than 0
-
Octahedron
public Octahedron(int n1a, int n1b, int n2a, int n2b, int n3a, int n3b)
Create a regular octahedron with its center at the origin, having side lengthsqrt(2) = 1.4142
, with its center plane given by the four vertices(±1, 0, ±1)
. and with the top and bottom vertices being(0, ±1, 0)
.Add line segments fanning out from each vertex to its opposite sides.
- Parameters:
n1a
- number of lines fanning out from the top on each side of the octahedronn1b
- number of lines fanning out from the bottom on each side of the octahedronn2a
- number of lines fanning out from v0 on each side of the octahedronn2b
- number of lines fanning out from v1 on each side of the octahedronn3a
- number of lines fanning out from v2 on each side of the octahedronn3b
- number of lines fanning out from v3 on each side of the octahedron- Throws:
IllegalArgumentException
- ifn1a
is less than 0IllegalArgumentException
- ifn1b
is less than 0IllegalArgumentException
- ifn2a
is less than 0IllegalArgumentException
- ifn2b
is less than 0IllegalArgumentException
- ifn3a
is less than 0IllegalArgumentException
- ifn3b
is less than 0
-
-
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 Octahedron 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.
-
-