org.vizzini.game.simulation
Class AbstractPhysicalObject

java.lang.Object
  extended by org.vizzini.game.AbstractToken
      extended by org.vizzini.game.simulation.AbstractPhysicalObject
All Implemented Interfaces:
Serializable, Cloneable, IToken, IForceConsumer, IForceProducer, IPhysicalObject, IStateful
Direct Known Subclasses:
DefaultPhysicalObject

public abstract class AbstractPhysicalObject
extends AbstractToken
implements IPhysicalObject

Provides base functionality for a physical object.

Since:
v0.3
Version:
v0.3
Author:
Jeffrey M. Thompson
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.vizzini.game.AbstractToken
UNKNOWN_NAME
 
Fields inherited from interface org.vizzini.game.IToken
AGENT_PROPERTY, NAME_PROPERTY, POSITION_PROPERTY, TEAM_PROPERTY
 
Constructor Summary
AbstractPhysicalObject()
           
 
Method Summary
 void applyForce(Vector force)
          Apply the given force through the center of mass to this object.
 void applyForce(Vector force, Vector position)
          Apply the given force at the given position to this object.
 void applyForceLocal(Vector force, Vector position)
          Apply the given force at the given position to this object where these vectors are expressed in local coordinates.
 Vector computeForce(IForceConsumer consumer)
          Return the force (kN) created by this system.
protected  Vector computeGravity(Vector position, double mass)
          Return the force (kN) created by this object at the mass at the given position.
 void configure(Properties properties, int index)
          Configure this token.
protected  Vector convertToLocal(Vector v)
          Return the given vector converted to local coordinates.
protected  StatefulSupport createStatefulSupport()
          Create a stateful support object.
 IState getAbsoluteState()
          Return the absolute state.
 Ellipsoid getBounds()
          Return the bounds ellipsoid.
 double getMass()
          Return the mass in kg.
 double getMu()
          Return the gravitational constant for this body.
protected  IDynamicState getMyState()
          Return the state.
 String getOrbitPrimaryName()
           
 IPosition getPosition()
          Return the position.
 IState getState()
          Return the state.
 IStateful getStatefulParent()
          Return the parent.
 boolean isLightSource()
           
 void setBounds(Ellipsoid bounds)
           
 void setLightSource(boolean isLightSource)
           
 void setMass(double mass)
          Set the mass of this object.
 void setMomentOfInertia(double[] momentOfInertia)
          Set the moment of inertia of this object.
 void setOrbitPrimaryName(String orbitPrimaryName)
           
 void setPosition(IPosition position)
          Set the position.
 void setStatefulParent(IStateful parent)
          Set the parent.
 
Methods inherited from class org.vizzini.game.AbstractToken
addPropertyChangeListener, clone, copy, equals, getAgent, getIndex, getName, getPropertyChangeManager, getTeam, getValue, hashCode, isFiringPositionChanges, removePropertyChangeListener, setAgent, setFiringPositionChanges, setIndex, setName, setTeam, setValue, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.vizzini.game.IToken
addPropertyChangeListener, clone, getAgent, getIndex, getName, getTeam, getValue, removePropertyChangeListener, setAgent, setName, setTeam, setValue
 

Constructor Detail

AbstractPhysicalObject

public AbstractPhysicalObject()
Method Detail

applyForce

public void applyForce(Vector force)
Apply the given force through the center of mass to this object.

Specified by:
applyForce in interface IForceConsumer
Parameters:
force - Force vector in world coordinates in kN units.
Since:
v0.3

applyForce

public void applyForce(Vector force,
                       Vector position)
Apply the given force at the given position to this object.

Specified by:
applyForce in interface IForceConsumer
Parameters:
force - Force vector in world coordinates in kN units.
position - Position of applied force relative to the center of mass in world coordinates in length units.
Since:
v0.3

applyForceLocal

public void applyForceLocal(Vector force,
                            Vector position)
