# Api - point Namespace

## Functions

• Add two points together and return the result as a new point object.

#### Parameters

• ##### a: IPoint

First point.

• ##### b: IPoint

Second point.

#### Returns IPoint

A new point object.

### average

• Get the average of two points.

#### Parameters

• ##### a: IPoint

First point.

• ##### b: IPoint

Second point.

#### Returns IPoint

New point object which is the average of a and b.

### clone

• Clone a point into a new point.

#### Parameters

• ##### pointToClone: IPoint

The point to clone.

#### Returns IPoint

A new point with same values as the original.

### closest

• closest(referencePoint: IPoint, pointOptions: IPoint[]): IPoint
• From an array of points, find the closest point to a given reference point.

#### Parameters

• ##### referencePoint: IPoint

The reference point.

• ##### pointOptions: IPoint[]

Array of points to choose from.

#### Returns IPoint

The first closest point from the pointOptions.

### distort

• distort(pointToDistort: IPoint, scaleX: number, scaleY: number): IPoint
• Distort a point's coordinates.

#### Parameters

• ##### pointToDistort: IPoint

The point to distort.

• ##### scaleX: number

The amount of x scaling.

• ##### scaleY: number

The amount of y scaling.

A new point.

### fromAngleOnCircle

• Get a point on a circle or arc path, at a given angle.

#### Parameters

• ##### angleInDegrees: number

The angle at which you want to find the point, in degrees.

• ##### circle: IPathCircle

A circle or arc.

#### Returns IPoint

A new point object.

### fromArc

• Get the two end points of an arc path.

#### Parameters

• ##### arc: IPathArc

The arc path object.

#### Returns IPoint[]

Array with 2 elements: [0] is the point object corresponding to the start angle, [1] is the point object corresponding to the end angle.

### fromPathEnds

• fromPathEnds(pathContext: IPath, pathOffset?: IPoint): IPoint[]
• Get the two end points of a path.

#### Parameters

• ##### pathContext: IPath

The path object.

#### Returns IPoint[]

Array with 2 elements: [0] is the point object corresponding to the origin, [1] is the point object corresponding to the end.

### fromPolar

• Get a point from its polar coordinates.

#### Parameters

The angle of the polar coordinate, in radians.

The radius of the polar coordinate.

#### Returns IPoint

A new point object.

### fromSlopeIntersection

• Calculates the intersection of slopes of two lines.

#### Parameters

• ##### lineA: IPathLine

First line to use for slope.

• ##### lineB: IPathLine

Second line to use for slope.

• ##### Default value options: IPathIntersectionBaseOptions = {}

Optional IPathIntersectionOptions.

#### Returns IPoint

point of intersection of the two slopes, or null if the slopes did not intersect.

### middle

• Get the middle point of a path.

#### Parameters

• ##### pathContext: IPath

The path object.

• ##### Default value ratio: number = 0.5

Optional ratio (between 0 and 1) of point along the path. Default is .5 for middle.

#### Returns IPoint

Point on the path, in the middle of the path.

### mirror

• mirror(pointToMirror: IPoint, mirrorX: boolean, mirrorY: boolean): IPoint
• Create a clone of a point, mirrored on either or both x and y axes.

#### Parameters

• ##### pointToMirror: IPoint

The point to mirror.

• ##### mirrorX: boolean

Boolean to mirror on the x axis.

• ##### mirrorY: boolean

Boolean to mirror on the y axis.

#### Returns IPoint

Mirrored point.

### rotate

• Rotate a point.

#### Parameters

• ##### pointToRotate: IPoint

The point to rotate.

• ##### angleInDegrees: number

The amount of rotation, in degrees.

• ##### Default value rotationOrigin: IPoint = [0, 0]

The center point of rotation.

A new point.

### rounded

• Round the values of a point.

#### Parameters

• ##### pointContext: IPoint

The point to serialize.

• ##### Optional accuracy: number

Optional exemplar number of decimal places.

#### Returns IPoint

A new point with the values rounded.

### scale

• Scale a point's coordinates.

#### Parameters

• ##### pointToScale: IPoint

The point to scale.

• ##### scaleValue: number

The amount of scaling.

A new point.

### subtract

• Subtract a point from another point, and return the result as a new point. Shortcut to Add(a, b, subtract = true).

#### Parameters

• ##### a: IPoint

First point.

• ##### b: IPoint

Second point.

#### Returns IPoint

A new point object.

### zero

• A point at 0,0 coordinates. NOTE: It is important to call this as a method, with the empty parentheses.

A new point.

## Legend

• Module
• Object literal
• Variable
• Function
• Function with type parameter
• Index signature
• Type alias
• Enumeration
• Enumeration member
• Property
• Method
• Interface
• Interface with type parameter
• Constructor
• Property
• Method
• Index signature
• Class
• Class with type parameter
• Constructor
• Property
• Method
• Accessor
• Index signature
• Inherited constructor
• Inherited property
• Inherited method
• Inherited accessor
• Protected property
• Protected method
• Protected accessor
• Private property
• Private method
• Private accessor
• Static property
• Static method

Generated using TypeDoc