# Class: Point

## Point

Represents a 2d point.
Can be created in serveral ways:

#### new Point()[source]

``var point = new Point(1000, 1000);``
``var point = new Point([1000,1000]);``
``var point = new Point({x:1000, y:1000});``

### Methods

• #### closeTo(p, delta)[source]

• Compare with another point with a delta
Parameter Type Description
`p` Point
`delta` Number
Boolean:
• #### mag()[source]

• Return the magitude of this point: this is the Euclidean distance from the 0, 0 coordinate to this point's x and y coordinates.
##### Returns:
Number: magnitude
• #### unit()[source]

• Calculate this point but as a unit vector from 0, 0, meaning that the distance from the resulting point to the 0, 0 coordinate will be equal to 1 and the angle from the resulting point to the 0, 0 coordinate will be the same as before.
##### Returns:
Point: unit vector point
• #### perp()[source]

• Compute a perpendicular point, where the new y coordinate is the old x coordinate and the new x coordinate is the old y coordinate multiplied by -1
##### Returns:
Point: perpendicular point
• #### angleWith(b)[source]

• Get the angle between this point and another point, in radians from mapbox/point-geometry
Parameter Type Description
`b` Point the other point
##### Returns:
Number: angle
• #### rotate(a)[source]

• Rotate this point around the 0, 0 origin by an angle a, given in radians from mapbox/point-geometry
Parameter Type Description
`a` Number angle to rotate around, in radians
##### Returns:
Point: output point