Class Vertex
- java.lang.Object
-
- renderer.scene.Vertex
-
public final class Vertex extends Object
AVertexobject has three doubles which represent the coordinates of a point in 3-dimensional space.When a
Vertexobject is created in a client program, before theVertexobject moves down the graphics rendering pipeline, the coordinates in theVertexwill be in some model's local coordinate system.As a
Vertexobject moves down the graphics rendering pipeline, the coordinates in theVertexwill be transformed from one coordinate system to another.A
Vertexobject is immutable, so after it gets created it cannot be modified (mutated). So aVertexobject does not really "move" down the graphics pipeline. When aVertexobject needs to be transformed, we replace it, with a newVertexobject, instead of mutating it.
-
-
Constructor Summary
Constructors Constructor Description Vertex(double x, double y, double z)Construct a newVertexusing the givenx,y, andzcoordinates.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringtoString()For debugging.StringtoString(int precision)For debugging.StringtoString(int precision, int iWidth)For debugging.
-
-
-
Constructor Detail
-
Vertex
public Vertex(double x, double y, double z)
Construct a newVertexusing the givenx,y, andzcoordinates.- Parameters:
x- x-coordinate of the newVertexy- y-coordinate of the newVertexz- z-coordinate of the newVertex
-
-
Method Detail
-
toString
public String toString(int precision)
For debugging.Allow the precision of the formatted output to be specified.
- Parameters:
precision- precision value for the format string- Returns:
Stringrepresentation of thisVertexobject
-
toString
public String toString(int precision, int iWidth)
For debugging.Allow the precision and width of the formatted output to be specified. By width, we mean the width of the integer part of each number.
- Parameters:
precision- precision value for the format stringiWidth- width of the integer part of the format string- Returns:
Stringrepresentation of thisVertexobject
-
-