us.ihmc.utilities.math.geometry
Class FrameVector2d

java.lang.Object
  extended by us.ihmc.utilities.math.geometry.FrameVector2d
All Implemented Interfaces:
ReferenceFrameHolder

public class FrameVector2d
extends java.lang.Object
implements ReferenceFrameHolder

One of the main goals of this class is to check, at runtime, that operations on vectors occur within the same Frame. This method checks for one Vector argument.

Version:
2.0
Author:
Learning Locomotion Team

Constructor Summary
FrameVector2d(FramePoint2d framePoint)
          FrameVector Turns a FramePoint into a FrameVector.
FrameVector2d(FramePoint2d startFramePoint, FramePoint2d endFramePoint)
          FrameVector2d Creates a new FrameVector as the difference between two FramePoints.
FrameVector2d(FrameVector2d frameVector)
          FrameVector A normal vector associated with a specific reference frame
FrameVector2d(ReferenceFrame referenceFrame)
          FrameVector A normal vector associated with a specific reference frame
FrameVector2d(ReferenceFrame referenceFrame, double[] vector)
           
FrameVector2d(ReferenceFrame referenceFrame, double x, double y)
          FrameVector A normal vector associated with a specific reference frame.
FrameVector2d(ReferenceFrame referenceFrame, javax.vecmath.Tuple2d tuple)
          FrameVector2d A normal vector associated with a specific reference frame
 
Method Summary
 void add(FramePoint2d framePoint)
           
 void add(FrameVector2d frameVector)
           
 void add(FrameVector2d vector1, FrameVector2d vector2)
           
 double angle(FrameVector2d frameVector)
           
 void applyTransform(javax.media.j3d.Transform3D transform)
           
 FrameVector2d applyTransformCopy(javax.media.j3d.Transform3D transform3D)
           
 void changeFrame(ReferenceFrame desiredFrame)
          Changes frame of this FrameVector2d to the given ReferenceFrame.
 FrameVector2d changeFrameCopy(ReferenceFrame desiredFrame)
          Changes frame of this FrameVector to the given ReferenceFrame and returns a copy.
 void checkForNaN()
           
 void checkReferenceFrameMatch(ReferenceFrame frame)
           
 void checkReferenceFrameMatch(ReferenceFrameHolder referenceFrameHolder)
          Makes sure that the FrameVector argument has the same Frame as the current FrameVector.
 boolean containsNaN()
           
 double cross(FrameVector2d frameVector)
           
 double dot(FrameVector2d frameVector)
           
 boolean epsilonEquals(FramePoint2d framePoint, double threshold)
           
 boolean epsilonEquals(FrameVector2d frameVector, double threshold)
           
static FrameVector2d generateRandomFrameVector2d(java.util.Random random, ReferenceFrame zUpFrame)
           
 ReferenceFrame getReferenceFrame()
          Returns this FrameVectors ReferenceFrame.
 javax.vecmath.Vector2d getVector()
          Returns the vector inside this FrameVector.
 void getVector(javax.vecmath.Vector2d vectorToPack)
           
 javax.vecmath.Vector2d getVectorCopy()
          Returns a deep copy of the vector inside this FrameVector.
 double getX()
           
 double getY()
           
 double length()
           
 double lengthSquared()
           
 void negate()
           
 void normalize()
           
 void printOutFrameVector(java.lang.String variableName)
           
 void rotate90()
           
 void scale(double scaleFactor)
           
 void scale(double scaleFactor, FramePoint2d point1)
          Sets the value of this tuple to the scalar multiplication of vertor1 (this = s * t1).
 void scale(double scaleFactor, FrameVector2d vector1)
          Sets the value of this tuple to the scalar multiplication of vertor1 (this = s * t1).
 void scaleAdd(double scaleFactor, FramePoint2d point1)
          Sets the value of this tuple to the scalar multiplication of itself and then adds tuple t1 (this = s*this + t1).
 void scaleAdd(double scaleFactor, FramePoint2d point1, FramePoint2d point2)
          Sets the value of this tuple to the scalar multiplication of tuple t1 and then adds tuple t2 (this = s*v1 + t2).
 void scaleAdd(double scaleFactor, FramePoint2d point1, FrameVector2d vector2)
          Sets the value of this tuple to the scalar multiplication of tuple t1 and then adds tuple t2 (this = s*v1 + t2).
 void scaleAdd(double scaleFactor, FrameVector2d vector1)
          Sets the value of this tuple to the scalar multiplication of itself and then adds tuple t1 (this = s*this + t1).
 void scaleAdd(double scaleFactor, FrameVector2d vector1, FramePoint2d point2)
          Sets the value of this tuple to the scalar multiplication of tuple t1 and then adds tuple t2 (this = s*v1 + t2).
 void scaleAdd(double scaleFactor, FrameVector2d vector1, FrameVector2d vector2)
          Sets the value of this tuple to the scalar multiplication of tuple t1 and then adds tuple t2 (this = s*v1 + t2)
 void set(double x, double y)
           
 void set(FramePoint2d framePoint)
           
 void set(FrameVector2d frameVector)
           
 void set(ReferenceFrame referenceFrame, double x, double y)
           
 void set(javax.vecmath.Vector2d vector)
           
 void setAndChangeFrame(FramePoint2d framePoint)
           
 void setAndChangeFrame(FrameVector2d frameVector)
           
 void setX(double x)
           
 void setY(double y)
           
 void sub(FramePoint2d framePoint)
           
 void sub(FramePoint2d point1, FramePoint2d point2)
           
 void sub(FrameVector2d frameVector)
           
 void sub(FrameVector2d vector1, FrameVector2d vector2)
           
 double[] toArray()
           
