vgpu-render 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -129,10 +129,12 @@ const frame = debug.beginFrame();
129
129
  frame.d2.line([0, 0], [120, 40], { width: 2, color: [1, 0, 0, 1] });
130
130
  frame.d2.lineStrip([[0, 0], [40, 80], [90, 10]], { width: 4, joint: "round" });
131
131
  frame.d2.grid([0, 0], [8, 5], [40, 40], { color: [0.4, 0.4, 0.5, 1] });
132
- frame.d2.rect([0, 0], [80, 40], { fill: false, strokeWidth: 2 });
133
- frame.d2.roundedRect([0, -60], [120, 40], 12, { color: [1, 0.7, 0.3, 1] });
134
- frame.d2.circle([0, 120], 60, { color: [0, 0.5, 1, 1] });
135
- frame.d2.arc([0, 120], 80, { fill: false, strokeWidth: 3, startAngle: 0, sweep: Math.PI / 2 });
132
+ frame.d2.rect([0, 0], [80, 40], { strokeWidth: 2 });
133
+ frame.d2.rect_s([160, 0], [80, 40], { color: [0.9, 0.9, 1, 1] });
134
+ frame.d2.rect_d([320, 0], [80, 40], [12, 6, 0], { strokeWidth: 2 });
135
+ frame.d2.rect_r_s([0, -60], [120, 40], 12, { color: [1, 0.7, 0.3, 1] });
136
+ frame.d2.circle_s([0, 120], 60, { color: [0, 0.5, 1, 1] });
137
+ frame.d2.arc([0, 120], 80, { strokeWidth: 3, startAngle: 0, sweep: Math.PI / 2 });
136
138
  const commands = debug.finishFrame(frame);
137
139
  // The third argument is the 2D camera; omit it and the last one stays in effect.
138
140
  renderer.prepare(commands, { viewProjection, view }, { pan: [0, 0], zoom: 1 });
@@ -152,13 +154,26 @@ gallery); `world2d` needs no such step because its projection already reads the
152
154
  coordinate in that sense, not a top-left one — the top-left, +y-down space is the reference UI space,
153
155
  and here it is `screen`, the same one `TextSpace "screen"` already uses.
154
156
 
155
- - Strokes: `line`, `ray`, `lineStrip`/`polyline`, `grid`, `point`; screen-pixel or world widths,
156
- dashes with the same phase accumulation as the 3D paths, and round/bevel/miter joints.
157
- - Shapes: `rect`, `roundedRect`, `circle`, `ellipse`, `arc`, `annulus`, `capsule`, `polygon`,
157
+ - Strokes: `line`, `ray`, `lineStrip`/`polyline`, `lineLoop`, `grid`, `point`; every stroke has a
158
+ `_d` twin (`line_d`, `ray_d`, `lineStrip_d`, `polyline_d`, `lineLoop_d`, `grid_d`) that takes the
159
+ same `[visible, gap, phase]` triple and phase accumulation as the 3D dashed paths. Screen-pixel or
160
+ world widths, and round/bevel/miter joints.
161
+ - Arrows: `arrow` / `arrow_s` / `arrow_d` / `arrow_s_d` — the open V head by default, a filled head
162
+ for `_s`, and the same two forms dashed for `_d`, with `headLength` / `headAngle` options.
163
+ - Curves: `curve(curve, options)` / `curve_d(curve, dash, options)` sample a cubic control polygon
164
+ (`Curve2D`, the 2D twin of `Curve3D`) into a strip, with `tolerance`, `transform.center/rotation/scale`
165
+ and `closed` the same way the 3D page uses them. The 2D Curve page mirrors the 3D one: a
166
+ construction band below the matrix draws every control point (pink anchors, amber handles) for the
167
+ seven reference curve shapes.
168
+ - Shapes: `rect`, `rect_r`, `circle`, `ellipse`, `arc`, `annulus`, `capsule`, `polygon`,
158
169
  `triangle`, `rhombus`, `sector`, `segment`. Each is one instanced quad evaluated as a signed
159
170
  distance field in the fragment stage, so nothing is triangulated on the CPU and an outline
