Package renderer.models_L
Class BarycentricTriangle
- java.lang.Object
-
- renderer.scene.Model
-
- renderer.models_L.BarycentricTriangle
-
- All Implemented Interfaces:
MeshMaker
public class BarycentricTriangle extends Model implements MeshMaker
Create a wireframe model of a barycentricly subdivided equilateral triangle. See https://en.wikipedia.org/wiki/Barycentric_subdivision
-
-
Field Summary
Fields Modifier and Type Field Description int
n
double
theta
-
Fields inherited from class renderer.scene.Model
colorList, name, primitiveList, vertexList, visible
-
-
Constructor Summary
Constructors Constructor Description BarycentricTriangle(double theta, int n)
Create a barycentricly subdivided equilateral triangle in the xy-plane with corners on the unit circle and rotated by angletheta
degrees.BarycentricTriangle(int n)
Create a barycentricly subdivided equilateral triangle in the xy-plane with corners on the unit circle.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
barycentric(int vIndex0, int vIndex1, int vIndex2, int n)
Recursively use barycentric subdivision to put into thisModel
vertices and line segments that subdivide the triangle whose vertices are indexed byvIndex0
,vIndex1
andvIndex2
.int
getHorzCount()
int
getVertCount()
BarycentricTriangle
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
-
BarycentricTriangle
public BarycentricTriangle(int n)
Create a barycentricly subdivided equilateral triangle in the xy-plane with corners on the unit circle.The value of
n
should be less than 8.- Parameters:
n
- number of barycentric subdivisions of the triangle- Throws:
IllegalArgumentException
- ifn
is less than 0
-
BarycentricTriangle
public BarycentricTriangle(double theta, int n)
Create a barycentricly subdivided equilateral triangle in the xy-plane with corners on the unit circle and rotated by angletheta
degrees.The value of
n
should be less than 8.- Parameters:
theta
- rotation (in degrees) of the equilateral trianglen
- number of barycentric subdivisions of this triangle- Throws:
IllegalArgumentException
- ifn
is less than 0
-
-
Method Detail
-
barycentric
public void barycentric(int vIndex0, int vIndex1, int vIndex2, int n)
Recursively use barycentric subdivision to put into thisModel
vertices and line segments that subdivide the triangle whose vertices are indexed byvIndex0
,vIndex1
andvIndex2
.The value of
n
should be less than 8.- Parameters:
vIndex0
- index of a {link Vertex} of a trianglevIndex1
- index of a {link Vertex} of a trianglevIndex2
- index of a {link Vertex} of a trianglen
- number of barycentric subdivisions of this triangle
-
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 BarycentricTriangle 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.
-
-