class Geometry · Computations
Curves
Creates curves along a polyline, polygon or circle whose distance from it follows given values (offset curves), and the filled areas between such a curve and its baseline.
Static methods
alongCirclestatic
static alongCircle(circle: Circle | ShapeLike, positions: Real[] | NumbersLike, values: Real[] | NumbersLike, shift: Real | NumberLike, left: Bool | BoolLike, result?: Shape | null): ShapeCreates an offset curve at explicit angular positions along a circle. Each value offsets the corresponding position perpendicularly away from the baseline.
circle- The circle defining the baseline.
positions- The angular positions (in radians) at which values are sampled.
values- The offset distance at each position.
shift- An angular offset applied uniformly to all positions.
left- If
true, offsets point to the left of the travel direction (increasing angle), which on a circle is outward; otherwise inward. resultoptional- Optional
Shapeto write the result into; it is returned. Without it, a newShapeis returned.
Returns A shape representing the offset curve along circle.
alongCircleUniformstatic
static alongCircleUniform(circle: Circle | ShapeLike, values: Real[] | NumbersLike, angleOffset: Real | NumberLike, left: Bool | BoolLike, result?: Shape | null): ShapeCreates an offset curve with values evenly distributed around a circle.
circle- The circle defining the baseline.
values- The offset distance at each evenly spaced position.
angleOffset- The angular offset from which distribution begins.
left- If
true, offsets point to the left of the travel direction (increasing angle), which on a circle is outward; otherwise inward. resultoptional- Optional
Shapeto write the result into; it is returned. Without it, a newShapeis returned.
Returns A shape representing the uniformly sampled offset curve along circle.
alongPolygonstatic
static alongPolygon(baseline: Polygon | ShapeLike, positions: Real[] | NumbersLike, values: Real[] | NumbersLike, shift: Real | NumberLike, left: Bool | BoolLike, result?: Polygon | null): PolygonCreates an offset curve at explicit distances along a polygon boundary. Each value offsets the corresponding position perpendicularly away from the baseline. Distances exceeding the perimeter wrap around.
baseline- The polygon defining the baseline.
positions- The distances along the boundary at which values are sampled.
values- The offset distance at each position.
shift- A distance offset applied uniformly to all positions.
left- If
true, offsets point to the left of the travel direction; otherwise to the right. resultoptional- Optional
Polygonto write the result into; it is returned. Without it, a newPolygonis returned.
Returns A polygon representing the offset curve along baseline.
alongPolygonAtRatiosstatic
static alongPolygonAtRatios(baseline: Polygon | ShapeLike, ratios: number[], values: number[], left: Bool | BoolLike, result?: Polygon | null): PolygonA curve beside a polygon: one vertex per ratio, values away on the left or right side,
e.g. the outline of an elevation profile drawn beside a route.
Vertex k is Polygons.pointBeside(baseline, ratios[k], values[k], left) (ratio by length,
ratios wrap around (1.25 = 0.25); at a corner the miter, at most 4 × the value; exactly the
value away from a straight edge). Sides are relative to the direction of travel, a negative
value goes to the other side. The vertices keep the order of ratios; the count is that of
the shorter list. The curve is closed (a polygon). Unlike alongPolygon (distances, the
edge's normal), the positions are ratios and the curve has no kinks at the vertices of
baseline. With result, the values are written into its vertices (vertices are added or
removed at the end), so a visual passed as result follows.
baseline- The polygon to follow.
ratios- The positions along
baseline, 0 = first vertex, 1 = first vertex again. values- The distance from
baselineat each ratio. lefttruefor the left side of the direction of travel,falsefor the right.resultoptional- Optional
Polygonto write the result into; it is returned. Without it, a newPolygonis returned.
Returns The curve beside baseline.
alongPolygonUniformstatic
static alongPolygonUniform(baseline: Polygon | ShapeLike, values: Real[] | NumbersLike, left: Bool | BoolLike, result?: Polygon | null): PolygonCreates an offset curve with values evenly distributed along a polygon boundary.
baseline- The polygon defining the baseline.
values- The offset distance at each evenly spaced position.
left- If
true, offsets point to the left of the travel direction; otherwise to the right. resultoptional- Optional
Polygonto write the result into; it is returned. Without it, a newPolygonis returned.
Returns A polygon representing the uniformly sampled offset curve along baseline.
alongPolylinestatic
static alongPolyline(baseline: Polyline | ShapeLike, positions: Real[] | NumbersLike, values: Real[] | NumbersLike, shift: Real | NumberLike, left: Bool | BoolLike, result?: Polyline | null): PolylineCreates an offset curve at explicit distances along a polyline. Each value offsets the corresponding position perpendicularly away from the baseline. Positions outside the polyline's length are clamped to the endpoints.
baseline- The polyline defining the baseline.
positions- The distances along the polyline at which values are sampled.
values- The offset distance at each position.
shift- A distance offset applied uniformly to all positions.
left- If
true, offsets point to the left of the travel direction; otherwise to the right. resultoptional- Optional
Polylineto write the result into; it is returned. Without it, a newPolylineis returned.
Returns A polyline representing the offset curve along baseline.
alongPolylineAtRatiosstatic
static alongPolylineAtRatios(baseline: Polyline | ShapeLike, ratios: number[], values: number[], left: Bool | BoolLike, result?: Polyline | null): PolylineA curve beside a polyline: one vertex per ratio, values away on the left or right side,
e.g. the outline of an elevation profile drawn beside a route.
Vertex k is Polylines.pointBeside(baseline, ratios[k], values[k], left) (ratio by length,
ratios below 0 and above 1 are clamped to the ends; at a corner the miter, at most 4 × the
value; exactly the value away from a straight edge). Sides are relative to the direction of
travel, a negative value goes to the other side. The vertices keep the order of ratios; the
count is that of the shorter list. Unlike alongPolyline (distances, the edge's normal), the
positions are ratios and the curve has no kinks at the vertices of baseline. With result,
the values are written into its vertices (vertices are added or removed at the end), so a
visual passed as result follows.
baseline- The polyline to follow.
ratios- The positions along
baseline, 0 = first vertex, 1 = last vertex. values- The distance from
baselineat each ratio. lefttruefor the left side of the direction of travel,falsefor the right.resultoptional- Optional
Polylineto write the result into; it is returned. Without it, a newPolylineis returned.
Returns The curve beside baseline.
alongPolylineUniformstatic
static alongPolylineUniform(baseline: Polyline | ShapeLike, values: Real[] | NumbersLike, left: Bool | BoolLike, result?: Polyline | null): PolylineCreates an offset curve with values evenly distributed along a polyline.
baseline- The polyline defining the baseline.
values- The offset distance at each evenly spaced position.
left- If
true, offsets point to the left of the travel direction; otherwise to the right. resultoptional- Optional
Polylineto write the result into; it is returned. Without it, a newPolylineis returned.
Returns A polyline representing the uniformly sampled offset curve along baseline.
filledAlongCirclestatic
static filledAlongCircle(circle: Circle | ShapeLike, values: Real[] | NumbersLike, angleOffset: Real | NumberLike, left: Bool | BoolLike, result?: Polygon | null): PolygonCreates a filled area between a circle baseline and its uniform offset curve. The result traces the baseline forward and the curve backward, forming a closed ring.
Both edges run in straight lines between the values (the outer one is the curve of
alongCircleUniform), and both are closed at the first value, so the ring goes all the way
around with a seam of zero width at the first value.
circle- The circle defining the baseline.
values- The offset distance at each evenly spaced position.
angleOffset- The angular offset from which distribution begins.
left- If
true, the curve extends to the left of the travel direction (increasing angle), which on a circle is outward; otherwise inward. resultoptional- Optional
Polygonto write the result into; it is returned. Without it, a newPolygonis returned.
Returns A closed polygon forming the band between circle and its offset curve.
filledAlongPolygonstatic
static filledAlongPolygon(baseline: Polygon | ShapeLike, values: Real[] | NumbersLike, left: Bool | BoolLike, result?: Polygon | null): PolygonCreates a filled area between a polygon baseline and its uniform offset curve. The result traces the baseline forward and the curve backward, forming a closed ring.
Both edges run in straight lines between the values (the outer one is the curve of
alongPolygonUniform), and both are closed at the first value, so the ring goes all the way
around with a seam of zero width at the first value.
baseline- The polygon defining the baseline.
values- The offset distance at each evenly spaced position.
left- If
true, the curve extends to the left of the travel direction; otherwise to the right. resultoptional- Optional
Polygonto write the result into; it is returned. Without it, a newPolygonis returned.
Returns A closed polygon forming the band between baseline and its offset curve.
filledAlongPolygonAtRatiosstatic
static filledAlongPolygonAtRatios(baseline: Polygon | ShapeLike, ratios: number[], values: number[], left: Bool | BoolLike, result?: Polygon | null): PolygonThe filled band between a polygon and the curve at values beside it at the given ratios,
e.g. the area of an elevation profile drawn beside a route.
The band runs along the curve (as alongPolygonAtRatios) from the first ratio to the last,
then back along baseline through its vertices, so its inner edge follows the polygon
exactly. Meant for ascending ratios. The way back runs forwards around the polygon, so ratios
from 0 to 1 (both included) give a closed ring. Sides, ratios (ratios wrap around (1.25 =
0.25)) and the corner model as in alongPolygonAtRatios. With result, the values are
written into its vertices (vertices are added or removed at the end), so a visual passed as
result follows.
baseline- The polygon to follow.
ratios- The positions along
baseline, 0 = first vertex, 1 = first vertex again. values- The distance from
baselineat each ratio. lefttruefor the left side of the direction of travel,falsefor the right.resultoptional- Optional
Polygonto write the result into; it is returned. Without it, a newPolygonis returned.
Returns A polygon: the curve forward, then baseline back.
filledAlongPolylinestatic
static filledAlongPolyline(baseline: Polyline | ShapeLike, values: Real[] | NumbersLike, left: Bool | BoolLike, result?: Polygon | null): PolygonCreates a filled area between a polyline baseline and its uniform offset curve. The result traces the baseline forward and the curve backward, forming a closed polygon.
baseline- The polyline defining the baseline.
values- The offset distance at each evenly spaced position.
left- If
true, the curve extends to the left of the travel direction; otherwise to the right. resultoptional- Optional
Polygonto write the result into; it is returned. Without it, a newPolygonis returned.
Returns A closed polygon forming the area between baseline and its offset curve.
filledAlongPolylineAtRatiosstatic
static filledAlongPolylineAtRatios(baseline: Polyline | ShapeLike, ratios: number[], values: number[], left: Bool | BoolLike, result?: Polygon | null): PolygonThe filled band between a polyline and the curve at values beside it at the given ratios,
e.g. the area of an elevation profile drawn beside a route.
The band runs along the curve (as alongPolylineAtRatios) from the first ratio to the last,
then back along baseline through its vertices, so its inner edge follows the polyline
exactly. Meant for ascending ratios. Sides, ratios (ratios below 0 and above 1 are clamped to
the ends) and the corner model as in alongPolylineAtRatios. With result, the values are
written into its vertices (vertices are added or removed at the end), so a visual passed as
result follows.
baseline- The polyline to follow.
ratios- The positions along
baseline, 0 = first vertex, 1 = last vertex. values- The distance from
baselineat each ratio. lefttruefor the left side of the direction of travel,falsefor the right.resultoptional- Optional
Polygonto write the result into; it is returned. Without it, a newPolygonis returned.
Returns A polygon: the curve forward, then baseline back.