160
- width stays a pixel count at any zoom. `fill: false` plus `strokeWidth` turns any of them into
161
- an outline; an `arc`'s outline is clipped to its `startAngle`/`sweep` wedge.
171
+ width stays a pixel count at any zoom. Every primitive follows the 3D naming: `<shape>` strokes
172
+ the outline, `<shape>_s` fills it and `<shape>_d` dashes the outline along its perimeter,
173
+ taking the same `[visible, gap, phase]` triple as the line layer. `arc` has no interior, so it
174
+ has no `_s` variant, and `Shape2DOptions` no longer carries `fill` — the method name decides.
175
+ Dashes are cut from the shape's perimeter parameter, a closed form for every primitive except
176
+ the ellipse (Simpson-integrated arc length), so they stay continuous across corners.
162
177
  - The layer is an overlay: it draws after every 3D primitive, pins itself to the near plane and
163
178
  does not write depth. Screen-space text remains the last thing drawn.
164
179
  - `InfiniteGrid2D` renders the reference's 2D grid as a full-viewport shader quad: decimal LOD levels,
@@ -166,10 +181,12 @@ does not write depth. Screen-space text remains the last thing drawn.
166
181
  `cellSize`, `lineWidthPixels`, `minPixelsBetweenCells`, the LOD range and both line colors from
167
182
  the gallery's grid panel, and draws as the 2D layer's background.
168
183
  - The 2D camera is independent of the 3D one (`mode: "3d" | "2d"` in the gallery config); the
169
- `2d-*` pages fit their declared `view2d` extent, drag or hold WASD to pan, and scroll to zoom. The gallery
170
- classifies the 2D layer like the 3D scenes: `2d-gizmos` and `2d-shapes` are overviews, while
171
- `2d-lines`, `2d-curves`, `2d-markers`, `2d-outlines`, `2d-fill`, `2d-spaces` and `2d-grid` are
172
- column-by-row matrices whose column titles and sample labels are `world2d` text, so they pan
184
+ `2d-*` pages fit their declared `view2d` extent, drag or hold WASD to pan, hold shift to sprint, and scroll to zoom. The gallery
185
+ classifies the 2D layer like the 3D scenes: `2d-index` is the API index, the twelve shape pages
186
+ (`2d-rect`, `2d-rounded-rect`, `2d-circle`, `2d-ellipse`, `2d-arc`, `2d-annulus`, `2d-capsule`,
187
+ `2d-polygon`, `2d-triangle`, `2d-rhombus`, `2d-sector`, `2d-segment`) each own one primitive, and
188
+ `2d-lines`, `2d-curves`, `2d-markers`, `2d-arrows`, `2d-spaces`, `2d-grid` cover the stroke API
189
+ families. Every matrix page's column titles and sample labels are `world2d` text, so they pan
173
190
  and zoom with the geometry they annotate.
174
191
 
175
192
  ## Text
package/dist/curve.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { Vec2 } from "./camera-2d.js";
1
2
  import type { Vec3 } from "./frame-draw-list.js";
