Aimsun Next Scripting  22
Public Member Functions | List of all members
GKVector Class Reference

Public Member Functions

 GKVector ()
 
 GKVector (const GKPoint &pini, const GKPoint &pfin)
 
 GKVector (const GKCoord ax, const GKCoord ay, const GKCoord az=0.0)
 
virtual ~GKVector ()
 
void set (const GKPoint &pini, const GKPoint &pfin)
 
void set (GKCoord ax, GKCoord ay, GKCoord az=0.0)
 
void setX (GKCoord _x)
 
void setY (GKCoord _y)
 
void setZ (GKCoord _z)
 
GKCoord getX () const
 
GKCoord getY () const
 
GKCoord getZ () const
 
double getLength () const
 
void normalize ()
 
GKVector crossProduct (const GKVector &v2) const
 
double dotProduct (const GKVector &v2) const
 
GKVectoroperator*= (double d)
 
GKVector operator* (double d) const
 
GKVector operator+ (const GKVector &_vector) const
 
GKVector operator- (const GKVector &_vector) const
 
GKVector operator+ (const GKPoint &_point) const
 
GKVector operator- (const GKPoint &_point) const
 
double angle (const GKVector &v2) const
 
double fullAngle (const GKVector &v2) const
 
double angleWithTheHorizontal () const
 
void rotate (const GKPoint &center, float angle)
 

Detailed Description

Calculation methods for a vector.

Constructor & Destructor Documentation

◆ GKVector() [1/3]

GKVector::GKVector ( )

◆ GKVector() [2/3]

GKVector::GKVector ( const GKPoint pini,
const GKPoint pfin 
)

Constructs a 3D vector using an initial and end points that will be used to calculate its coordinates.

◆ GKVector() [3/3]

GKVector::GKVector ( const GKCoord  ax,
const GKCoord  ay,
const GKCoord  az = 0.0 
)

Constructs a 3D vector setting the x, y and z coordinates.

◆ ~GKVector()

virtual GKVector::~GKVector ( )
virtual

Member Function Documentation

◆ angle()

double GKVector::angle ( const GKVector v2) const

It returns the smallest angle between "this" and "v2" vectors in radians

◆ angleWithTheHorizontal()

double GKVector::angleWithTheHorizontal ( ) const

It returns the angle this vector makes with the horizontal in radians between - GKPI and GKPI. Note: The horizontal is interpreted as the vector (1.0, 0.0)

◆ crossProduct()

GKVector GKVector::crossProduct ( const GKVector v2) const

Returns the resulting vector of calculating the vectorial product between this vector and v2

◆ dotProduct()

double GKVector::dotProduct ( const GKVector v2) const

Returns the scalar product between to vectors

◆ fullAngle()

double GKVector::fullAngle ( const GKVector v2) const

It returns the angle between "this" and "v2" vectors in radians (0 - 2PI)

◆ getLength()

double GKVector::getLength ( ) const

Gets the vector length calculated using the points or coordinates defined for the vector.

◆ getX()

GKCoord GKVector::getX ( ) const

Gets the x coordinate of this vector.

◆ getY()

GKCoord GKVector::getY ( ) const

Gets the y coordinate of this vector.

◆ getZ()

GKCoord GKVector::getZ ( ) const

Gets the z coordinate of this vector.

◆ normalize()

void GKVector::normalize ( )

Normalizes this vector changing its length to 1.0 meter and normalizing the x,y and z coordinates

◆ operator*()

GKVector GKVector::operator* ( double  d) const

◆ operator*=()

GKVector & GKVector::operator*= ( double  d)

◆ operator+() [1/2]

GKVector GKVector::operator+ ( const GKPoint _point) const

◆ operator+() [2/2]

GKVector GKVector::operator+ ( const GKVector _vector) const

◆ operator-() [1/2]

GKVector GKVector::operator- ( const GKPoint _point) const

◆ operator-() [2/2]

GKVector GKVector::operator- ( const GKVector _vector) const

◆ rotate()

void GKVector::rotate ( const GKPoint center,
float  angle 
)

Rotates the vector an angle 'angle' in radians taking 'center' as the center of rotation

◆ set() [1/2]

void GKVector::set ( const GKPoint pini,
const GKPoint pfin 
)

Sets the origin and destination point of this vector, used to indicate the vector's direction.

◆ set() [2/2]

void GKVector::set ( GKCoord  ax,
GKCoord  ay,
GKCoord  az = 0.0 
)

Sets the x, y and z coordinates of this vector.

◆ setX()

void GKVector::setX ( GKCoord  _x)

Sets the x coordinate of this vector

◆ setY()

void GKVector::setY ( GKCoord  _y)

Sets the y coordinate of this vector

◆ setZ()

void GKVector::setZ ( GKCoord  _z)

Sets the z coordinate of this vector

© Aimsun SLU
Aimsun ®