Harmony
Scripting Interface Documentation
Vector2d Class Reference

The Vector2d JavaScript class. Defines a two dimensional vector. More...

Public Slots

bool isZero ()
 Test if Vector2d is zero. More...
 
bool isEqual (Vector2d v2)
 Test if the two vectors are equals. More...
 
bool isNotEqual (Vector2d v2)
 Test if the two vectors are not equals. More...
 
double length ()
 Retrieve length of Vector2d. More...
 
double lengthSq ()
 Retrieve square length of Vector2d. More...
 
double radianAngle ()
 Retrieve radian angle defined by Vector2d. More...
 
double degreeAngle ()
 Retrieve degree angle defined by Vector2d. More...
 
double dot (Vector2d v2)
 Calculate dot product between current Vector2d and specified Vector2d. More...
 
Vector2drotate (double rad)
 Rotate Vector2d counter-clockwise of specified radian angle. More...
 
Vector2drotate90 ()
 Rotate Vector2d counter-clockwise of 90 degrees. More...
 
Vector2drotate270 ()
 Rotate Vector2d counter-clockwise of 270 degrees. More...
 
Vector2dproject (Vector2d v2)
 Project current Vector2d onto specified Vector2d. More...
 
Vector2d getProjection (Vector2d v2)
 Project current Vector2d onto specified Vector2d. More...
 
Vector2dnormalize ()
 Normalize current Vector2d. More...
 
Vector2d getNormalized ()
 Normalize current Vector2d. More...
 
Vector2dnegate ()
 Negate current Vector2d. More...
 

Public Member Functions

 Vector2d ()
 Create a new empty Vector2d. More...
 
 Vector2d (double x, double y)
 Create a new Vector2d. More...
 

Properties

double x
 x value More...
 
double y
 y value More...
 

Detailed Description

The Vector2d JavaScript class. Defines a two dimensional vector.

@ The Vector2d class defines a bi-dimensional vector container. Vector2d objects can be instantiated in the scripting environment.

Constructor & Destructor Documentation

◆ Vector2d() [1/2]

Vector2d::Vector2d ( )

Create a new empty Vector2d.

◆ Vector2d() [2/2]

Vector2d::Vector2d ( double  x,
double  y 
)

Create a new Vector2d.

Parameters
xX value
yY value

Member Function Documentation

◆ degreeAngle

double Vector2d::degreeAngle ( )
slot

Retrieve degree angle defined by Vector2d.

Returns
Degree value

◆ dot

double Vector2d::dot ( Vector2d  v2)
slot

Calculate dot product between current Vector2d and specified Vector2d.

Parameters
v2Second Vector2d
Returns
Dot product value

◆ getNormalized

Vector2d Vector2d::getNormalized ( )
slot

Normalize current Vector2d.

Returns
new normalized Vector2d

◆ getProjection

Vector2d Vector2d::getProjection ( Vector2d  v2)
slot

Project current Vector2d onto specified Vector2d.

Parameters
v2Vector2d to project onto
Returns
new projected Vector2d

◆ isEqual

bool Vector2d::isEqual ( Vector2d  v2)
slot

Test if the two vectors are equals.

Parameters
v2Second Vector2d
Returns
Result of test

◆ isNotEqual

bool Vector2d::isNotEqual ( Vector2d  v2)
slot

Test if the two vectors are not equals.

Parameters
v2Second Vector2d
Returns
Result of test

◆ isZero

bool Vector2d::isZero ( )
slot

Test if Vector2d is zero.

Returns
Result of test

◆ length

double Vector2d::length ( )
slot

Retrieve length of Vector2d.

Returns
Length

◆ lengthSq

double Vector2d::lengthSq ( )
slot

Retrieve square length of Vector2d.

Returns
Square length

◆ negate

Vector2d& Vector2d::negate ( )
slot

Negate current Vector2d.

Returns
Vector2d reference

◆ normalize

Vector2d& Vector2d::normalize ( )
slot

Normalize current Vector2d.

Returns
Vector2d reference

◆ project

Vector2d& Vector2d::project ( Vector2d  v2)
slot

Project current Vector2d onto specified Vector2d.

Parameters
v2Vector2d to project onto
Returns
Vector2d reference

◆ radianAngle

double Vector2d::radianAngle ( )
slot

Retrieve radian angle defined by Vector2d.

Returns
Radian value

◆ rotate

Vector2d& Vector2d::rotate ( double  rad)
slot

Rotate Vector2d counter-clockwise of specified radian angle.

Parameters
radRadian angle
Returns
Vector2d reference

◆ rotate270

Vector2d& Vector2d::rotate270 ( )
slot

Rotate Vector2d counter-clockwise of 270 degrees.

Returns
Vector2d reference

◆ rotate90

Vector2d& Vector2d::rotate90 ( )
slot

Rotate Vector2d counter-clockwise of 90 degrees.

Returns
Vector2d reference

Property Documentation

◆ x

double Vector2d::x
readwrite

x value

◆ y

double Vector2d::y
readwrite

y value