Table of Contents

Struct SweepAngle

Namespace
CADability
Assembly
CADability.dll

A sweep angle. Typically the value of this object is between -2pi and +2pi. Used for rotation operations etc.

public struct SweepAngle : ISerializable
Implements
Inherited Members

Constructors

SweepAngle(Angle, Angle, bool)

Constructs the sweep angle you need to go from From to To in the direction defined by CounterClockwise

public SweepAngle(Angle From, Angle To, bool CounterClockwise)

Parameters

From Angle

starting angle

To Angle

ending angle

CounterClockwise bool

direction

SweepAngle(GeoPoint2D, GeoPoint2D)

Constructs the sweep angle as the angle of the vector from Center to Target

public SweepAngle(GeoPoint2D Target, GeoPoint2D Center)

Parameters

Target GeoPoint2D

Endpoint of the vector

Center GeoPoint2D

Startpoint of the vector

SweepAngle(GeoVector, GeoVector)

Constructs the sweep angle you need to go from From to To.

public SweepAngle(GeoVector From, GeoVector To)

Parameters

From GeoVector

starting vector

To GeoVector

target vector

SweepAngle(GeoVector2D, GeoVector2D)

Constructs a sweep angle from the vector From to the vector To.

public SweepAngle(GeoVector2D From, GeoVector2D To)

Parameters

From GeoVector2D
To GeoVector2D

SweepAngle(double)

Constructs the sweep angle with the provided radian (which must be between -2pi and +2pi, which is not checked)

public SweepAngle(double d)

Parameters

d double

SweepAngle(double, double)

Constructs the sweep angle with tan(sweep angle)==dy/dx

public SweepAngle(double dx, double dy)

Parameters

dx double
dy double

Fields

Full

The sweep angle that turns 360° counterclockwise

public static SweepAngle Full

Field Value

SweepAngle

FullReverse

The sweep angle that turns 360° clockwise

public static SweepAngle FullReverse

Field Value

SweepAngle

Opposite

The sweep angle that turns to the opposite directio

public static SweepAngle Opposite

Field Value

SweepAngle

ToLeft

The sweep angle that turns 90° to the left

public static SweepAngle ToLeft

Field Value

SweepAngle

ToRight

The sweep angle that turns 90° to the right

public static SweepAngle ToRight

Field Value

SweepAngle

Properties

Degree

The value of this sweep angle in degrees, positive for a counterclockwise and negative for a clockwise sweep. A value that is set is converted to radians and reduced to the range -360° to 360°.

public double Degree { get; set; }

Property Value

double

The sweep angle in degrees.

Radian

The value of this sweep angle in radians, positive for a counterclockwise and negative for a clockwise sweep. A value that is set is reduced to the range -2pi to 2pi.

public double Radian { get; set; }

Property Value

double

The sweep angle in radians.

Methods

Deg(double)

Returns a SweepAngle that rotates by the given degrees

public static SweepAngle Deg(double d)

Parameters

d double

amount to rotate in degrees (-360<=d<=360)

Returns

SweepAngle

A new SweepAngle

GetObjectData(SerializationInfo, StreamingContext)

Writes the data of this object for the legacy binary serialization (ISerializable). Files are written in the JSON format (IJsonSerialize) now; the binary format is still read.

public void GetObjectData(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

receives the data

context StreamingContext

the destination of the serialization

IsCloseTo(SweepAngle)

Returns true, if the sweep angles differ by less than 1e-12 (in radian)

public bool IsCloseTo(SweepAngle ang)

Parameters

ang SweepAngle

Returns

bool

ToString()

Returns a string representation of this sweep angle in degrees

public override string ToString()

Returns

string

Operators

implicit operator SweepAngle(Angle)

Casts an angle to a sweep angle with the same value

public static implicit operator SweepAngle(Angle a)

Parameters

a Angle

Returns

SweepAngle

implicit operator double(SweepAngle)

Casts a sweep angle to a double. The result is the sweep angle in radians as it is, without any conversion.

public static implicit operator double(SweepAngle ang)

Parameters

ang SweepAngle

the sweep angle

Returns

double

the sweep angle in radians

implicit operator SweepAngle(double)

Casts a double (in radians) to a sweep angle. The value is reduced to the range -2pi to 2pi, so a full turn in either direction is preserved.

public static implicit operator SweepAngle(double v)

Parameters

v double

the sweep angle in radians

Returns

SweepAngle

the sweep angle

operator *(double, SweepAngle)

Returns the multiple of the sweep angle

public static SweepAngle operator *(double d, SweepAngle s)

Parameters

d double

factor

s SweepAngle

Returns

SweepAngle

operator -(SweepAngle)

Returns the reverse of the provided sweep angle

public static SweepAngle operator -(SweepAngle s)

Parameters

s SweepAngle

Returns

SweepAngle