2
3
  export type CurvePoint = {
3
4
  readonly position: Vec3;
@@ -14,3 +15,27 @@ export type CurveTransform = {
14
15
  };
15
16
  export declare function rotatePoint(p: Vec3, rotation: readonly [number, number, number]): Vec3;
16
17
  export declare function sampleCurve(curve: Curve3D, tolerance?: number, transform?: CurveTransform): Vec3[];
18
+ /** One control point of a 2D cubic curve; `in`/`out` are handles relative to `position`. */
19
+ export type CurvePoint2D = {
20
+ readonly position: Vec2;
21
+ readonly in?: Vec2;
22
+ readonly out?: Vec2;
23
+ };
24
+ export type Curve2D = {
25
+ readonly points: readonly CurvePoint2D[];
26
+ readonly closed?: boolean;
27
+ };
28
+ export type CurveTransform2D = {
29
+ readonly center?: Vec2;
30
+ /** Anticlockwise rotation in radians. */
31
+ readonly rotation?: number;
32
+ readonly scale?: number;
33
+ };
34
+ /** Applies a curve transform to one point; callers drawing control points use this. */
35
+ export declare function placeCurvePoint2D(point: Vec2, transform?: CurveTransform2D): Vec2;
36
+ /**
37
+ * Samples a 2D cubic curve into a polyline, the 2D twin of `sampleCurve`. `tolerance` is the
38
+ * approximate segment length in `world2d` units: smaller values subdivide each cubic further, so
39
+ * a `lineStrip` can follow the curve as closely as the caller needs.
40
+ */
41
+ export declare function sampleCurve2D(curve: Curve2D, tolerance?: number, transform?: CurveTransform2D): Vec2[];
package/dist/curve.js CHANGED
@@ -44,3 +44,56 @@ export function sampleCurve(curve, tolerance = 0.08, transform = {}) {
44
44
  out.push(place(curve.closed ? points[0].position : points[points.length - 1].position));
45
45
  return out;
46
46
  }
47
+ const add2 = (a, b) => [a[0] + b[0], a[1] + b[1]];
48
+ function cubic2(p0, p1, p2, p3, t) {
49
+ const u = 1 - t;
50
+ const a = u * u * u;
51
+ const b = 3 * u * u * t;
52
+ const c = 3 * u * t * t;
53
+ const d = t * t * t;
54
+ return [
55
+ a * p0[0] + b * p1[0] + c * p2[0] + d * p3[0],
56
+ a * p0[1] + b * p1[1] + c * p2[1] + d * p3[1],
57
+ ];
58
+ }
59
+ /** Applies a curve transform to one point; callers drawing control points use this. */
60
+ export function placeCurvePoint2D(point, transform = {}) {
61
+ const rotation = transform.rotation ?? 0;
62
+ const scale = transform.scale ?? 1;
63
+ const center = transform.center ?? [0, 0];
64
+ const cos = Math.cos(rotation);
65
+ const sin = Math.sin(rotation);
66
+ const x = point[0] * scale;
67
+ const y = point[1] * scale;
68
+ return [center[0] + x * cos - y * sin, center[1] + x * sin + y * cos];
69
+ }
70
+ /**
71
+ * Samples a 2D cubic curve into a polyline, the 2D twin of `sampleCurve`. `tolerance` is the
72
+ * approximate segment length in `world2d` units: smaller values subdivide each cubic further, so
73
+ * a `lineStrip` can follow the curve as closely as the caller needs.
74
+ */
75
+ export function sampleCurve2D(curve, tolerance = 1, transform = {}) {
76
+ const points = curve.points;
77
+ const place = (p) => placeCurvePoint2D(p, transform);
78
+ if (points.length < 2)
79
+ return points.map((point) => place(point.position));
80
+ const out = [];
81
+ const count = curve.closed ? points.length : points.length - 1;
82
+ const step = Math.max(tolerance, 0.1);
83
+ for (let i = 0; i < count; i++) {
84
+ const a = points[i];
85
+ const b = points[(i + 1) % points.length];
86
+ const p0 = a.position;
87
+ const p1 = add2(a.position, a.out ?? [0, 0]);
88
+ const p2 = add2(b.position, b.in ?? [0, 0]);
89
+ const p3 = b.position;
90
+ const hull = Math.hypot(p1[0] - p0[0], p1[1] - p0[1]) +
91
+ Math.hypot(p2[0] - p1[0], p2[1] - p1[1]) +
92
+ Math.hypot(p3[0] - p2[0], p3[1] - p2[1]);
93
+ const steps = Math.max(2, Math.min(64, Math.ceil(hull / step)));
94
+ for (let s = 0; s < steps; s++)
95
+ out.push(place(cubic2(p0, p1, p2, p3, s / steps)));
96
+ }
97
+ out.push(place(curve.closed ? points[0].position : points[points.length - 1].position));
98
+ return out;
99
+ }
@@ -10,6 +10,7 @@
10
10
  * See `camera-2d.ts` for what `world2d` and `screen` mean.
11
11
  */
12
12
  import type { Space2D, Vec2 } from "./camera-2d.js";
13
+ import { type Curve2D, type CurveTransform2D } from "./curve.js";
13
14
  import type { Color, LayerMask, LineJoint, RenderedJoint, ResolvedLineDefaults, ResolvedPointDefaults } from "./frame-draw-list.js";
14
15
  export type Line2DOptions = {
15
16
  color?: Color;
@@ -17,12 +18,33 @@ export type Line2DOptions = {
17
18
  /** Stroke width in canvas pixels (`widthMode: "screen"`) or world2d units. */
18
19
  width?: number;
19
20
  widthMode?: "screen" | "world";
20
- dash?: readonly [number, number, number];
21
21
  joint?: LineJoint;
22
22
  /** Defaults to `world2d`; see `camera-2d.ts`. */
23
23
  space?: Space2D;
24
24
  layer?: LayerMask;
25
25
  };
26
+ /** `arrow` options: the line style plus the head size and half-angle. */
27
+ export type Arrow2DOptions = Line2DOptions & {
28
+ /** Head length in `world2d` units; defaults to a quarter of the shaft, clamped to 6..14. */
29
+ headLength?: number;
30
+ /** Half-angle of the head in radians; defaults to 30 degrees. */
31
+ headAngle?: number;
32
+ };
33
+ /** `curve` options: the line style plus sampling tolerance and placement. */
34
+ export type Curve2DOptions = Line2DOptions & {
35
+ /** Approximate segment length in `world2d` units; smaller values subdivide each cubic further. */
36
+ readonly tolerance?: number;
37
+ readonly transform?: CurveTransform2D;
38
+ };
39
+ /** `grid` options: the 3D grid parameters in the XY plane, plus the line style. */
40
+ export type Grid2DOptions = Line2DOptions & {
41
+ /** Anticlockwise rotation around the grid centre, in radians. */
42
+ rotation?: number;
43
+ /** Skew angles whose tangents shift the opposite family of lines. */
44
+ skew?: readonly [number, number];
45
+ /** Keep the x-axis or y-axis boundary lines (the 2D counterpart of 3D's x/z edges). */
46
+ outer?: "none" | "x" | "y" | "xy";
47
+ };
26
48
  export type Point2DOptions = {
27
49
  color?: Color;
28
50
  size?: number;
@@ -37,9 +59,7 @@ export type Shape2DOptions = {
37
59
  color?: Color;
38
60
  /** Rotation in radians, anticlockwise in `world2d` and screen-clockwise in `screen`. */
39
61
  rotation?: number;
40
- /** Filled by default; `false` strokes the outline with `strokeWidth`. */
41
- fill?: boolean;
42
- /** Outline width in canvas pixels; only read when `fill` is false. */
62
+ /** Outline width in canvas pixels; the `<shape>` and `<shape>_d` variants read it. */
43
63
  strokeWidth?: number;
44
64
  /** Start angle of `arc`/`sector`/`segment` in radians. Defaults to `0`, the +x axis. */
45
65
  startAngle?: number;
@@ -65,6 +85,11 @@ export type Shape2DCommand = {
65
85
  /** Outline width in canvas pixels. */
66
86
  readonly thickness: number;
67
87
  readonly filled: boolean;
88
+ /**
89
+ * Dashed-outline pattern `[visible, gap, phase]` in shape-space units for the `_d` variants;
90
+ * absent for solid shapes and solid outlines.
91
+ */
92
+ readonly dash?: readonly [number, number, number];
68
93
  readonly rotation: number;
69
94
  readonly startAngle: number;
70
95
  readonly sweep: number;
@@ -130,46 +155,130 @@ export declare class FrameDrawList2D {
130
155
  #private;
131
156
  constructor(defaults: FrameDrawList2DStyleDefaults, assertOpen: () => void);
132
157
  point(position: Vec2, options?: Point2DOptions): this;
158
+ /** Straight segment (the 3D `draw_line`). */
133
159
  line(start: Vec2, end: Vec2, options?: Line2DOptions): this;
160
+ /** Straight segment dashed along its length (the 3D `draw_line_d`). */
161
+ line_d(start: Vec2, end: Vec2, dash: readonly [number, number, number], options?: Line2DOptions): this;
162
+ /**
163
+ * Arrow with an open V head, the 2D twin of `FrameDrawList.arrow`: the shaft runs to `origin +
164
+ * direction`, and the head is two lines back from the tip.
165
+ */
166
+ arrow(origin: Vec2, direction: Vec2, options?: Arrow2DOptions): this;
167
+ /** Arrow with a filled triangular head (`arrow` keeps the open line head). */
168
+ arrow_s(origin: Vec2, direction: Vec2, options?: Arrow2DOptions): this;
169
+ /** Arrow whose shaft is dashed; the two head lines stay solid like the filled head. */
170
+ arrow_d(origin: Vec2, direction: Vec2, dash: readonly [number, number, number], options?: Arrow2DOptions): this;
171
+ /** Arrow with a filled head and a dashed shaft. */
172
+ arrow_s_d(origin: Vec2, direction: Vec2, dash: readonly [number, number, number], options?: Arrow2DOptions): this;
134
173
  ray(origin: Vec2, direction: Vec2, options?: Line2DOptions): this;
174
+ /** Ray dashed along its length. */
175
+ ray_d(origin: Vec2, direction: Vec2, dash: readonly [number, number, number], options?: Line2DOptions): this;
135
176
  /**
136
177
  * Path of segments, the 2D twin of `FrameDrawList.lineStrip`. Dash distance accumulates over
137
178
  * the whole path and an open strip joins only its interior vertices, matching the 3D layer.
138
179
  */
139
180
  lineStrip(points: readonly Vec2[], options?: Line2DOptions, closed?: boolean): this;
181
+ /** Open strip dashed along its length. */
182
+ lineStrip_d(points: readonly Vec2[], dash: readonly [number, number, number], options?: Line2DOptions, closed?: boolean): this;
183
+ /** Closed strip: the last point joins the first (the 3D `draw_line_loop`). */
184
+ lineLoop(points: readonly Vec2[], options?: Line2DOptions): this;
185
+ /** Closed strip dashed along its length. */
186
+ lineLoop_d(points: readonly Vec2[], dash: readonly [number, number, number], options?: Line2DOptions): this;
140
187
  polyline(points: readonly Vec2[], options?: Line2DOptions, closed?: boolean): this;
188
+ polyline_d(points: readonly Vec2[], dash: readonly [number, number, number], options?: Line2DOptions, closed?: boolean): this;
189
+ /**
190
+ * Cubic curve sampled into a polyline, the 2D twin of `FrameDrawList.curve`. The curve's own
191
+ * `closed` flag decides whether the last point joins the first.
192
+ */
193
+ curve(curve: Curve2D, options?: Curve2DOptions): this;
194
+ /** Cubic curve sampled into a dashed polyline. */
195
+ curve_d(curve: Curve2D, dash: readonly [number, number, number], options?: Curve2DOptions): this;
141
196
  /**
142
197
  * Axis-aligned grid of lines, the 2D twin of `FrameDrawList.grid` and reference `grid_2d`: `cells`
143
198
  * are the cells per axis, so the drawn line count is one more on each side.
144
199
  */
145
- grid(center: Vec2, cells: readonly [number, number], spacing: Vec2, options?: Line2DOptions): this;
146
- /** Rectangle with the given full width and height (reference `Rectangle::new`). */
200
+ grid(center: Vec2, cells: readonly [number, number], spacing: Vec2, options?: Grid2DOptions): this;
201
+ /** Grid whose lines are dashed along their length. */
202
+ grid_d(center: Vec2, cells: readonly [number, number], spacing: Vec2, dash: readonly [number, number, number], options?: Grid2DOptions): this;
203
+ /**
204
+ * Rectangle with the given full width and height, stroked by default like the 3D `draw_rect`.
205
+ * `rect_s` fills it and `rect_d` dashes the outline.
206
+ */
147
207
  rect(center: Vec2, size: Vec2, options?: Shape2DOptions): this;
148
- /** Rectangle with rounded corners; the shader clamps the radius to half the shorter side. */
149
- roundedRect(center: Vec2, size: Vec2, cornerRadius: number, options?: Shape2DOptions): this;
150
- /** Filled disc with the given radius (reference `Circle::new`). */
208
+ /** Solid rectangle (reference `Rectangle`, the 3D `draw_rect_s`). */
209
+ rect_s(center: Vec2, size: Vec2, options?: Shape2DOptions): this;
210
+ /**
211
+ * Rectangle outline dashed along its perimeter (the 3D `draw_rect_d`). `dash` is
212
+ * `[visible, gap, phase]` in shape-space units, the same triple the line layer takes.
213
+ */
214
+ rect_d(center: Vec2, size: Vec2, dash: readonly [number, number, number], options?: Shape2DOptions): this;
215
+ /** Rounded rectangle outline; the shader clamps the radius to half the shorter side. */
216
+ rect_r(center: Vec2, size: Vec2, cornerRadius: number, options?: Shape2DOptions): this;
217
+ /** Solid rounded rectangle (reference `RoundedRectangle`, the 3D `_s` counterpart). */
218
+ rect_r_s(center: Vec2, size: Vec2, cornerRadius: number, options?: Shape2DOptions): this;
219
+ /** Rounded rectangle outline dashed along its perimeter. */
220
+ rect_r_d(center: Vec2, size: Vec2, cornerRadius: number, dash: readonly [number, number, number], options?: Shape2DOptions): this;
221
+ /** Disc outline with the given radius (reference `Circle`, the 3D `draw_circle`). */
151
222
  circle(center: Vec2, radius: number, options?: Shape2DOptions): this;
152
- /** Ellipse with independent x and y radii (reference `Ellipse::new(x_radius, y_radius)`). */
223
+ /** Solid disc (reference `Circle::new`, the 3D `draw_circle_s`). */
224
+ circle_s(center: Vec2, radius: number, options?: Shape2DOptions): this;
225
+ /** Dashed circle outline. */
226
+ circle_d(center: Vec2, radius: number, dash: readonly [number, number, number], options?: Shape2DOptions): this;
227
+ /** Ellipse outline with independent x and y radii (reference `Ellipse`). */
153
228
  ellipse(center: Vec2, radii: Vec2, options?: Shape2DOptions): this;
229
+ /** Solid ellipse (reference `Ellipse::new`, the 3D `_s` counterpart). */
230
+ ellipse_s(center: Vec2, radii: Vec2, options?: Shape2DOptions): this;
231
+ /** Dashed ellipse outline. */
232
+ ellipse_d(center: Vec2, radii: Vec2, dash: readonly [number, number, number], options?: Shape2DOptions): this;
154
233
  /**
155
- * Circular arc from `startAngle` through `sweep`. It is a curve without an interior, so an
156
- * unfilled arc (the default) strokes it with `strokeWidth` while `fill: true` leaves a hairline.
234
+ * Circular arc from `startAngle` through `sweep`. It is a curve without an interior, so it is
235
+ * only ever stroked; `arc_s` would have nothing to fill.
157
236
  */
158
237
  arc(center: Vec2, radius: number, options?: Shape2DOptions): this;
159
- /** Ring band between two radii (reference `Annulus::new(inner_radius, outer_radius)`). */
238
+ /** Arc outline dashed along its sweep. */
239
+ arc_d(center: Vec2, radius: number, dash: readonly [number, number, number], options?: Shape2DOptions): this;
240
+ /** Ring outline between two radii (reference `Annulus`). */
160
241
  annulus(center: Vec2, innerRadius: number, outerRadius: number, options?: Shape2DOptions): this;
161
- /** Capsule whose straight section is `length` long along y (reference `Capsule2d::new(radius, length)`). */
242
+ /** Filled ring band (reference `Annulus::new`, the 3D `_s` counterpart). */
243
+ annulus_s(center: Vec2, innerRadius: number, outerRadius: number, options?: Shape2DOptions): this;
244
+ /** Dashed annulus outline; both boundaries are stroked. */
245
+ annulus_d(center: Vec2, innerRadius: number, outerRadius: number, dash: readonly [number, number, number], options?: Shape2DOptions): this;
246
+ /** Capsule outline whose straight section is `length` long along y (reference `Capsule2d`). */
162
247
  capsule(center: Vec2, radius: number, length: number, options?: Shape2DOptions): this;
163
- /** Regular polygon with a vertex on the +x axis (reference `RegularPolygon::new(circumradius, sides)`). */
248
+ /** Solid capsule (reference `Capsule2d::new`, the 3D `_s` counterpart). */
249
+ capsule_s(center: Vec2, radius: number, length: number, options?: Shape2DOptions): this;
250
+ /** Dashed capsule outline. */
251
+ capsule_d(center: Vec2, radius: number, length: number, dash: readonly [number, number, number], options?: Shape2DOptions): this;
252
+ /** Regular polygon outline with a vertex on the +x axis (reference `RegularPolygon`). */
164
253
  polygon(center: Vec2, circumradius: number, sides: number, options?: Shape2DOptions): this;
165
- /** Arbitrary triangle (reference `Triangle2d::new(a, b, c)`); `rotation` turns about its centroid. */
254
+ /** Solid regular polygon (reference `RegularPolygon::new`, the 3D `_s` counterpart). */
255
+ polygon_s(center: Vec2, circumradius: number, sides: number, options?: Shape2DOptions): this;
256
+ /** Dashed regular polygon outline. */
257
+ polygon_d(center: Vec2, circumradius: number, sides: number, dash: readonly [number, number, number], options?: Shape2DOptions): this;
258
+ /** Triangle outline (reference `Triangle2d`); `rotation` turns about its centroid. */
166
259
  triangle(a: Vec2, b: Vec2, c: Vec2, options?: Shape2DOptions): this;
167
- /** Diamond with the given full diagonals (reference `Rhombus::new(horizontal, vertical)`). */
260
+ /** Solid triangle (reference `Triangle2d::new`, the 3D `_s` counterpart). */
261
+ triangle_s(a: Vec2, b: Vec2, c: Vec2, options?: Shape2DOptions): this;
262
+ /** Dashed triangle outline. */
263
+ triangle_d(a: Vec2, b: Vec2, c: Vec2, dash: readonly [number, number, number], options?: Shape2DOptions): this;
264
+ /** Diamond outline with the given full diagonals (reference `Rhombus`). */
168
265
  rhombus(center: Vec2, diagonals: Vec2, options?: Shape2DOptions): this;
169
- /** Disc sector from `startAngle` through `sweep` (reference `CircularSector`). */
266
+ /** Solid diamond (reference `Rhombus::new`, the 3D `_s` counterpart). */
267
+ rhombus_s(center: Vec2, diagonals: Vec2, options?: Shape2DOptions): this;
268
+ /** Dashed diamond outline. */
269
+ rhombus_d(center: Vec2, diagonals: Vec2, dash: readonly [number, number, number], options?: Shape2DOptions): this;
270
+ /** Disc sector outline from `startAngle` through `sweep` (reference `CircularSector`). */
170
271
  sector(center: Vec2, radius: number, options?: Shape2DOptions): this;
171
- /** Disc region between a chord and its arc (reference `CircularSegment`). */
272
+ /** Solid disc sector (reference `CircularSector`, the 3D `_s` counterpart). */
273
+ sector_s(center: Vec2, radius: number, options?: Shape2DOptions): this;
274
+ /** Dashed sector outline: the arc plus both radii. */
275
+ sector_d(center: Vec2, radius: number, dash: readonly [number, number, number], options?: Shape2DOptions): this;
276
+ /** Disc segment outline between a chord and its arc (reference `CircularSegment`). */
172
277
  segment(center: Vec2, radius: number, options?: Shape2DOptions): this;
278
+ /** Solid disc segment (reference `CircularSegment`, the 3D `_s` counterpart). */
279
+ segment_s(center: Vec2, radius: number, options?: Shape2DOptions): this;
280
+ /** Dashed segment outline: the arc plus the chord. */
281
+ segment_d(center: Vec2, radius: number, dash: readonly [number, number, number], options?: Shape2DOptions): this;
173
282
  get points(): readonly Point2DCommand[];
174
283
  get lines(): readonly Line2DCommand[];
175
284
  get joints(): readonly Joint2DCommand[];