|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--GP.Attributes.Velocity
Constructor Summary | |
Velocity()
Initializes velocity with default direction (0 degrees) and speed (1 pixel per move): |
|
Velocity(double dx,
double dy)
Initializes velocity that represents the given change in x and y. |
|
Velocity(Orientation direction,
double speed)
Initializes velocity with given direction and speed. |
|
Velocity(Orientation direction,
Value speed)
Initializes velocity with given direction and speed. |
|
Velocity(Position source,
Position target)
Initializes velocity that represents the direction and distance needed to move from the source to the target. |
|
Velocity(Velocity other)
Initializes velocity with identical values as given Velocity |
Method Summary | |
void |
Accelerate(double change)
Change the velocity's current speed, without changing its direction, by the given amount. |
void |
Accelerate(Value change)
Change the velocity's current speed, without changing its direction, by the given amount. |
Velocity |
Add(Velocity other)
|
Velocity |
Copy()
Creates an exact copy of the current velocity. |
Velocity |
Difference(Velocity other)
|
boolean |
equals(java.lang.Object o)
|
Orientation |
GetDirection()
|
Position |
GetNextPosition(Position current)
Creates a new GP.Attributes.Position based on moving the given position by the velocity's speed and direction. |
double |
GetSpeed()
|
double |
GetXChange()
|
double |
GetYChange()
|
Velocity |
Negate()
|
void |
SetDirection(double direction)
Set velocity's current direction in degrees from the positive x axis, without modifing its speed. |
void |
SetDirection(Orientation direction)
Set velocity's current direction in degrees from the positive x axis, without modifing its speed. |
void |
SetSpeed(double speed)
Set velocity's current speed, without changing its direction. |
void |
SetSpeed(Value speed)
Set velocity's current speed, without changing its direction. |
java.lang.String |
toString()
|
void |
Turn(double change)
Change velocity's current direction in degrees from the positive x axis, without modifing its speed. |
void |
Turn(Orientation change)
Change velocity's current direction in degrees from the positive x axis, without modifing its speed. |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Velocity()
public Velocity(Orientation direction, double speed)
public Velocity(Orientation direction, Value speed)
public Velocity(double dx, double dy)
public Velocity(Position source, Position target)
public Velocity(Velocity other)
Method Detail |
public Velocity Copy()
public Position GetNextPosition(Position current)
public Velocity Add(Velocity other)
public Velocity Difference(Velocity other)
public Velocity Negate()
public double GetSpeed()
public void SetSpeed(double speed)
speed
- velocity's new speedpublic void SetSpeed(Value speed)
speed
- velocity's new speedpublic void Accelerate(double change)
change
- amount to change velocity's speedpublic void Accelerate(Value change)
change
- amount to change velocity's speedpublic Orientation GetDirection()
public void SetDirection(double direction)
direction
- new direction of the velocity (in degrees)public void SetDirection(Orientation direction)
direction
- new direction of the velocitypublic void Turn(double change)
change
- amount to change direction of the velocitypublic void Turn(Orientation change)
change
- amount to change direction of the velocitypublic double GetXChange()
public double GetYChange()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |