Actin®  Version 5.2.0
Software for Robotics Simulation and Control
EcVector Class Reference

A three-element vector. More...

#include <ecVector.h>

Public Member Functions

 EcVector ()
 constructor
 
 EcVector (EcReal x, EcReal y, EcReal z)
 constructor from three reals
 
EcBoolean operator== (const EcVector &orig) const
 equality operator
 
EcVectoroperator+= (const EcVector &v2)
 add another vector to this vector and set this vector to the result
 
EcVectoroperator-= (const EcVector &v2)
 subtract another vector from this vector and set this vector to the result
 
EcVectoroperator*= (EcReal s)
 multiply this vector times a scalar and set this vector to the result
 
EcVector operator+ (const EcVector &v2) const
 returns a vector equal to this vector plus another
 
EcVector operator- (const EcVector &v2) const
 returns a vector equal to this vector minus another
 
EcVector operator* (EcReal a) const
 
EcVector operator/ (EcReal a) const
 
EcVector cross (const EcVector &v2) const
 returns a vector equal to this vector cross another (vector cross product)
 
void cross (const EcVector &v2, EcVector &vc) const
 
EcReal dot (const EcVector &v2) const
 returns a vector equal to this vector dot another (vector dot product)
 
EcReal mag () const
 returns the magnitude of this vector
 
EcReal prod () const
 returns the product of the three elements
 
EcReal magSquared () const
 returns the magnitude squared of this vector (a fast operation)
 
EcVector unitVector () const
 returns a unit vector in the same direction as this vector
 
EcVectornormalize ()
 normalizes this vector
 
EcBoolean approxEq (const EcVector &v2, EcReal tol) const
 tests that each element of this vector is within a tolerance of another
 
EcReal distanceTo (const EcVector &vec) const
 find the Euclidean distance to another point
 
EcReal distanceSquaredTo (const EcVector &vec) const
 find the Euclidean distance squared to another point
 
void computeDirectionalVector (const EcVector &destination, EcReal mag, EcVector &result) const
 compute a vector which points from this vector (point) to the other vector (point) with a given magnitude. More...
 
const EcRealx () const
 returns the x value of the vector
 
const EcRealy () const
 returns the y value of the vector
 
const EcRealz () const
 returns the z value of the vector
 
void setX (EcReal val)
 sets the x value of the vector
 
void setY (EcReal val)
 sets the y value of the vector
 
void setZ (EcReal val)
 sets the z value of the vector
 
void set (EcReal x, EcReal y, EcReal z)
 sets all values of the vector
 
void setToZero ()
 sets all value to 0
 
const EcRealoperator[] (EcSizeT index) const
 returns a value by index (0, 1, or 2) - const version.
 
EcRealoperator[] (EcSizeT index)
 returns a value by index (0, 1, or 2) - nonconst version.
 
void perturb (EcReal scale)
 perturb this vector by a random vector with mag()==scale
 

Static Public Member Functions

static const EcVectorzeroVector ()
 returns a zero vector
 
static EcVector xVector (EcReal val=1.0)
 returns [val, 0, 0]
 
static EcVector yVector (EcReal val=1.0)
 returns [0, val, 0]
 
static EcVector zVector (EcReal val=1.0)
 returns [0, 0, val]
 

Protected Attributes

EcReal m_Vector [3]
 array holding the three vector elements
 

Static Protected Attributes

static const EcVector m_theZeroVector
 a zero vector to return by reference
 

Detailed Description

A three-element vector.

It provides utilities such as magnitude, dot product, and cross product. This class has inline and virtual methods for speed optimization.

Examples:
controlExecutiveModifierExampleMain.cpp, ecCameraViewMain.cpp, ecCirclePathExampleDirection.cpp, ecPathFollowingMain.cpp, ecPathPlanningCoreMain.cpp, ecPathPlanningMain.cpp, ecPositionControlMain.cpp, ecProgrammaticConstructionMain.cpp, ecQuickStartKinematicsMain.cpp, ecQuickStartMain.cpp, ecRemoteCommandExampleMain.cpp, ecStatedSystemMain.cpp, and ecXmlMain.cpp.

Definition at line 20 of file ecVector.h.

Member Function Documentation

void EcVector::computeDirectionalVector ( const EcVector destination,
EcReal  mag,
EcVector result 
) const

compute a vector which points from this vector (point) to the other vector (point) with a given magnitude.

Parameters
[in]destinationThe destination point
[in]magThe magnitude of the new vector
[out]resultThe new vector
void EcVector::cross ( const EcVector v2,
EcVector vc 
) const

vector cross product

Parameters
[in]v2This cross v2 is calculated.
[out]vcvc equals this cross v2.
EcVector EcVector::operator* ( EcReal  a) const
inline

returns a vector which has been multiplied by the scalar a on an element by element basis

Definition at line 93 of file ecVector.h.

EcVector EcVector::operator/ ( EcReal  a) const

returns a vector which has been divided by the scalar a on an element by element basis


The documentation for this class was generated from the following file:
Created by Energid Technologies www.energid.com
Copyright © 2016 Energid. All trademarks mentioned in this document are property of their respective owners.