static double[] toArray(FrameVector2d[] frameVectors)
           
 java.lang.String toString()
          toString String representation of a FrameVector (x,y,z):reference frame name
 void weightedAverage(FrameVector2d vector1, FrameVector2d vector2, double weightedAverage)
          Sets this vector to be the weighted average of the two input vectors.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FrameVector2d

public FrameVector2d(ReferenceFrame referenceFrame,
                     javax.vecmath.Tuple2d tuple)
FrameVector2d A normal vector associated with a specific reference frame

Parameters:
referenceFrame - Frame
vector - Vector2d

FrameVector2d

public FrameVector2d(ReferenceFrame referenceFrame,
                     double[] vector)

FrameVector2d

public FrameVector2d(ReferenceFrame referenceFrame)
FrameVector A normal vector associated with a specific reference frame

Parameters:
referenceFrame - Frame

FrameVector2d

public FrameVector2d(FrameVector2d frameVector)
FrameVector A normal vector associated with a specific reference frame

Parameters:
referenceFrame - Frame
vector - Vector2d

FrameVector2d

public FrameVector2d(FramePoint2d framePoint)
FrameVector Turns a FramePoint into a FrameVector.

Parameters:
referenceFrame - Frame
vector - Vector2d

FrameVector2d

public FrameVector2d(FramePoint2d startFramePoint,
                     FramePoint2d endFramePoint)
FrameVector2d Creates a new FrameVector as the difference between two FramePoints.

Parameters:
startFramePoint - FramePoint2d
endFramePoint - FramePoint2d

FrameVector2d

public FrameVector2d(ReferenceFrame referenceFrame,
                     double x,
                     double y)
FrameVector A normal vector associated with a specific reference frame. The x, y, and z are used to create the vector

Parameters:
referenceFrame - Frame
x - double
y - double
Method Detail

getReferenceFrame

public ReferenceFrame getReferenceFrame()
Returns this FrameVectors ReferenceFrame.

Specified by:
getReferenceFrame in interface ReferenceFrameHolder
Returns:
ReferenceFrame

getVector

public javax.vecmath.Vector2d getVector()
Returns the vector inside this FrameVector.

Returns:
Vector2d

getVector

public void getVector(javax.vecmath.Vector2d vectorToPack)

getVectorCopy

public javax.vecmath.Vector2d getVectorCopy()
Returns a deep copy of the vector inside this FrameVector.

Returns:
Vector2d

changeFrameCopy

public FrameVector2d changeFrameCopy(ReferenceFrame desiredFrame)
Changes frame of this FrameVector to the given ReferenceFrame and returns a copy.

Specified by:
changeFrameCopy in interface ReferenceFrameHolder
Parameters:
desiredFrame - ReferenceFrame to change the FrameVector into.
Returns:
Copied FrameVector in the new reference frame.

changeFrame

public void changeFrame(ReferenceFrame desiredFrame)
Changes frame of this FrameVector2d to the given ReferenceFrame.

Parameters:
desiredFrame - ReferenceFrame to change the FrameVector2d into.

applyTransform

public void applyTransform(javax.media.j3d.Transform3D transform)

applyTransformCopy

public FrameVector2d applyTransformCopy(javax.media.j3d.Transform3D transform3D)

toArray

public static double[] toArray(FrameVector2d[] frameVectors)

negate

public void negate()

getX

public double getX()

getY

public double getY()

set

public void set(double x,
                double y)

set

public void set(javax.vecmath.Vector2d vector)

setX

public void setX(double x)

setY

public void setY(double y)

rotate90

public void rotate90()

set

public void set(ReferenceFrame referenceFrame,
                double x,
                double y)

scale

public void scale(double scaleFactor)

toArray

public double[] toArray()

scale

public void scale(double scaleFactor,
                  FrameVector2d vector1)
Sets the value of this tuple to the scalar multiplication of vertor1 (this = s * t1).

Parameters:
scaleFactor - double
vector1 - FrameVector

scale

