|
sdr 0.21 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.cscott.sdr.calls.Position
public class Position
Position objects represent the position and orientation of a dancer.
The (0,0) coordinate represents the center of the square (or formation),
and dancers
are nominally at least two units away from each other (although breathing
may change this). A zero rotation for 'facing direction' means
"facing the caller". Positive y is "towards the caller". Positive
x is "toward the caller's left/heads' right". Dancer number one
starts out at (-1, -3)
facing 0
.
Note that the facing
field MAY be null
to indicate "rotation unspecified" -- for example, for phantoms
or when specifying "general lines".
Field Summary | |
---|---|
Rotation |
facing
Facing direction. |
Fraction |
x
Location. |
Fraction |
y
Location. |
Constructor Summary | |
---|---|
Position(Fraction x,
Fraction y,
Rotation facing)
Create a Position object from the given x and y coordinates and Rotation . |
|
Position(int x,
int y,
Rotation facing)
Create a Position object with integer-valued x and y coordinates. |
Method Summary | |
---|---|
boolean |
equals(Object o)
|
Position |
forwardStep(Fraction distance)
Move the given distance in the facing direction. |
static Position |
getGrid(int x,
int y,
ExactRotation r)
Returns a position corresponding to the standard square dance grid. 0,0 is the center of the set, and odd coordinates between -3 and 3 correspond to the standard 4x4 grid. |
static Position |
getGrid(int x,
int y,
String direction)
Returns a position corresponding to the standard square dance grid. 0,0 is the center of the set, and odd coordinates between -3 and 3 correspond to the standard 4x4 grid. |
int |
hashCode()
|
Position |
normalize()
Normalize (restrict to 0-modulus) the rotation of the given position. |
Position |
rotateAroundOrigin(ExactRotation rot)
Rotate this position around the origin by the given amount. |
Position |
sideStep(Fraction distance)
Move the given distance perpendicular to the facing direction. |
String |
toString()
|
Position |
turn(Fraction amount)
Turn in place the given amount. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final Fraction x
public final Fraction y
public final Rotation facing
facing
should always be an
ExactRotation
for real (non-phantom) dancers.
Constructor Detail |
---|
public Position(Fraction x, Fraction y, Rotation facing)
Rotation
.
public Position(int x, int y, Rotation facing)
Method Detail |
---|
public Position forwardStep(Fraction distance)
facing
direction be an
ExactRotation
.
public Position sideStep(Fraction distance)
facing
direction be an
ExactRotation
.
public Position turn(Fraction amount)
public Position rotateAroundOrigin(ExactRotation rot)
public Position normalize()
public static Position getGrid(int x, int y, ExactRotation r)
null
IS a legal value for the
ExactRotation
.
public static Position getGrid(int x, int y, String direction)
ExactRotation.valueOf(String)
.
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
sdr 0.21 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |