Whitespace
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@886 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -91,23 +91,19 @@ public class ArcPath extends TimedPath
|
||||
*/
|
||||
public Path getTranslatedInstance (int x, int y)
|
||||
{
|
||||
int startx =
|
||||
(int)(_center.x + Math.round(Math.cos(_sangle) * _xradius));
|
||||
int starty =
|
||||
(int)(_center.y + Math.round(Math.sin(_sangle) * _yradius));
|
||||
int startx = (int)(_center.x + Math.round(Math.cos(_sangle) * _xradius));
|
||||
int starty = (int)(_center.y + Math.round(Math.sin(_sangle) * _yradius));
|
||||
|
||||
return new ArcPath(new Point(startx + x, starty + y),
|
||||
_xradius, _yradius, _sangle, _delta, _duration, _orient);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the offset that is applied to the pathable whenever it is
|
||||
* oriented. This offset is in clockwise units whose granularity is
|
||||
* specified by the {@link #NORMAL} or {@link #FINE} setting supplied
|
||||
* to the path at construct time. The intent here is to allow arc
|
||||
* paths to be applied that don't orient the pathable in the direction
|
||||
* they are traveling but instead in some fixed offset from that
|
||||
* direction.
|
||||
* Sets the offset that is applied to the pathable whenever it is oriented. This offset is in
|
||||
* clockwise units whose granularity is specified by the {@link #NORMAL} or {@link #FINE}
|
||||
* setting supplied to the path at construct time. The intent here is to allow arc paths to be
|
||||
* applied that don't orient the pathable in the direction they are traveling but instead in
|
||||
* some fixed offset from that direction.
|
||||
*/
|
||||
public void setOrientOffset (int offset)
|
||||
{
|
||||
@@ -136,8 +132,8 @@ public class ArcPath extends TimedPath
|
||||
angle = _sangle + _delta;
|
||||
|
||||
} else {
|
||||
// otherwise, compute the angle at which we should place the
|
||||
// pathable based on the elapsed time
|
||||
// otherwise, compute the angle at which we should place the pathable based on the
|
||||
// elapsed time
|
||||
long elapsed = timestamp - _startStamp;
|
||||
angle = _sangle + _delta * elapsed / _duration;
|
||||
}
|
||||
@@ -215,10 +211,9 @@ public class ArcPath extends TimedPath
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the position of an entity along the path defined by the
|
||||
* supplied parameters assuming that it must finish the path in the
|
||||
* specified duration (in millis) and has been traveling the path for
|
||||
* the specified number of elapsed milliseconds.
|
||||
* Computes the position of an entity along the path defined by the supplied parameters
|
||||
* assuming that it must finish the path in the specified duration (in millis) and has been
|
||||
* traveling the path for the specified number of elapsed milliseconds.
|
||||
*/
|
||||
public static void computePosition (
|
||||
Point center, double xradius, double yradius, double angle, Point pos)
|
||||
@@ -242,7 +237,6 @@ public class ArcPath extends TimedPath
|
||||
/** An orientation offset used when orienting our pathable. */
|
||||
protected int _orientOffset = 0;
|
||||
|
||||
/** A temporary point used when computing our position along the
|
||||
* path. */
|
||||
/** A temporary point used when computing our position along the path. */
|
||||
protected Point _tpos = new Point();
|
||||
}
|
||||
|
||||
@@ -36,8 +36,7 @@ public class BobblePath implements Path
|
||||
*
|
||||
* @param dx the variance in the x direction.
|
||||
* @param dy the variance in the y direction.
|
||||
* @param duration the duration to bobble, or -1 to bobble until
|
||||
* stop() is called.
|
||||
* @param duration the duration to bobble, or -1 to bobble until stop() is called.
|
||||
*/
|
||||
public BobblePath (int dx, int dy, long duration)
|
||||
{
|
||||
@@ -49,8 +48,7 @@ public class BobblePath implements Path
|
||||
*
|
||||
* @param dx the variance in the x direction.
|
||||
* @param dy the variance in the y direction.
|
||||
* @param duration the duration to bobble, or -1 to bobble until
|
||||
* stop() is called.
|
||||
* @param duration the duration to bobble, or -1 to bobble until stop() is called.
|
||||
* @param updateFreq how often to update the Pathable's location.
|
||||
*/
|
||||
public BobblePath (int dx, int dy, long duration, long updateFreq)
|
||||
@@ -67,8 +65,7 @@ public class BobblePath implements Path
|
||||
{
|
||||
if ((dx < 0) || (dy < 0) || ((dx == 0) && (dy == 0))) {
|
||||
throw new IllegalArgumentException(
|
||||
"Variance values must be positive, " +
|
||||
"and at least one must be non-zero.");
|
||||
"Variance values must be positive, and at least one must be non-zero.");
|
||||
} else {
|
||||
_dx = dx;
|
||||
_dy = dy;
|
||||
@@ -156,8 +153,7 @@ public class BobblePath implements Path
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the position of the pathable or return false
|
||||
* if it's already there.
|
||||
* Update the position of the pathable or return false if it's already there.
|
||||
*/
|
||||
protected boolean updatePositionTo (Pathable pable, int x, int y)
|
||||
{
|
||||
|
||||
@@ -28,14 +28,14 @@ import java.awt.Point;
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
/**
|
||||
* The line path is used to cause a pathable to go from point A to point B
|
||||
* in a certain number of milliseconds.
|
||||
* The line path is used to cause a pathable to go from point A to point B in a certain number of
|
||||
* milliseconds.
|
||||
*/
|
||||
public class LinePath extends TimedPath
|
||||
{
|
||||
/**
|
||||
* Constructs a line path between the two specified points that will
|
||||
* be followed in the specified number of milliseconds.
|
||||
* Constructs a line path between the two specified points that will be followed in the
|
||||
* specified number of milliseconds.
|
||||
*/
|
||||
public LinePath (int x1, int y1, int x2, int y2, long duration)
|
||||
{
|
||||
@@ -43,8 +43,8 @@ public class LinePath extends TimedPath
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a line path between the two specified points that will
|
||||
* be followed in the specified number of milliseconds.
|
||||
* Constructs a line path between the two specified points that will be followed in the
|
||||
* specified number of milliseconds.
|
||||
*/
|
||||
public LinePath (Point source, Point dest, long duration)
|
||||
{
|
||||
@@ -54,9 +54,8 @@ public class LinePath extends TimedPath
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a line path that moves a pathable from
|
||||
* whatever its location is at init time to the dest point over
|
||||
* the specified number of milliseconds.
|
||||
* Constructs a line path that moves a pathable from whatever its location is at init time to
|
||||
* the dest point over the specified number of milliseconds.
|
||||
*/
|
||||
public LinePath (Point dest, long duration)
|
||||
{
|
||||
@@ -128,13 +127,12 @@ public class LinePath extends TimedPath
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the position of an entity along the path defined by the
|
||||
* supplied start and end points assuming that it must finish the path
|
||||
* in the specified duration (in millis) and has been traveling the
|
||||
* path for the specified number of elapsed milliseconds.
|
||||
* Computes the position of an entity along the path defined by the supplied start and end
|
||||
* points assuming that it must finish the path in the specified duration (in millis) and has
|
||||
* been traveling the path for the specified number of elapsed milliseconds.
|
||||
*/
|
||||
public static void computePosition (Point start, Point end, long elapsed,
|
||||
long duration, Point pos)
|
||||
public static void computePosition (
|
||||
Point start, Point end, long elapsed, long duration, Point pos)
|
||||
{
|
||||
float pct = (float)elapsed / duration;
|
||||
int travx = (int)((end.x - start.x) * pct);
|
||||
@@ -145,7 +143,6 @@ public class LinePath extends TimedPath
|
||||
/** Our source and destination points. */
|
||||
protected Point _source, _dest;
|
||||
|
||||
/** A temporary point used when computing our position along the
|
||||
* path. */
|
||||
/** A temporary point used when computing our position along the path. */
|
||||
protected Point _tpos = new Point();
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ package com.threerings.media.util;
|
||||
import static com.threerings.media.Log.log;
|
||||
|
||||
/**
|
||||
* A base class for path implementations that endeavor to move their
|
||||
* pathables along a path in a specified number of milliseconds.
|
||||
* A base class for path implementations that endeavor to move their pathables along a path in a
|
||||
* specified number of milliseconds.
|
||||
*/
|
||||
public abstract class TimedPath implements Path
|
||||
{
|
||||
@@ -37,8 +37,8 @@ public abstract class TimedPath implements Path
|
||||
{
|
||||
// sanity check some things
|
||||
if (duration <= 0) {
|
||||
log.warning("Requested path with illegal duration (<=0) " +
|
||||
"[duration=" + duration + "]", new Exception());
|
||||
log.warning("Requested path with illegal duration (<=0)",
|
||||
"duration", duration, new Exception());
|
||||
duration = 1; // assume something short but non-zero
|
||||
}
|
||||
|
||||
@@ -79,8 +79,7 @@ public abstract class TimedPath implements Path
|
||||
}
|
||||
|
||||
/**
|
||||
* An extensible method for generating a string representation of this
|
||||
* instance.
|
||||
* An extensible method for generating a string representation of this instance.
|
||||
*/
|
||||
protected void toString (StringBuilder buf)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user