A simple 2D position/vector container.

See also:

Constructor

@:value({ y : 0., x : 0. })inlinenew(x:Float = 0., y:Float = 0.)

Create a new Point instance.

Parameters:

x

The horizontal position of the point.

y

The vertical position of the point.

Variables

x:Float

The horizontal position of the point.

y:Float

The vertical position of the point.

Methods

inlineadd(p:Point):Point

Adds Point p to this Point and returns new Point with the result.

inlineclone():Point

Returns a copy of this Point.

inlinecross(p:Point):Float

Returns a cross product between this Point and a given Point p.

inlinedistance(p:Point):Float

Returns a distance between this Point and given Point p.

inlinedistanceSq(p:Point):Float

Returns squared distance between this Point and given Point p.

inlinedot(p:Point):Float

Returns a dot product between this Point and given Point p.

inlineequals(other:Point):Bool

Tests if this Point position equals to other Point position.

inlinelength():Float

Returns length (distance to 0,0) of this Point.

inlinelengthSq():Float

Returns squared length of this Point.

inlinelerp(a:Point, b:Point, k:Float):Void

Sets this Point position to a result of linear interpolation between Points p1 and p2 at the interpolant position k.

inlineload(p:Point):Void

Copies x,y from given Point p to this Point.

inlinenormalize():Void

Normalizes the Point.

inlinenormalized():Point

Returns a new Point with the normalized values of this Point.

inlinerotate(angle:Float):Void

Rotates this Point around 0,0 by a given angle.

inlinescale(f:Float):Void

Multiplies x,y by scalar f.

inlinescaled(v:Float):Point

Returns a new Point with the position of this Point multiplied by a given scalar v.

@:value({ y : 0., x : 0. })inlineset(x:Float = 0., y:Float = 0.):Void

Sets the Point x,y with given values.

inlinesub(p:Point):Point

Substracts Point p from this Point and returns new Point with the result.

@:value({ scale : 1. })inlinetoIPoint(scale:Float = 1.):IPoint

Converts this point to integer point scaled by provided scalar scale (rounded).

inlinetransform(m:Matrix):Void

Applies a given Matrix m transformation to this Point position.

inlinetransform2x2(m:Matrix):Void

Applies a given 2x2 Matrix m transformation to this Point position.

inlinetransformed(m:Matrix):Point

Returns a new Point with a result of applying a Matrix m to this Point position.

inlinetransformed2x2(m:Matrix):Point

Returns a new Point with a result of applying a 2x2 Matrix m to this Point position.