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 intndoubletheta-
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 anglethetadegrees.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 voidbarycentric(int vIndex0, int vIndex1, int vIndex2, int n)Recursively use barycentric subdivision to put into thisModelvertices and line segments that subdivide the triangle whose vertices are indexed byvIndex0,vIndex1andvIndex2.intgetHorzCount()intgetVertCount()BarycentricTriangleremake(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
-
BarycentricTriangle
public BarycentricTriangle(int n)
Create a barycentricly subdivided equilateral triangle in the xy-plane with corners on the unit circle.The value of
nshould be less than 8.- Parameters:
n- number of barycentric subdivisions of the triangle- Throws:
IllegalArgumentException- ifnis 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 anglethetadegrees.The value of
nshould be less than 8.- Parameters:
theta- rotation (in degrees) of the equilateral trianglen- number of barycentric subdivisions of this triangle- Throws:
IllegalArgumentException- ifnis less than 0
-
-
Method Detail
-
barycentric
public void barycentric(int vIndex0, int vIndex1, int vIndex2, int n)
Recursively use barycentric subdivision to put into thisModelvertices and line segments that subdivide the triangle whose vertices are indexed byvIndex0,vIndex1andvIndex2.The value of
nshould 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:
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 BarycentricTriangle 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.
-
-