Table of contents
abstract class Geometry2d {}

Constructor

Constructs a new instance of the Geometry2d class

Parameters
NameDescription

opts

Geometry2dOptions

Properties

area

get area(): number

bounds

get bounds(): Box

center

get center(): Vec

debugColor

debugColor?: string

ignore

ignore?: boolean

isClosed

isClosed: boolean

isFilled

isFilled: boolean

isLabel

isLabel: boolean

length

get length(): number

vertices

get vertices(): Vec[]

Methods

distanceToLineSegment()

distanceToLineSegment(A: Vec, B: Vec): number
Parameters
NameDescription

A

Vec

B

Vec
Returns
number

distanceToPoint()

distanceToPoint(point: Vec, hitInside?: boolean): number
Parameters
NameDescription

point

Vec

hitInside

boolean
Returns
number

getArea()

getArea(): number

getBounds()

getBounds(): Box

getLength()

getLength(): number

getSvgPathData()

abstract getSvgPathData(first: boolean): string
Parameters
NameDescription

first

boolean
Returns
string

getVertices()

abstract getVertices(): Vec[]

hitTestLineSegment()

hitTestLineSegment(A: Vec, B: Vec, distance?: number): boolean
Parameters
NameDescription

A

Vec

B

Vec

distance

number
Returns
boolean

hitTestPoint()

hitTestPoint(point: Vec, margin?: number, hitInside?: boolean): boolean
Parameters
NameDescription

point

Vec

margin

number

hitInside

boolean
Returns
boolean

isPointInBounds()

isPointInBounds(point: Vec, margin?: number): boolean
Parameters
NameDescription

point

Vec

margin

number
Returns
boolean

nearestPoint()

abstract nearestPoint(point: Vec): Vec
Parameters
NameDescription

point

Vec
Returns
Vec

nearestPointOnLineSegment()

nearestPointOnLineSegment(A: Vec, B: Vec): Vec
Parameters
NameDescription

A

Vec

B

Vec
Returns
Vec

toSimpleSvgPath()

toSimpleSvgPath(): string

ErrorBoundaryGroup2d