org.robokind.api.animation
Class Transforms

java.lang.Object
  extended by org.robokind.api.animation.Transforms

public class Transforms
extends Object

Provides functions to transforming Animations, Channels, and Motion Paths.

Author:
Matthew Stevenson

Constructor Summary
Transforms()
           
 
Method Summary
static void scalePathTime(MotionPath src, MotionPath dest, double scale, double ref)
          Scales the x-distance from the reference point by the given amount for each point in the MotionPath.
static List<Point2D> scalePositions(List<Point2D> points, double scale, double ref)
          Scales the y-distance from the reference point by the given amount for each point in the list.
static List<Point2D> scaleTimes(List<Point2D> points, double scale, double ref)
          Scales the x-distance from the reference point by the given amount for each point in the list.
static void setPathControlPoints(MotionPath path, List<Point2D> points)
          Sets the coordinates of the MotionPath control points to the given points.
static void translatePath(MotionPath src, MotionPath dest, double amtX, double amtY)
          Moves all the points in a MotionPath by the given x and y amounts.
static List<Point2D> translatePoints(List<Point2D> points, double amtX, double amtY)
          Moves all the points in the list be the given x and y amounts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Transforms

public Transforms()
Method Detail

translatePath

public static void translatePath(MotionPath src,
                                 MotionPath dest,
                                 double amtX,
                                 double amtY)
Moves all the points in a MotionPath by the given x and y amounts.

Parameters:
src - the MotionPath defining the starting points. This MotionPath is unchanged
dest - the MotionPath to set. The Points in dest are set to the translated coordinates from src
amtX - x amount
amtY - y amount

scalePathTime

public static void scalePathTime(MotionPath src,
                                 MotionPath dest,
                                 double scale,
                                 double ref)
Scales the x-distance from the reference point by the given amount for each point in the MotionPath.

Parameters:
src - the MotionPath defining the starting points. This MotionPath is unchanged
dest - the MotionPath to set. The Points in dest are set to the scale coordinates from src
scale - the scale amount
ref - x-value to scale from

setPathControlPoints

public static void setPathControlPoints(MotionPath path,
                                        List<Point2D> points)
Sets the coordinates of the MotionPath control points to the given points. The list of points is expected to be the same size as the path's control points.

Parameters:
path - the path to change
points - the new positions

scaleTimes

public static List<Point2D> scaleTimes(List<Point2D> points,
                                       double scale,
                                       double ref)
Scales the x-distance from the reference point by the given amount for each point in the list.

Parameters:
points - the list of points to scale
scale - the amount to scale the points
ref - the scale reference point
Returns:
a new list of points with scaled x values

scalePositions

public static List<Point2D> scalePositions(List<Point2D> points,
                                           double scale,
                                           double ref)
Scales the y-distance from the reference point by the given amount for each point in the list.

Parameters:
points - the list of points to scale
scale - the amount to scale the points
ref - the scale reference point
Returns:
a new list of points with scaled y values

translatePoints

public static List<Point2D> translatePoints(List<Point2D> points,
                                            double amtX,
                                            double amtY)
Moves all the points in the list be the given x and y amounts.

Parameters:
points - the points to move
amtX - x amount
amtY - y amount
Returns:
a new list of points translated by the given amounts


Copyright © 2011. All Rights Reserved.