Geometry2d
Table of contents
- area
- bounds
- boundsVertices
- center
- debugColor
- excludeFromShapeBounds
- ignore
- isClosed
- isEmptyLabel
- isFilled
- isInternal
- isLabel
- length
- vertices
- Properties
- Methods
- distanceToLineSegment
- distanceToPoint
- getArea
- getBounds
- getBoundsVertices
- getLength
- getSvgPathData
- getVertices
- hitTestLineSegment
- hitTestPoint
- ignoreHit
- interpolateAlongEdge
- intersectCircle
- intersectLineSegment
- intersectPolygon
- intersectPolyline
- isExcludedByFilter
- isPointInBounds
- nearestPoint
- overlapsPolygon
- toSimpleSvgPath
- transform
- uninterpolateAlongEdge
abstract class Geometry2d {}Constructor
Constructs a new instance of the Geometry2d class
Parameters
| Name | Description |
|---|---|
|
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
| Name | Description |
|---|---|
| |
| |
|
Returns
number;distanceToPoint( )
distanceToPoint(
point: VecLike,
hitInside?: boolean,
filters?: Geometry2dFilters,
): number;Parameters
| Name | Description |
|---|---|
| |
| |
|
Returns
number;getArea( )
getArea(): number;getBounds( )
getBounds(): Box;getBoundsVertices( )
getBoundsVertices(): Vec[];getLength( )
getLength(_filters?: Geometry2dFilters): number;Parameters
| Name | Description |
|---|---|
|
Returns
number;getSvgPathData( )
abstract getSvgPathData(first: boolean): string;Parameters
| Name | Description |
|---|---|
| |
Returns
string;getVertices( )
abstract getVertices(filters: Geometry2dFilters): Vec[];Parameters
| Name | Description |
|---|---|
|
Returns
Vec[];hitTestLineSegment( )
hitTestLineSegment(
A: VecLike,
B: VecLike,
distance?: number,
filters?: Geometry2dFilters,
): boolean;Parameters
| Name | Description |
|---|---|
| |
| |
| |
|
Returns
boolean;hitTestPoint( )
hitTestPoint(
point: VecLike,
margin?: number,
hitInside?: boolean,
_filters?: Geometry2dFilters,
): boolean;Parameters
| Name | Description |
|---|---|
| |
| |
| |
|
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
| Name | Description |
|---|---|
|
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
| Name | Description |
|---|---|
| |
|
Returns
Vec;intersectCircle( )
intersectCircle(
center: VecLike,
radius: number,
_filters?: Geometry2dFilters,
): VecLike[];Parameters
| Name | Description |
|---|---|
| |
| |
|
Returns
VecLike[];intersectLineSegment( )
intersectLineSegment(
A: VecLike,
B: VecLike,
_filters?: Geometry2dFilters,
): VecLike[];Parameters
| Name | Description |
|---|---|
| |
| |
|
Returns
VecLike[];intersectPolygon( )
intersectPolygon(polygon: VecLike[], _filters?: Geometry2dFilters): VecLike[];Parameters
| Name | Description |
|---|---|
| |
|
Returns
VecLike[];intersectPolyline( )
intersectPolyline(
polyline: VecLike[],
_filters?: Geometry2dFilters,
): VecLike[];Parameters
| Name | Description |
|---|---|
| |
|
Returns
VecLike[];isExcludedByFilter( )
isExcludedByFilter(filters?: Geometry2dFilters): boolean;Parameters
| Name | Description |
|---|---|
|
Returns
boolean;isPointInBounds( )
isPointInBounds(point: VecLike, margin?: number): boolean;Parameters
| Name | Description |
|---|---|
| |
| |
Returns
boolean;nearestPoint( )
abstract nearestPoint(point: VecLike, _filters?: Geometry2dFilters): Vec;Parameters
| Name | Description |
|---|---|
| |
|
Returns
Vec;overlapsPolygon( )
overlapsPolygon(_polygon: VecLike[]): boolean;Parameters
| Name | Description |
|---|---|
| |
Returns
boolean;toSimpleSvgPath( )
toSimpleSvgPath(): string;transform( )
transform(
transform: MatModel,
opts?: TransformedGeometry2dOptions,
): Geometry2d;Parameters
| Name | Description |
|---|---|
| |
|
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
| Name | Description |
|---|---|
| |
|
Returns
number;Prev
FontManagerNext
Group2d