Apply the given force at the given position to this object where these vectors are expressed in local coordinates.

Specified by:
applyForceLocal in interface IForceConsumer
Parameters:
force - Force vector in local coordinates in kN units.
position - Position of applied force relative to the center of mass in local coordinates in length units.
Since:
v0.3

computeForce

public Vector computeForce(IForceConsumer consumer)
Return the force (kN) created by this system.

Specified by:
computeForce in interface IForceProducer
Since:
v0.3

configure

public void configure(Properties properties,
                      int index)
Configure this token.

Specified by:
configure in interface IToken
Overrides:
configure in class AbstractToken
Parameters:
properties - Source of configuration information.
index - Index of this token's properties.
Since:
v0.3

getAbsoluteState

public IState getAbsoluteState()
Return the absolute state.

Specified by:
getAbsoluteState in interface IStateful
Since:
v0.3

getBounds

public Ellipsoid getBounds()
Description copied from interface: IPhysicalObject
Return the bounds ellipsoid.

Specified by:
getBounds in interface IPhysicalObject
Returns:
Return bounds.
Since:
v0.3

getMass

public double getMass()
Return the mass in kg.

Specified by:
getMass in interface IForceConsumer
Specified by:
getMass in interface IPhysicalObject
Since:
v0.3

getMu

public double getMu()
Return the gravitational constant for this body.

Since:
v0.3

getOrbitPrimaryName

public String getOrbitPrimaryName()
Returns:
Return orbitPrimaryName.
Since:
v0.3

getPosition

public IPosition getPosition()
Return the position.

Specified by:
getPosition in interface IToken
Overrides:
getPosition in class AbstractToken
Since:
v0.3

getState

public IState getState()
Return the state.

Specified by:
getState in interface IStateful
Since:
v0.3

getStatefulParent

public IStateful getStatefulParent()
Return the parent.

Specified by:
getStatefulParent in interface IStateful
Since:
v0.3

isLightSource

public boolean isLightSource()
Specified by:
isLightSource in interface IPhysicalObject
Returns:
Return isLightSource.
Since:
v0.3

setBounds

public void setBounds(Ellipsoid bounds)
Parameters:
bounds - the bounds to set
Since:
v0.3

setLightSource

public void setLightSource(boolean isLightSource)
Specified by:
setLightSource in interface IPhysicalObject
Parameters:
isLightSource - the isLightSource to set
Since:
v0.3

setMass

public void setMass(double mass)
Set the mass of this object.

Specified by:
setMass in interface IPhysicalObject
Since:
v0.3

setMomentOfInertia

public void setMomentOfInertia(double[] momentOfInertia)
Set the moment of inertia of this object.

Specified by:
setMomentOfInertia in interface IPhysicalObject
Since:
v0.3

setOrbitPrimaryName

public void setOrbitPrimaryName(String orbitPrimaryName)
Parameters:
orbitPrimaryName - the orbitPrimaryName to set
Since:
v0.3

setPosition

public void setPosition(IPosition position)
Set the position.

Specified by:
setPosition in interface IToken
Overrides:
setPosition in class AbstractToken
Since:
v0.3

setStatefulParent

public void setStatefulParent(IStateful parent)
Set the parent.

Specified by:
setStatefulParent in interface IStateful
Since:
v0.3

computeGravity

protected Vector computeGravity(Vector position,
                                double mass)
Return the force (kN) created by this object at the mass at the given position. F = -mu mass r / r^3

Since:
v0.3

convertToLocal

protected Vector convertToLocal(Vector v)
Return the given vector converted to local coordinates.

Parameters:
v - Vector in world coordinates.
Since:
v0.3

createStatefulSupport

protected StatefulSupport createStatefulSupport()
Create a stateful support object.

Since:
v0.3

getMyState

protected IDynamicState getMyState()
Return the state.

Since:
v0.3


Copyright 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02