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
SweepAngle(GeoPoint2D, GeoPoint2D)
Constructs the sweep angle as the angle of the vector from Center to Target
public SweepAngle(GeoPoint2D Target, GeoPoint2D Center)
Parameters
TargetGeoPoint2DEndpoint of the vector
CenterGeoPoint2DStartpoint 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
SweepAngle(GeoVector2D, GeoVector2D)
Constructs a sweep angle from the vector From to the vector To.
public SweepAngle(GeoVector2D From, GeoVector2D To)
Parameters
FromGeoVector2DToGeoVector2D
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
ddouble
SweepAngle(double, double)
Constructs the sweep angle with tan(sweep angle)==dy/dx
public SweepAngle(double dx, double dy)
Parameters
Fields
Full
The sweep angle that turns 360° counterclockwise
public static SweepAngle Full
Field Value
FullReverse
The sweep angle that turns 360° clockwise
public static SweepAngle FullReverse
Field Value
Opposite
The sweep angle that turns to the opposite directio
public static SweepAngle Opposite
Field Value
ToLeft
The sweep angle that turns 90° to the left
public static SweepAngle ToLeft
Field Value
ToRight
The sweep angle that turns 90° to the right
public static SweepAngle ToRight
Field Value
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
ddoubleamount 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
infoSerializationInforeceives the data
contextStreamingContextthe 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
angSweepAngle
Returns
ToString()
Returns a string representation of this sweep angle in degrees
public override string ToString()
Returns
Operators
implicit operator SweepAngle(Angle)
Casts an angle to a sweep angle with the same value
public static implicit operator SweepAngle(Angle a)
Parameters
aAngle
Returns
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
angSweepAnglethe 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
vdoublethe 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
ddoublefactor
sSweepAngle
Returns
operator -(SweepAngle)
Returns the reverse of the provided sweep angle
public static SweepAngle operator -(SweepAngle s)