@baku89/pave / Segment
Segment
A collection of functions to handle Segment.
Functions
bounds()
bounds(
seg
):Rect
Defined in: Segment.ts:53
Returns the bounding box of the segment.
Parameters
Parameter | Type |
---|---|
seg | SegmentL | SegmentC | SegmentA |
Returns
derivative()
derivative(
seg
,loc
):vec2
Defined in: Segment.ts:79
Returns the derivative of the segment at the given location.
Parameters
Parameter | Type |
---|---|
seg | SegmentL | SegmentC | SegmentA |
loc | SegmentLocation |
Returns
vec2
divideAtTimes()
divideAtTimes(
seg
,times
):Vertex
[]
Defined in: Segment.ts:178
Returns a new vertex array with the segment divided at the given times.
Parameters
Parameter | Type |
---|---|
seg | SegmentL | SegmentC | SegmentA |
times | Iterable <number > |
Returns
Vertex
[]
isStraight()
isStraight(
seg
):boolean
Defined in: Segment.ts:148
Returns true if the segment is a straight line. Also returns true for zero-length segments.
Parameters
Parameter | Type |
---|---|
seg | SegmentL | SegmentC | SegmentA |
Returns
boolean
isZero()
isZero(
seg
):boolean
Defined in: Segment.ts:135
Returns true if the segment is a zero-length segment.
Parameters
Parameter | Type |
---|---|
seg | SegmentL | SegmentC | SegmentA |
Returns
boolean
length()
length(
seg
):number
Defined in: Segment.ts:40
Returns the length of the segment.
Parameters
Parameter | Type |
---|---|
seg | SegmentL | SegmentC | SegmentA |
Returns
number
normal()
normal(
seg
,loc
):vec2
Defined in: Segment.ts:100
Returns the normal vector of the segment at the given location., which is normally rotated 90 degrees clockwise in Y-down coordinate.
Parameters
Parameter | Type |
---|---|
seg | SegmentL | SegmentC | SegmentA |
loc | SegmentLocation |
Returns
vec2
offset()
offset(
seg
,distance
,unarcAngle
):Path
Defined in: Segment.ts:161
Returns a new path with the segment offset by the given distance.
Parameters
Parameter | Type | Default value |
---|---|---|
seg | SegmentL | SegmentC | SegmentA | undefined |
distance | number | undefined |
unarcAngle | number | 90 |
Returns
orientation()
orientation(
seg
,loc
):mat2d
Defined in: Segment.ts:108
Returns the orientation matrix of the segment at the given location.
Parameters
Parameter | Type |
---|---|
seg | SegmentL | SegmentC | SegmentA |
loc | SegmentLocation |
Returns
mat2d
point()
point(
seg
,loc
):vec2
Defined in: Segment.ts:66
Returns the point of the segment at the given location.
Parameters
Parameter | Type |
---|---|
seg | SegmentL | SegmentC | SegmentA |
loc | SegmentLocation |
Returns
vec2
tangent()
tangent(
seg
,loc
):vec2
Defined in: Segment.ts:92
Returns the tangent vector of the segment at the given location.
Parameters
Parameter | Type |
---|---|
seg | SegmentL | SegmentC | SegmentA |
loc | SegmentLocation |
Returns
vec2
toTime()
toTime(
seg
,loc
):number
Defined in: Segment.ts:194
Returns the time of the segment at the given location.
Parameters
Parameter | Type |
---|---|
seg | SegmentL | SegmentC | SegmentA |
loc | SegmentLocation |
Returns
number
trim()
Defined in: Segment.ts:118
Returns a new segment that is the result of trimming the given segment from the start to the end.
Parameters
Parameter | Type |
---|---|
seg | SegmentL | SegmentC | SegmentA |
from | SegmentLocation |
to | SegmentLocation |