Geometry2d

See source code
Table of contents
abstract class Geometry2d {}

Constructor

Constructs a new instance of the Geometry2d class

Parameters

NameDescription

opts


Properties

area

readonly
get area(): number;

bounds

readonly
get bounds(): Box;

boundsVertices

readonly
get boundsVertices(): Vec[];

center

readonly
get center(): Vec;

debugColor

optional
debugColor?: string;

excludeFromShapeBounds

excludeFromShapeBounds: boolean;

ignore

optional
ignore?: boolean;

isClosed

isClosed: boolean;

isEmptyLabel

isEmptyLabel: boolean;

isFilled

isFilled: boolean;

isInternal

isInternal: boolean;

isLabel

isLabel: boolean;

length

readonly
get length(): number;

vertices

readonly
get vertices(): Vec[];

Methods

distanceToLineSegment( )

distanceToLineSegment(
  A: VecLike,
  B: VecLike,
  filters?: Geometry2dFilters,
): number;

Parameters

NameDescription

A

VecLike;

B

VecLike;

filters

Returns

number;

distanceToPoint( )

distanceToPoint(
  point: VecLike,
  hitInside?: boolean,
  filters?: Geometry2dFilters,
): number;

Parameters

NameDescription

point

VecLike;

hitInside

boolean;

filters

Returns

number;

getArea( )

getArea(): number;

getBounds( )

getBounds(): Box;

getBoundsVertices( )

getBoundsVertices(): Vec[];

getLength( )

getLength(_filters?: Geometry2dFilters): number;

Parameters

NameDescription

_filters

Returns

number;

getSvgPathData( )

abstract getSvgPathData(first: boolean): string;

Parameters

NameDescription

first

boolean;

Returns

string;

getVertices( )

abstract getVertices(filters: Geometry2dFilters): Vec[];

Parameters

NameDescription

filters

Returns

Vec[];

hitTestLineSegment( )

hitTestLineSegment(
  A: VecLike,
  B: VecLike,
  distance?: number,
  filters?: Geometry2dFilters,
): boolean;

Parameters

NameDescription

A

VecLike;

B

VecLike;

distance

number;

filters

Returns

boolean;

hitTestPoint( )

hitTestPoint(
  point: VecLike,
  margin?: number,
  hitInside?: boolean,
  _filters?: Geometry2dFilters,
): boolean;

Parameters

NameDescription

point

VecLike;

margin

number;

hitInside

boolean;

_filters

Returns

boolean;

ignoreHit( )

Called after a hit test succeeds. Return true to reject the hit and allow shapes behind this one to be selected instead (e.g. transparent image pixels).

ignoreHit(_point: VecLike): boolean;

Parameters

NameDescription

_point

VecLike;

Returns

boolean;

interpolateAlongEdge( )

Find a point along the edge of the geometry that is a fraction t along the entire way round.

interpolateAlongEdge(t: number, _filters?: Geometry2dFilters): Vec;

Parameters

NameDescription

t

number;

_filters

Returns

Vec;

intersectCircle( )

intersectCircle(
  center: VecLike,
  radius: number,
  _filters?: Geometry2dFilters,
): VecLike[];

Parameters

NameDescription

center

VecLike;

radius

number;

_filters

Returns

VecLike[];

intersectLineSegment( )

intersectLineSegment(
  A: VecLike,
  B: VecLike,
  _filters?: Geometry2dFilters,
): VecLike[];

Parameters

NameDescription

A

VecLike;

B

VecLike;

_filters

Returns

VecLike[];

intersectPolygon( )

intersectPolygon(polygon: VecLike[], _filters?: Geometry2dFilters): VecLike[];

Parameters

NameDescription

polygon

VecLike[];

_filters

Returns

VecLike[];

intersectPolyline( )

intersectPolyline(
  polyline: VecLike[],
  _filters?: Geometry2dFilters,
): VecLike[];

Parameters

NameDescription

polyline

VecLike[];

_filters

Returns

VecLike[];

isExcludedByFilter( )

isExcludedByFilter(filters?: Geometry2dFilters): boolean;

Parameters

NameDescription

filters

Returns

boolean;

isPointInBounds( )

isPointInBounds(point: VecLike, margin?: number): boolean;

Parameters

NameDescription

point

VecLike;

margin

number;

Returns

boolean;

nearestPoint( )

abstract nearestPoint(point: VecLike, _filters?: Geometry2dFilters): Vec;

Parameters

NameDescription

point

VecLike;

_filters

Returns

Vec;

overlapsPolygon( )

overlapsPolygon(_polygon: VecLike[]): boolean;

Parameters

NameDescription

_polygon

VecLike[];

Returns

boolean;

toSimpleSvgPath( )

toSimpleSvgPath(): string;

transform( )

transform(
  transform: MatModel,
  opts?: TransformedGeometry2dOptions,
): Geometry2d;

Parameters

NameDescription

transform

opts

Returns


uninterpolateAlongEdge( )

Take point, find the closest point to it on the edge of the geometry, and return how far along the edge it is as a fraction of the total length.

uninterpolateAlongEdge(point: VecLike, _filters?: Geometry2dFilters): number;

Parameters

NameDescription

point

VecLike;

_filters

Returns

number;

Prev
FontManager
Next
Group2d