Class Position
- java.lang.Object
-
- renderer.scene.Position
-
public final class Position extends Object
APositiondata structure represents a geometric object in a distinct location in three-dimensional camera space as part of aScene.A
Positionobject holds references to aModelobject and aVectorobject. TheModelrepresents the geometric object in theScene. TheVectordetermines the model's location in theCameracoordinate system.When the renderer renders this
Position'sModelinto aFrameBuffer, the first stage of the rendering pipeline,Model2Camera, adds thisPosition's translationVectorto everyVertexin theModel's vertex list, which converts the coordinates in eachVertexfrom the model's own local coordinate system to theCamera's coordinate system (which is "shared" by all the other models in the scene). This vector addition has the effect of "placing" the model in camera space at an appropriate location.
-
-
Constructor Summary
Constructors Constructor Description Position(Model model)Position(Model model, String name)Position(Model model, String name, Vector translation)Position(Model model, String name, Vector translation, boolean visible, boolean debug)Construct aPositionobject with all the given data.Position(Model model, Vector translation)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ModelgetModel()Get a reference to thisPosition'sModelobject.VectorgetTranslation()Get a reference to thisPosition'sVectorobject.PositionsetModel(Model model)Set thisPosition'sModelobject.StringtoString()For debugging.Positiontranslate(double x, double y, double z)Set thisPosition's translationVectorobject.
-
-
-
Constructor Detail
-
Position
public Position(Model model)
- Parameters:
model-Modelobject to place at thisPosition- Throws:
NullPointerException- ifmodelisnull
-
Position
public Position(Model model, String name)
Construct aPositionwith the zero translationVector, the givenStringname, and the givenModelobject.- Parameters:
model-Modelobject to place at thisPositionname-Stringname for thisPosition- Throws:
NullPointerException- ifmodelisnullNullPointerException- ifnameisnull
-
Position
public Position(Model model, String name, Vector translation)
Construct aPositionwith the given translationVector, the givenStringname, and the givenModelobject.- Parameters:
model-Modelobject to place at thisPositionname-Stringname for thisPositiontranslation- translationVectorfor thisPosition- Throws:
NullPointerException- ifmodelisnullNullPointerException- ifnameisnullNullPointerException- iftranslationisnull
-
Position
public Position(Model model, Vector translation)
- Parameters:
model-Modelobject to place at thisPositiontranslation- translationVectorfor thisPosition- Throws:
NullPointerException- ifmodelisnullNullPointerException- iftranslationisnull
-
Position
public Position(Model model, String name, Vector translation, boolean visible, boolean debug)
Construct aPositionobject with all the given data.- Parameters:
model-Modelobject to place at thisPositionname-Stringname for thisPositiontranslation- translationVectorfor thisPositionvisible- boolean that determines thisPosition's visibilitydebug- boolean that determines if thisPositionis logged- Throws:
NullPointerException- ifmodelisnullNullPointerException- iftranslationisnullNullPointerException- ifnameisnull
-
-
Method Detail
-
getModel
public Model getModel()
Get a reference to thisPosition'sModelobject.- Returns:
- a reference to this
Position'sModelobject
-
setModel
public Position setModel(Model model)
Set thisPosition'sModelobject.- Parameters:
model-Modelobject to place at thisPosition- Returns:
- a reference to this
Positionobject to facilitate chaining method calls - Throws:
NullPointerException- ifmodelisnull
-
getTranslation
public Vector getTranslation()
Get a reference to thisPosition'sVectorobject.- Returns:
- a reference to this
Position'sVectorobject
-
translate
public Position translate(double x, double y, double z)
Set thisPosition's translationVectorobject.- Parameters:
x- translation amount in the x-directiony- translation amount in the y-directionz- translation amount in the z-direction- Returns:
- a reference to this
Positionobject to facilitate chaining method calls
-
-