Struct Angle
An angle defined in radians. The value of the angle is a double which is greater or equal to 0 and less than (and not equal) 2*pi. Via cast operators the angle seamlessly operates as a double.
Implements
Inherited Members
Namespace: CADability
Assembly: CADability.dll
Syntax
[Serializable]
public struct Angle : ISerializable
Constructors
| Improve this Doc View SourceAngle(GeoPoint2D, GeoPoint2D)
Constructs the angle
Declaration
public Angle(GeoPoint2D Target, GeoPoint2D Center)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint2D | Target | |
| GeoPoint2D | Center |
Angle(GeoVector, GeoVector)
Constructs the angle that is enclosed by the two vectors (between 0 and Math.PI)
Declaration
public Angle(GeoVector v1, GeoVector v2)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector | v1 | First vector |
| GeoVector | v2 | Second vector |
Angle(GeoVector2D)
Constructs the angle of the given vector. X-axis is 0, counterclockwise.
Declaration
public Angle(GeoVector2D v)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector2D | v | vector to define the angle |
Angle(GeoVector2D, GeoVector2D)
Constructs the angle that is needed to rotate the first vector counterclockwise to reach the second vector (between 0 and 2.0*Math.PI)
Declaration
public Angle(GeoVector2D v1, GeoVector2D v2)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector2D | v1 | First vector |
| GeoVector2D | v2 | Second vector |
Angle(Double)
Constructs an angle from the provided parameter
Declaration
public Angle(double d)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | d | Angle in radians |
Angle(Double, Double)
Constructs an angle of a 2d vector (dx,dy)
Declaration
public Angle(double dx, double dy)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | dx | x-axis difference |
| System.Double | dy | y-axis difference |
Properties
| Improve this Doc View SourceA0
Angle for 0°
Declaration
public static Angle A0 { get; }
Property Value
| Type | Description |
|---|---|
| Angle |
A180
Angle for 180°
Declaration
public static Angle A180 { get; }
Property Value
| Type | Description |
|---|---|
| Angle |
A270
Angle for 270°
Declaration
public static Angle A270 { get; }
Property Value
| Type | Description |
|---|---|
| Angle |
A30
Angle for 30°
Declaration
public static Angle A30 { get; }
Property Value
| Type | Description |
|---|---|
| Angle |
A45
Angle for 45°
Declaration
public static Angle A45 { get; }
Property Value
| Type | Description |
|---|---|
| Angle |
A60
Angle for 60°
Declaration
public static Angle A60 { get; }
Property Value
| Type | Description |
|---|---|
| Angle |
A90
Angle for 90°
Declaration
public static Angle A90 { get; }
Property Value
| Type | Description |
|---|---|
| Angle |
Degree
Declaration
public double Degree { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | Zugriff auf das Gradmaß |
Direction
Sets the angle to the angle of the given vector. Gets a unit vector with the angle.
Declaration
public GeoVector2D Direction { get; set; }
Property Value
| Type | Description |
|---|---|
| GeoVector2D |
Quadrant
Quadrant of the angle. Yields 0 to 3. 0: right top, 1: left top, 2: left bottom, 3: right bottom
Declaration
public int Quadrant { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Radian
Declaration
public double Radian { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | Zugriff auf das Bogenmaß |
Methods
| Improve this Doc View SourceDeg(Double)
Creates an angle from the provided parameter (in degrees)
Declaration
public static Angle Deg(double deg)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | deg | Degrees of the angle |
Returns
| Type | Description |
|---|---|
| Angle | The resulting angle |
FromDegree(Double)
Returns an angle from the parameter interpreted as degrees
Declaration
public static Angle FromDegree(double d)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | d | Degrees of the angle |
Returns
| Type | Description |
|---|---|
| Angle | The angle |
GetObjectData(SerializationInfo, StreamingContext)
Implements System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)
Declaration
public void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Runtime.Serialization.SerializationInfo | info | The System.Runtime.Serialization.SerializationInfo to populate with data. |
| System.Runtime.Serialization.StreamingContext | context | The destination (System.Runtime.Serialization.StreamingContext) for this serialization. |
IsCloseTo(Angle)
Returns true if the radians differ less than 1e-12
Declaration
public bool IsCloseTo(Angle ang)
Parameters
| Type | Name | Description |
|---|---|---|
| Angle | ang |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Sweeps(SweepAngle, Angle)
Liefert true, wenn der im Parameter gegebene TestWinkel von diesem Winkel ausgehend mit dem SweepAngle überstrichen wird.
Declaration
public bool Sweeps(SweepAngle sa, Angle test)
Parameters
| Type | Name | Description |
|---|---|---|
| SweepAngle | sa | Überstreichnung |
| Angle | test | zu Testende Winkelposition |
Returns
| Type | Description |
|---|---|
| System.Boolean |
ToString()
Representation of this angle as a string in degrees
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String |
Overrides
Operators
| Improve this Doc View SourceAddition(Angle, SweepAngle)
Adds the sweep angle to the angle
Declaration
public static Angle operator +(Angle angA, SweepAngle angB)
Parameters
| Type | Name | Description |
|---|---|---|
| Angle | angA | First operand |
| SweepAngle | angB | Sweep angle to add |
Returns
| Type | Description |
|---|---|
| Angle | The sum |
Implicit(Angle to Double)
Casts an angle to a double. The radian of the angle is returned.
the angleDeclaration
public static implicit operator double (Angle ang)
Parameters
| Type | Name | Description |
|---|---|---|
| Angle | ang |
Returns
| Type | Description |
|---|---|
| System.Double |
Implicit(SweepAngle to Angle)
Casts the sweep angle to an angle with the same value
Declaration
public static implicit operator Angle(SweepAngle sw)
Parameters
| Type | Name | Description |
|---|---|---|
| SweepAngle | sw |
Returns
| Type | Description |
|---|---|
| Angle |
Implicit(Double to Angle)
Casts a double to an angle. The result will be between 0 and 2*pi
double valueDeclaration
public static implicit operator Angle(double v)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | v |
Returns
| Type | Description |
|---|---|
| Angle |
Subtraction(Angle, Angle)
Returns the sweep angle that leads from angB to angA
Declaration
public static SweepAngle operator -(Angle angA, Angle angB)
Parameters
| Type | Name | Description |
|---|---|---|
| Angle | angA | Target of the rotation |
| Angle | angB | Source of the rotation |
Returns
| Type | Description |
|---|---|
| SweepAngle | The difference |
Subtraction(Angle, SweepAngle)
Returns the angle minus the provided sweep angle
Declaration
public static Angle operator -(Angle angA, SweepAngle angB)
Parameters
| Type | Name | Description |
|---|---|---|
| Angle | angA | first argument |
| SweepAngle | angB | subtract this |
Returns
| Type | Description |
|---|---|
| Angle | the difference |