AngleSweep Class
An AngleSweep is a pair of angles at start and end of an interval.
- For stroking purposes, the "included interval" is all angles numerically reached
by
theta = start + f * (end - start), where0 <= f <= 1. - This stroking formula is simple numbers -- 2PI shifts are not involved.
- 2PI shifts do become important in the reverse mapping of an angle to a fraction.
- Angles greater than 360 and less than 0 are fine as endpoints.
- An AngleSweep determines orientation only in concert with a reference vector, e.g., a plane normal like (0,0,1).
- Be careful reading orientation from an AngleSweep without a reference vector!
- If "start < end" the angles in the sweep proceed counterclockwise around the reference vector.
- If "start > end" the angles in the sweep proceed clockwise around the reference vector.
- (350,370) covers the same angles as (-10,10), and both sweeps are counterclockwise around the reference vector.
- (370,350) covers the same angles as (10,-10), and both sweeps are clockwise around the reference vector.
- (370,350) covers the same angles as (-10,10), but the sweeps have opposite orientation.
- Math details can be found at docs/learning/geometry/Angle.md .
- Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/AngleSweep .
Implements
Methods
| Name | Description | |
|---|---|---|
| angleToPositivePeriodicFraction(theta: Angle, zeroSweepDefault: number = 0.0): number | Return the fractionalized position of the given angle (as Angle), computed with consideration of 2PI period. | |
| angleToSignedFraction(theta: Angle, toNegativeFraction: boolean = false, zeroSweepDefault: number = 0.0): number | Return the fractionalized position of the given angle with respect to this sweep. | |
| angleToSignedPeriodicFraction(theta: Angle, zeroSweepDefault: number = 0.0): number | Return the fractionalized position of the given angle (as Angle) computed with consideration of | |
| angleToUnboundedFraction(theta: Angle): number | Return the fractionalized position of the given angle (as Angle) computed without consideration of | |
| capLatitudeInPlace(): void | Restrict start and end angles to the degree range [-90,+90]. | |
| clampToFullCircle(result?: AngleSweep): AngleSweep | Restrict sweepDegrees to the range [-360, 360]. | |
| clone(): AngleSweep | Return a clone of this sweep. | |
| cloneComplement(reverseDirection: boolean = false, result?: AngleSweep): AngleSweep | Return a sweep for the "other" part of the circle. | |
| cloneMinusRadians(radians: number): AngleSweep | Return the AngleSweep obtained by subtracting radians from the start and end angles of this sweep. | |
| fractionPeriod(): number | Return 2PI divided by the sweep radians. | |
| fractionToAngle(fraction: number): Angle | Convert fractional position in the sweep to strongly typed Angle object. | |
| fractionToRadians(fraction: number): number | Convert fractional position in the sweep to radians. | |
| fractionToSignedPeriodicFraction(fraction: number, toNegativeFraction?: boolean): number | Convert a sweep fraction to the equivalent period-shifted fraction inside this sweep, or within one period of | |
| interpolate(fraction: number, other: AngleSweep): AngleSweep | Return a sweep with limits interpolated between this and other. | |
| isAlmostEqual(other: AngleSweep): boolean | Test if start and end angles match with radians tolerance. | |
| isAlmostEqualAllowPeriodShift(other: AngleSweep, radianTol: number = Geometry.smallAngleRadians): boolean | Test if two angle sweeps match within the given tolerance. | |
| isAlmostEqualNoPeriodShift(other: AngleSweep, radianTol: number = Geometry.smallAngleRadians): boolean | Test if two angle sweeps match within the given tolerance. | |
| isAngleInSweep(angle: Angle): boolean | Test if the given angle (as Angle) is within the sweep | |
| isRadiansInSweep(radians: number, allowPeriodShift: boolean = true): boolean | Test if the given angle (as radians) is within sweep | |
| radiansArrayToPositivePeriodicFractions(data: GrowableFloat64Array): void | Return the fractionalized position of the given array of angles (as radian), computed with consideration of 2PI period. | |
| radiansToPositivePeriodicFraction(radians: number, zeroSweepDefault: number = 0.0): number | Return the fractionalized position of the given angle (as radians), computed with consideration of 2PI period. | |
| radiansToSignedFraction(radians: number, toNegativeFraction: boolean = false, zeroSweepDefault: number = 0.0): number | Return the fractionalized position of the given radian angle with respect to this sweep. | |
| radiansToSignedPeriodicFraction(radians: number, zeroSweepDefault: number = 0.0): number | Return the fractionalized position of the given angle (as radians) computed with consideration of | |
| reverseInPlace(): void | Reverse the start and end angle in place. | |
| setFrom(other: AngleSweep): void | Copy from other AngleSweep. | |
| setFromJSON(json?: any): void | Set this AngleSweep from various sources: | |
| setStartEndDegrees(startDegrees: number = 0, endDegrees: number = 360.0): void | Directly set the start and end angles in degrees | |
| setStartEndRadians(startRadians: number = 0, endRadians: number = ...): void | Directly set the start and end angles in radians | |
| toJSON(): any | Convert an AngleSweep to a JSON object. | |
| create(data?: Angle | AngleSweep): AngleSweep Static | Create a sweep as one of | |
| create360(startRadians?: number, result?: AngleSweep): AngleSweep Static | Create a full circle sweep (CCW). | |
| createFullLatitude(): AngleSweep Static | Create a sweep from the south pole to the north pole (-90 to +90). | |
| createStartEnd(startAngle: Angle, endAngle: Angle, result?: AngleSweep): AngleSweep Static | Create an angle sweep from strongly typed start and end angles | |
| createStartEndDegrees(startDegrees: number = 0, endDegrees: number = 360, result?: AngleSweep): AngleSweep Static | Create an AngleSweep from start and end angles given in degrees. | |
| createStartEndRadians(startRadians: number = 0, endRadians: number = ..., result?: AngleSweep): AngleSweep Static | Create an AngleSweep from start and end angles given in radians. | |
| createStartSweep(startAngle: Angle, sweepAngle: Angle, result?: AngleSweep): AngleSweep Static | Create an angle sweep with limits given as (strongly typed) angles for start and sweep | |
| createStartSweepDegrees(startDegrees: number = 0, sweepDegrees: number = 360, result?: AngleSweep): AngleSweep Static | Create an AngleSweep from start and sweep given in degrees. | |
| createStartSweepRadians(startRadians: number = 0, sweepRadians: number = Math.PI, result?: AngleSweep): AngleSweep Static | Create an AngleSweep from start and end angles given in radians. | |
| fractionToSignedPeriodicFractionStartEnd(fraction: number, radians0: number, radians1: number, toNegativeFraction?: boolean): number Static | Convert a sweep fraction to the equivalent period-shifted fraction inside the sweep, or within one period of zero | |
| fromJSON(json?: AngleSweepProps): AngleSweep Static | Create an AngleSweep from a json object. | |
| isRadiansInStartEnd(radians: number, radians0: number, radians1: number, allowPeriodShift: boolean = true): boolean Static | Test if the given angle (as radians) is within sweep (between radians0 and radians1) | |
| radiansToPositivePeriodicFractionStartEnd(radians: number, radians0: number, radians1: number, zeroSweepDefault: number = 0.0): number Static | Return the fractionalized position of the given angle (as radians), computed with consideration of 2PI period. | |
| radiansToSignedFractionStartEnd(radians: number, radians0: number, radians1: number, toNegativeFraction: boolean = false, zeroSweepDefault: number = 0.0): number Static | Return the fractionalized position of the given radian angle with respect to the sweep. | |
| radiansToSignedPeriodicFractionStartEnd(radians: number, radians0: number, radians1: number, zeroSweepDefault: number = 0.0): number Static | Return the fractionalized position of the given angle (as radians) computed with consideration of |
Properties
| Name | Type | Description | |
|---|---|---|---|
| endAngle Accessor ReadOnly | Angle | Return the (strongly typed) end angle | |
| endDegrees Accessor ReadOnly | number | Read-property for degrees at the end of this AngleSweep. | |
| endRadians Accessor ReadOnly | number | Read-property for degrees at the end of this AngleSweep. | |
| isCCW Accessor ReadOnly | boolean | Ask if the sweep is counterclockwise, i.e. | |
| isEmpty Accessor ReadOnly | boolean | Whether the sweep angles are within smallAngle tolerance, without period shift. | |
| isFullCircle Accessor ReadOnly | boolean | Ask if the sweep is a full circle. | |
| isFullLatitudeSweep Accessor ReadOnly | boolean | Ask if the sweep is a full sweep from south pole to north pole. | |
| startAngle Accessor ReadOnly | Angle | Return the (strongly typed) start angle | |
| startDegrees Accessor ReadOnly | number | Read-property for degrees at the start of this AngleSweep. | |
| startRadians Accessor ReadOnly | number | Read-property for degrees at the start of this AngleSweep. | |
| sweepDegrees Accessor ReadOnly | number | Read-property for signed start-to-end sweep in degrees. | |
| sweepRadians Accessor ReadOnly | number | Read-property for signed start-to-end sweep in radians. |
Defined in
- geometry3d/AngleSweep.ts Line 32
Last Updated: 28 October, 2025
Found something wrong, missing, or unclear on this page? Raise an issue in our repo.