# Class PathPoint

Represents a point along a NumericalPath, used for input and output of NumericalPath methods. Instance properties are public to avoid having numerous getter and setter methods.

## Constructors

• #### Parameters

• ##### `Optional`p: number

distance along path, measured in arc length

• ##### `Optional`calculateRadius: boolean

whether to calculate radius of curvature, default is `false`

## Properties

direction: number = 1

'direction' of curve with increasing `p` at this point: +1 means that increasing `p` moves to the right (or up for vertical line); -1 means that increasing `p` moves to the left (or down for vertical line).

dxdp: number = 0

`dx/dp` derivative of `x` with respect to `p`

dydp: number = 0

`dy/dp` derivative of `y` with respect to `p`

idx: number = -1

nearest index in the list of path points stored in a NumericalPath

normalX: number = 0

perpendicular normal unit vector at the point, X component

normalXdp: number = 0

`(normalXdp, normalYdp)` is derivative of normal vector with respect to arc length `p`

normalY: number = 0

perpendicular normal unit vector at the point, Y component

normalYdp: number = 0

`(normalXdp, normalYdp)` is derivative of normal vector with respect to arc length `p`

p: number

distance along path, measured in arc length

radius of curvature of the path at this point

whether to calculate radius of curvature

slope: number = NaN

slope may be infinite

slopeX: number = 0

`(slopeX, slopeY)` is a unit vector tangent to curve at point, in direction of increasing `p`

slopeY: number = 0

`(slopeX, slopeY)` is a unit vector tangent to curve at point, in direction of increasing `p`

x: number = 0

horizontal location of the point

y: number = 0

vertical location of the point

## Methods

• Copies all fields of the given PathPoint into this PathPoint

#### Parameters

• ##### ppt: PathPoint

the PathPoint to copy from

#### Returns void

• Returns the distance from the given `point` to the normal line thru this PathPoint. The normal line passes thru this PathPoint's location along the vector given by getNormal.

``````distance d from point (x1, y1) to line A x + B y + C = 0 is
d = | A x1 + B y1 + C | / sqrt(A^2 + B^2)
Let the normal at path point (x0, y0) be (nx, ny).
The line thru (x0, y0) with slope ny/nx is
y - y0 = (ny/nx)(x - x0)
Rearrange:
- ny x + nx y + ny x0 - nx y0 = 0
A = -ny
B = nx
C = ny x0 - nx y0
``````

#### Parameters

• ##### point: GenericVector

the point of interest

#### Returns number

distance from the given location to the line along the normal from this PathPoint

• Returns the perpendicular normal unit vector at this point.

#### Returns Vector

perpendicular normal unit vector at the point

• Returns location of this point in space.

#### Returns Vector

location of the point in space

• Returns a unit vector tangent to the curve at this point, in direction of increasing `p`.

#### Returns Vector

a unit vector tangent to curve at this point, in direction of increasing `p`

Generated using TypeDoc