Point2d Class Reference

The Point2d JavaScript class. Defines a two dimensional point. More...

Public Slots

void setXY (const double, const double)
 Set the value of x, y coordinate. More...
 
Point2dround ()
 round x and y to floor with a resolution of 1.0/64.0 More...
 
Point2dround (double quantum)
 round x and y to floor with a resolution given More...
 
Point2dround (const Vector2d v)
 Rounds this point in the direction of the given vector and using the resolution of 1.0/64.0. More...
 
Point2dround (const Vector2d v, double quantum)
 Rounds this point in the direction of the given vector and using the given resolution. More...
 
Vector2d toVector2d ()
 Copy Point2d into a Vector2d container. More...
 
double distance (const Point2d p2) const
 Calculate distance between two points. More...
 
double distanceSq (const Point2d p2) const
 Calculate square distance between two points. More...
 
Vector2d minus (const Point2d p2)
 Substracts current Point2d with specified Point2d. More...
 
Point2d minus (const Vector2d v)
 Substracts current Point2d with specified Vector2d. More...
 
Point2d add (const Vector2d v)
 Add specified Vector2d to current Point2d. More...
 
Point2daddEq (const Vector2d v)
 Add specified Vector2d to current Point2d. More...
 
Point2dminusEq (const Vector2d v)
 Substract current Point2d with specified Vector2d. More...
 
Point2dinterpolate (double t, const Point2d p1, const Point2d p2)
 Calculate Point2d as interpolation between two points. More...
 

Public Member Functions

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

Properties

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

Detailed Description

The Point2d JavaScript class. Defines a two dimensional point.

The Point2d class defines a bi-dimensional point container. Point2d objects can be instantiated in the scripting environment.

Constructor & Destructor Documentation

◆ Point2d() [1/2]

Point2d::Point2d ( )

Create a new empty Point2d.

◆ Point2d() [2/2]

Point2d::Point2d ( double  x,
double  y 
)

Create a new Point2d.

Parameters
xX value
yY value

Member Function Documentation

◆ add

Point2d Point2d::add ( const Vector2d  v)
slot

Add specified Vector2d to current Point2d.

Parameters
vVector2d
Returns
New Point2d containing result

◆ addEq

Point2d& Point2d::addEq ( const Vector2d  v)
slot

Add specified Vector2d to current Point2d.

Parameters
vVector2d
Returns
Point2d reference

◆ distance

double Point2d::distance ( const Point2d  p2) const
slot

Calculate distance between two points.

Parameters
p2Second Point2d
Returns
Distance between current Point2d and p2

◆ distanceSq

double Point2d::distanceSq ( const Point2d  p2) const
slot

Calculate square distance between two points.

Parameters
p2Second Point2d
Returns
Square distance between current Point2d and p2

◆ interpolate

Point2d& Point2d::interpolate ( double  t,
const Point2d  p1,
const Point2d  p2 
)
slot

Calculate Point2d as interpolation between two points.

Parameters
tFactor of interpolation [ 0, 1 ]
p1First Point2d
p2Second Point2d
Returns
Point2d reference

◆ minus [1/2]

Vector2d Point2d::minus ( const Point2d  p2)
slot

Substracts current Point2d with specified Point2d.

Parameters
p2Second Point2d
Returns
New Point2d containing result

◆ minus [2/2]

Point2d Point2d::minus ( const Vector2d  v)
slot

Substracts current Point2d with specified Vector2d.

Parameters
vVector2d
Returns
New Point2d containing result

◆ minusEq

Point2d& Point2d::minusEq ( const Vector2d  v)
slot

Substract current Point2d with specified Vector2d.

Parameters
vVector2d
Returns
Point2d reference

◆ round [1/4]

Point2d& Point2d::round ( )
slot

round x and y to floor with a resolution of 1.0/64.0

◆ round [2/4]

Point2d& Point2d::round ( double  quantum)
slot

round x and y to floor with a resolution given

◆ round [3/4]

Point2d& Point2d::round ( const Vector2d  v)
slot

Rounds this point in the direction of the given vector and using the resolution of 1.0/64.0.

◆ round [4/4]

Point2d& Point2d::round ( const Vector2d  v,
double  quantum 
)
slot

Rounds this point in the direction of the given vector and using the given resolution.

◆ setXY

void Point2d::setXY ( const double  ,
const double   
)
slot

Set the value of x, y coordinate.

◆ toVector2d

Vector2d Point2d::toVector2d ( )
slot

Copy Point2d into a Vector2d container.

Returns
Vector2d

Property Documentation

◆ x

double Point2d::x
readwrite

x value

◆ y

double Point2d::y
readwrite

y value