public void scale(double scaleFactor,
                  FramePoint2d point1)
Sets the value of this tuple to the scalar multiplication of vertor1 (this = s * t1).

Parameters:
scaleFactor - double
point1 - FramePoint

scaleAdd

public void scaleAdd(double scaleFactor,
                     FrameVector2d vector1,
                     FrameVector2d vector2)
Sets the value of this tuple to the scalar multiplication of tuple t1 and then adds tuple t2 (this = s*v1 + t2)

Parameters:
scaleFactor - double
vector1 - FrameVector
vector2 - FrameVector

scaleAdd

public void scaleAdd(double scaleFactor,
                     FrameVector2d vector1,
                     FramePoint2d point2)
Sets the value of this tuple to the scalar multiplication of tuple t1 and then adds tuple t2 (this = s*v1 + t2).

Parameters:
scaleFactor - double
vector1 - FrameVector
point2 - FramePoint

scaleAdd

public void scaleAdd(double scaleFactor,
                     FramePoint2d point1,
                     FrameVector2d vector2)
Sets the value of this tuple to the scalar multiplication of tuple t1 and then adds tuple t2 (this = s*v1 + t2).

Parameters:
scaleFactor - double
point1 - FramePoint
vector2 - FrameVector

scaleAdd

public void scaleAdd(double scaleFactor,
                     FramePoint2d point1,
                     FramePoint2d point2)
Sets the value of this tuple to the scalar multiplication of tuple t1 and then adds tuple t2 (this = s*v1 + t2).

Parameters:
scaleFactor - double
point1 - FramePoint
point2 - FramePoint

scaleAdd

public void scaleAdd(double scaleFactor,
                     FrameVector2d vector1)
Sets the value of this tuple to the scalar multiplication of itself and then adds tuple t1 (this = s*this + t1).

Parameters:
scaleFactor - double
vector1 - FrameVector

scaleAdd

public void scaleAdd(double scaleFactor,
                     FramePoint2d point1)
Sets the value of this tuple to the scalar multiplication of itself and then adds tuple t1 (this = s*this + t1).

Parameters:
scaleFactor - double
point1 - FramePoint

checkReferenceFrameMatch

public void checkReferenceFrameMatch(ReferenceFrameHolder referenceFrameHolder)
Makes sure that the FrameVector argument has the same Frame as the current FrameVector.

Specified by:
checkReferenceFrameMatch in interface ReferenceFrameHolder
Parameters:
frameVector - FrameVector
Throws:
ReferenceFrameMismatchException

checkReferenceFrameMatch

public void checkReferenceFrameMatch(ReferenceFrame frame)
                              throws ReferenceFrameMismatchException
Specified by:
checkReferenceFrameMatch in interface ReferenceFrameHolder
Throws:
ReferenceFrameMismatchException

checkForNaN

public void checkForNaN()

containsNaN

public boolean containsNaN()

add

public void add(FrameVector2d frameVector)

add

public void add(FramePoint2d framePoint)

add

public void add(FrameVector2d vector1,
                FrameVector2d vector2)

sub

public void sub(FrameVector2d frameVector)

sub

public void sub(FramePoint2d framePoint)

sub

public void sub(FramePoint2d point1,
                FramePoint2d point2)

sub

public void sub(FrameVector2d vector1,
                FrameVector2d vector2)

dot

public double dot(FrameVector2d frameVector)

cross

public double cross(FrameVector2d frameVector)

angle

public double angle(FrameVector2d frameVector)

set

public void set(FrameVector2d frameVector)

set

public void set(FramePoint2d framePoint)

setAndChangeFrame

public void setAndChangeFrame(FrameVector2d frameVector)

setAndChangeFrame

public void setAndChangeFrame(FramePoint2d framePoint)

normalize

public void normalize()

length

public double length()

lengthSquared

public double lengthSquared()

weightedAverage

public void weightedAverage(FrameVector2d vector1,
                            FrameVector2d vector2,
                            double weightedAverage)
Sets this vector to be the weighted average of the two input vectors. v = (1.0 - weightedAverage) * vector1 + weightedAverage * vector2

Parameters:
vector1 - FramePoint
vector2 - FramePoint
weightedAverage - double
Throws:
ReferenceFrameMismatchException

toString

public java.lang.String toString()
toString String representation of a FrameVector (x,y,z):reference frame name

Overrides:
toString in class java.lang.Object
Returns:
String

printOutFrameVector

public void printOutFrameVector(java.lang.String variableName)

epsilonEquals

public boolean epsilonEquals(FramePoint2d framePoint,
                             double threshold)

epsilonEquals

public boolean epsilonEquals(FrameVector2d frameVector,
                             double threshold)

generateRandomFrameVector2d

public static FrameVector2d generateRandomFrameVector2d(java.util.Random random,
                                                        ReferenceFrame zUpFrame)