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), where f is between 0 and 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.
- If "start < end" the angle proceeds CCW around the unit circle.
- If "end < start" the angle proceeds CW around the unit circle.
- Angles beyond 360 are fine as endpoints.
- (350,370) covers the same unit angles as (-10,10).
- (370,350) covers the same unit angles as (10,-10).
- math details related fraction API 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: number0.0): number | Return the fractionalized position of the given angle (as Angle), computed with consideration of 2PI period. | |
angleToSignedFraction(theta: Angle, toNegativeFraction: booleanfalse, zeroSweepDefault: number0.0): number | Return the fractionalized position of the given angle with respect to this sweep. | |
angleToSignedPeriodicFraction(theta: Angle, zeroSweepDefault: number0.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 into the range (-90,+90) in degrees | |
clone(): AngleSweep | Return a clone of this sweep. | |
cloneComplement(reverseDirection: booleanfalse, result?: AngleSweep): AngleSweep | Return a sweep for the "other" part of the circle. | |
cloneMinusRadians(radians: number): AngleSweep | Return the angle obtained by subtracting radians from this angle. | |
fractionPeriod(): number | Return 2PI divided by the sweep radians (i.e. | |
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: numberGeometry.smallAngleRadians): boolean | Test if two angle sweeps match within the given tolerance. | |
isAlmostEqualNoPeriodShift(other: AngleSweep, radianTol: numberGeometry.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: booleantrue): 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: number0.0): number | Return the fractionalized position of the given angle (as radians), computed with consideration of 2PI period. | |
radiansToSignedFraction(radians: number, toNegativeFraction: booleanfalse, zeroSweepDefault: number0.0): number | Return the fractionalized position of the given radian angle with respect to this sweep. | |
radiansToSignedPeriodicFraction(radians: number, zeroSweepDefault: number0.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: number0, endDegrees: number360.0): void | Directly set the start and end angles in degrees | |
setStartEndRadians(startRadians: number0, 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): 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: number0, endDegrees: number360, result?: AngleSweep): AngleSweep Static | Create an AngleSweep from start and end angles given in degrees. | |
createStartEndRadians(startRadians: number0, 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: number0, sweepDegrees: number360, result?: AngleSweep): AngleSweep Static | Create an AngleSweep from start and sweep given in degrees. | |
createStartSweepRadians(startRadians: number0, sweepRadians: numberMath.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: booleantrue): boolean Static | Test if the given angle (as radians) is within sweep (between radians0 and radians1) | |
radiansToPositivePeriodicFractionStartEnd(radians: number, radians0: number, radians1: number, zeroSweepDefault: number0.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: booleanfalse, zeroSweepDefault: number0.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: number0.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 29
Last Updated: 21 November, 2024
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.