doodle.geom.createPoint

Description:

Point (x:number, y:number) :Point

Inherits

  1. Object

Parameters

  1. x:number – [optional]
  2. y:number – [optional]

Returns

  • Point –

Throws

  • TypeError –
  • SyntaxError –

Properties

x :number

The horizontal coordinate of the point.

Returns

  • number –

Throws

  • TypeError –
length :number

The length of the line segment from (0,0) to this point.

Returns

  • number –
y :number

The vertical coordinate of the point.

Returns

  • number –

Throws

  • TypeError –

Methods

add (pt:Point) :Point

Adds the coordinates of another point to the coordinates of this point to create a new point.

Parameters

  1. pt:Point – The point to be added.

Returns

  • Point – The new point.

Throws

  • TypeError –
polar (len:number, angle:number) :Point

Converts a pair of polar coordinates to a Cartesian point coordinate.

Parameters

  1. len:number – The length coordinate of the polar pair.
  2. angle:number – The angle, in radians, of the polar pair.

Returns

  • Point –

Throws

  • TypeError –
clone () :Point

Creates a copy of this Point object.

Returns

  • Point –
interpolate (pt1:Point, pt2:Point, t:number) :Point

Determines a point between two specified points.

Parameters

  1. pt1:Point – The first point.
  2. pt2:Point – The second point.
  3. t:number – The level of interpolation between the two points, between 0 and 1.

Returns

  • Point –

Throws

  • TypeError –
equals (pt:Point) :boolean

Determines whether two points are equal.

Parameters

  1. pt:Point – The point to be compared.

Returns

  • boolean –

Throws

  • TypeError –
id () :string

Returns

  • string –
offset (dx:number, dy:number) :void

Parameters

  1. dx:number –
  2. dy:number –

Throws

  • TypeError –
toArray () :Array

Returns an array that contains the values of the x and y coordinates.

Returns

  • Array –
toString () :string

Returns a string that contains the values of the x and y coordinates.

Returns

  • string –
normalize (thickness:number) :Point

Scales the line segment between (0,0) and the current point to a set length.

Parameters

  1. thickness:number – The scaling value.

Returns

  • Point –

Throws

  • TypeError –
compose (x:number, y:number) :Point

Set point coordinates.

Parameters

  1. x:number –
  2. y:number –

Returns

  • Point –

Throws

  • TypeError –
subtract (pt:Point) :Point

Subtracts the coordinates of another point from the coordinates of this point to create a new point.

Parameters

  1. pt:Point – The point to be subtracted.

Returns

  • Point – The new point.

Throws

  • TypeError –

Class Functions

isPoint (pt:Point) :boolean

Check if a given object contains a numeric x and y property. Does not check if a point is actually a doodle.geom.point.

Parameters

  1. pt:Point –

Returns

  • boolean –
distance (pt1:Point, pt2:Point) :number

Returns the distance between pt1 and pt2.

Parameters

  1. pt1:Point –
  2. pt2:Point –

Returns

  • number –

Throws

  • TypeError –