|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectUser
public class User
Represents the state of the moving user.
| Constructor Summary | |
|---|---|
User(User base)
Constructs a user identical to the given user. |
|
User(World world)
Constructs a user in the given world, at coordinates (0,0) facing east (1,0). |
|
| Method Summary | |
|---|---|
void |
addUserListener(UserListener l)
Adds a listener to the user's movements. |
double |
getTheta()
Returns the angle of this user's current direction, measured in radians. |
double |
getViewAngle()
Returns the angle that the user should be able to see vertically. |
Ray |
getViewRay(double sx)
Returns a ray emanating from the user's location through the window at fraction sx from center. |
World |
getWorld()
Returns the world in which this user is moving. |
double |
getX()
Returns the x-coordinate of this user's current position. |
double |
getY()
Returns the y-coordinate of this user's current position. |
void |
removeUserListener(UserListener l)
Removes a listener to the user's movements. |
void |
turnAndStep(double th,
double dist)
Turns the user and steps the user forward simulaneously. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public User(World world)
public User(User base)
| Method Detail |
|---|
public World getWorld()
public double getX()
public double getY()
public double getTheta()
public double getViewAngle()
public void addUserListener(UserListener l)
public void removeUserListener(UserListener l)
public Ray getViewRay(double sx)
sx from center.
The sx parameter should be 0.0 for center,
0.5 for being as far to the right as half the window's
height, and -0.5 for being as far to the left as half
the window's height.
sx - the distance from the window's center desired,
measured in terms of the screen's height.
public void turnAndStep(double th,
double dist)
th - the angle, in radians, to turn.dist - the distance to go forward.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||