Geometry2d
See source codeTable of contents
- area
- bounds
- center
- debugColor
- ignore
- isClosed
- isFilled
- isInternal
- isLabel
- length
- vertices
- Properties
- Methods
- distanceToLineSegment
- distanceToPoint
- getArea
- getBounds
- getLength
- getSvgPathData
- getVertices
- hitTestLineSegment
- hitTestPoint
- interpolateAlongEdge
- intersectCircle
- intersectLineSegment
- intersectPolygon
- intersectPolyline
- isExcludedByFilter
- isPointInBounds
- nearestPoint
- nearestPointOnLineSegment
- 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
center
readonly
get center(): Vec
debugColor
optional
debugColor?: string
ignore
optional
ignore?: boolean
isClosed
isClosed: 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
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
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
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
nearestPointOnLineSegment()
Deprecated: Iterate the vertices instead.
Parameters
Returns
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