Class Position
- java.lang.Object
-
- renderer.scene.Position
-
public final class Position extends Object
APosition
data structure represents a geometric object in a distinct location in three-dimensional camera space as part of aScene
.A
Position
object holds references to aModel
object and aVector
object. TheModel
represents the geometric object in theScene
. TheVector
determines the model's location in theCamera
coordinate system.When the renderer renders this
Position
'sModel
into aFrameBuffer
, the first stage of the rendering pipeline,Model2Camera
, adds thisPosition
's translationVector
to everyVertex
in theModel
's vertex list, which converts the coordinates in eachVertex
from 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 aPosition
object with all the given data.Position(Model model, Vector translation)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Model
getModel()
Get a reference to thisPosition
'sModel
object.Vector
getTranslation()
Get a reference to thisPosition
'sVector
object.Position
setModel(Model model)
Set thisPosition
'sModel
object.String
toString()
For debugging.Position
translate(double x, double y, double z)
Set thisPosition
's translationVector
object.
-
-
-
Constructor Detail
-
Position
public Position(Model model)
- Parameters:
model
-Model
object to place at thisPosition
- Throws:
NullPointerException
- ifmodel
isnull
-
Position
public Position(Model model, String name)
Construct aPosition
with the zero translationVector
, the givenString
name, and the givenModel
object.- Parameters:
model
-Model
object to place at thisPosition
name
-String
name for thisPosition
- Throws:
NullPointerException
- ifmodel
isnull
NullPointerException
- ifname
isnull
-
Position
public Position(Model model, String name, Vector translation)
Construct aPosition
with the given translationVector
, the givenString
name, and the givenModel
object.- Parameters:
model
-Model
object to place at thisPosition
name
-String
name for thisPosition
translation
- translationVector
for thisPosition
- Throws:
NullPointerException
- ifmodel
isnull
NullPointerException
- ifname
isnull
NullPointerException
- iftranslation
isnull
-
Position
public Position(Model model, Vector translation)
- Parameters:
model
-Model
object to place at thisPosition
translation
- translationVector
for thisPosition
- Throws:
NullPointerException
- ifmodel
isnull
NullPointerException
- iftranslation
isnull
-
Position
public Position(Model model, String name, Vector translation, boolean visible, boolean debug)
Construct aPosition
object with all the given data.- Parameters:
model
-Model
object to place at thisPosition
name
-String
name for thisPosition
translation
- translationVector
for thisPosition
visible
- boolean that determines thisPosition
's visibilitydebug
- boolean that determines if thisPosition
is logged- Throws:
NullPointerException
- ifmodel
isnull
NullPointerException
- iftranslation
isnull
NullPointerException
- ifname
isnull
-
-
Method Detail
-
getModel
public Model getModel()
Get a reference to thisPosition
'sModel
object.- Returns:
- a reference to this
Position
'sModel
object
-
setModel
public Position setModel(Model model)
Set thisPosition
'sModel
object.- Parameters:
model
-Model
object to place at thisPosition
- Returns:
- a reference to this
Position
object to facilitate chaining method calls - Throws:
NullPointerException
- ifmodel
isnull
-
getTranslation
public Vector getTranslation()
Get a reference to thisPosition
'sVector
object.- Returns:
- a reference to this
Position
'sVector
object
-
translate
public Position translate(double x, double y, double z)
Set thisPosition
's translationVector
object.- 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
Position
object to facilitate chaining method calls
-
-