The Point object represents a location in a two-dimensional coordinate system, where _x_ represents the horizontal axis and _y_ represents the vertical axis.

The following code creates a point at(0,0):

Methods and properties of the following classes use Point objects:

- BitmapData
- DisplayObject
- DisplayObjectContainer
- DisplacementMapFilter
- NativeWindow
- Matrix
- Rectangle

You can use the `new Point()` constructor to create a Point object.

### Hierarchy

- Point

## Index

### Constructors

- constructor

### Properties

- length
- x
- y

### Methods

- add
- clone
- copyFrom
- equals
- get_length
- normalize
- offset
- setTo
- subtract
- toString
- distance
- interpolate
- polar

## Constructors

### constructor

- new Point(x?: number, y?: number): Point

- - Defined in lib/openfl/geom/Point.d.ts:44

  Creates a new point. If you pass no parameters to this method, a point is created at(0,0).

  #### Parameters

  - ##### Optional x: number

    The horizontal coordinate.

  - ##### Optional y: number

    The vertical coordinate.

  #### Returns Point

## Properties

### length

length: number

- Defined in lib/openfl/geom/Point.d.ts:32

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

### x

x: number

- Defined in lib/openfl/geom/Point.d.ts:39

The horizontal coordinate of the point. The default value is 0.

### y

y: number

- Defined in lib/openfl/geom/Point.d.ts:44

The vertical coordinate of the point. The default value is 0.

## Methods

### add

- add(v: Point): Point

- - Defined in lib/openfl/geom/Point.d.ts:64

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

  #### Parameters

  - ##### v: Point

    The point to be added.

  #### Returns Point

  The new point.

### clone

- clone(): Point

- - Defined in lib/openfl/geom/Point.d.ts:72

  Creates a copy of this Point object.

  #### Returns Point

  The new Point object.

### copyFrom

- copyFrom(sourcePoint: Point): void

- - Defined in lib/openfl/geom/Point.d.ts:75

  #### Parameters

  - ##### sourcePoint: Point

  #### Returns void

### equals

- equals(toCompare: Point): boolean

- - Defined in lib/openfl/geom/Point.d.ts:96

  Determines whether two points are equal. Two points are equal if they have the same _x_ and _y_ values.

  #### Parameters

  - ##### toCompare: Point

    The point to be compared.

  #### Returns boolean

  A value of `true` if the object is equal to this Point object; `false` if it is not equal.

### Protected get_length

- get_length(): number

- - Defined in lib/openfl/geom/Point.d.ts:34

  #### Returns number

### normalize

- normalize(thickness: number): void

- - Defined in lib/openfl/geom/Point.d.ts:130

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

  #### Parameters

  - ##### thickness: number

    The scaling value. For example, if the current point is (0,5), and you normalize it to 1, the point returned is at(0,1).

  #### Returns void

  The normalized point.

### offset

- offset(dx: number, dy: number): void

- - Defined in lib/openfl/geom/Point.d.ts:143

  Offsets the Point object by the specified amount. The value of `dx` is added to the original value of _x_ to create the new _x_ value. The value of `dy` is added to the original value of _y_ to create the new _y_ value.

  #### Parameters

  - ##### dx: number

    The amount by which to offset the horizontal coordinate, _x_.

  - ##### dy: number

    The amount by which to offset the vertical coordinate, _y_.

  #### Returns void

### setTo

- setTo(xa: number, ya: number): void

- - Defined in lib/openfl/geom/Point.d.ts:157

  #### Parameters

  - ##### xa: number

  - ##### ya: number

  #### Returns void

### subtract

- subtract(v: Point): Point

- - Defined in lib/openfl/geom/Point.d.ts:167

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

  #### Parameters

  - ##### v: Point

    The point to be subtracted.

  #### Returns Point

  The new point.

### toString

- toString(): string

- - Defined in lib/openfl/geom/Point.d.ts:178

  Returns a string that contains the values of the _x_ and _y_ coordinates. The string has the form `"(x=_x_, y=_y_)"`, so calling the `toString()` method for a point at 23,17 would return `"(x=23, y=17)"`.

  #### Returns string

  The string representation of the coordinates.

### Static distance

- distance(pt1: Point, pt2: Point): number

- - Defined in lib/openfl/geom/Point.d.ts:85

  Returns the distance between `pt1` and `pt2`.

  #### Parameters

  - ##### pt1: Point

    The first point.

  - ##### pt2: Point

    The second point.

  #### Returns number

  The distance between the first and second points.

### Static interpolate

- interpolate(pt1: Point, pt2: Point, f: number): Point

- - Defined in lib/openfl/geom/Point.d.ts:118

  Determines a point between two specified points. The parameter `f` determines where the new interpolated point is located relative to the two end points specified by parameters `pt1` and `pt2`. The closer the value of the parameter `f` is to `1.0`, the closer the interpolated point is to the first point(parameter `pt1`). The closer the value of the parameter `f` is to 0, the closer the interpolated point is to the second point(parameter `pt2`).

  #### Parameters

  - ##### pt1: Point

    The first point.

  - ##### pt2: Point

    The second point.

  - ##### f: number

    The level of interpolation between the two points. Indicates where the new point will be, along the line between `pt1` and `pt2`. If `f`=1, `pt1` is returned; if `f`=0, `pt2` is returned.

  #### Returns Point

  The new, interpolated point.

### Static polar

- polar(len: number, angle: number): Point

- - Defined in lib/openfl/geom/Point.d.ts:153

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

  #### Parameters

  - ##### len: number

    The length coordinate of the polar pair.

  - ##### angle: number

    The angle, in radians, of the polar pair.

  #### Returns Point

  The Cartesian point.

Generated using TypeDoc