curve2.extend

A 2D line or arc extended at one end along itself to its first hit on a boundary set.

GeometricSince 0.18.0

Usage

TypeScript
Curve2.extend(curve: IdCurve2, boundary: readonly IdCurve2[], end?: 'start' | 'end', options?: Curve2ExtendOptions): Result<Curve2Edit>

Parameters

  • curveIdCurve2

    A line or an arc; it keeps its id. Required. In model.

  • boundaryreadonly IdCurve2[]

    The curves it may reach. Required. In model.

  • end'start' | 'end'

    The end that moves. Default 'end'.

  • options.to'curve' | 'support'

    What it stops at: the boundary curves, or their supports (a line's infinite line, an arc's or circle's full circle), so a wall's face reaches the line of a face that ends short (since 0.18.0). Default 'curve'.

  • options.dryRunboolean

    Return the outline only. Default false.

  • options.tolerancenumber

    Distance under which curves touch. Default 1e-9 × the curve’s own diagonal. In model.

Returns

Ok with { outline, by, curves: [the extended curve] }: by is the boundary curve reached; the moved end lies on the line’s ray or the arc’s circle.

Errors

Guarantees

  • the end that does not move keeps its bits; an arc keeps its centre and direction
  • without to, or with to: 'curve', the result is D1’s, byte for byte
  • The same result on every machine.

Example

TypeScript
const r = Curve2.extend({ id: 1, minter: 0, kind: 'line', a: Point2.of(0, 0), b: Point2.of(2, 0) }, [{ id: 2, minter: 0, kind: 'line', a: Point2.of(4, -1), b: Point2.of(4, 1) }])
r.ok ? r.value.by : Result.error(r).code // → ok once loadGeometryKernel() has run; CAPABILITY_UNAVAILABLE before

See also