diff --git a/src/java/com/threerings/media/util/ArcPath.java b/src/java/com/threerings/media/util/ArcPath.java index 24d621322..bfd563408 100644 --- a/src/java/com/threerings/media/util/ArcPath.java +++ b/src/java/com/threerings/media/util/ArcPath.java @@ -1,5 +1,5 @@ // -// $Id: ArcPath.java,v 1.5 2004/08/27 02:12:47 mdb Exp $ +// $Id$ // // Narya library - tools for developing networked games // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved @@ -81,6 +81,20 @@ public class ArcPath extends TimedPath (int)(start.y - Math.round(Math.sin(sangle) * yradius))); } + /** + * Return a copy of the path, translated by the specified amounts. + */ + 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)); + + 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 diff --git a/src/java/com/threerings/media/util/LinePath.java b/src/java/com/threerings/media/util/LinePath.java index a24e5176f..9f0ffb67b 100644 --- a/src/java/com/threerings/media/util/LinePath.java +++ b/src/java/com/threerings/media/util/LinePath.java @@ -1,5 +1,5 @@ // -// $Id: LinePath.java,v 1.14 2004/08/27 02:12:47 mdb Exp $ +// $Id$ // // Narya library - tools for developing networked games // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved @@ -63,6 +63,20 @@ public class LinePath extends TimedPath this(null, dest, duration); } + /** + * Return a copy of the path, translated by the specified amounts. + */ + public Path getTranslatedInstance (int x, int y) + { + if (_source == null) { + return new LinePath(null, new Point(_dest.x + x, _dest.y + y), + _duration); + } else { + return new LinePath(_source.x + x, _source.y + y, _dest.x + x, + _dest.y + y, _duration); + } + } + // documentation inherited public void init (Pathable pable, long timestamp) {