nurbsCurve.arc

An exact circular arc on a plane, counter-clockwise about its normal from an angle measured from its x axis.

GeometricSince 0.4.0

Usage

TypeScript
NurbsCurve.arc(radius: number, startRad: number, sweepRad: number, plane?: Plane): Result<NurbsCurve>

Parameters

  • radiusnumber

    The radius, finite and > 0. Required. In model.

  • startRadnumber

    Start angle from the plane’s x axis towards its y axis; any finite value. Required. In radians.

  • sweepRadnumber

    Angle swept counter-clockwise about the plane’s normal, in (0, 2π]. Required. Range [0, 6.283185307179586] radians.

  • planePlane

    The plane: the arc is centred on its origin. Default Plane.worldXY. In model.

Returns

Ok with a rational degree-2 curve on the knot domain [0, 1], one Bézier segment per quarter turn or part of one.

Errors

Guarantees

  • every point lies at radius from plane.origin and on the plane (Point3.distance, Plane.signedDistance ≈ 0 over sample())
  • length() = radius · sweepRad to about 1e-12 relative
  • pointAt(domain.t0) = Plane.pointAt(plane, r cos startRad, r sin startRad)
  • The same result on every machine.

Example

TypeScript
const r = NurbsCurve.arc(2, 0, Math.PI / 2) // → from (2, 0, 0) to (0, 2, 0), length π, once loadGeometryKernel() has run

See also