Table of Contents

Struct Angle

Namespace
CADability
Assembly
CADability.dll

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.

public struct Angle : ISerializable
Implements
Inherited Members

Constructors

Angle(GeoPoint2D, GeoPoint2D)

Constructs the angle

public Angle(GeoPoint2D Target, GeoPoint2D Center)

Parameters

Target GeoPoint2D
Center GeoPoint2D

Angle(GeoVector, GeoVector)

Constructs the angle that is enclosed by the two vectors (between 0 and Math.PI)

public Angle(GeoVector v1, GeoVector v2)

Parameters

v1 GeoVector

First vector

v2 GeoVector

Second vector

Angle(GeoVector2D)

Constructs the angle of the given vector. X-axis is 0, counterclockwise.

public Angle(GeoVector2D v)

Parameters

v GeoVector2D

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)

public Angle(GeoVector2D v1, GeoVector2D v2)

Parameters

v1 GeoVector2D

First vector

v2 GeoVector2D

Second vector

Angle(double)

Constructs an angle from the provided parameter

public Angle(double d)

Parameters

d double

Angle in radians

Angle(double, double)

Constructs an angle of a 2d vector (dx,dy)

public Angle(double dx, double dy)

Parameters

dx double

x-axis difference

dy double

y-axis difference

Properties

A0

Angle for 0°

public static Angle A0 { get; }

Property Value

Angle

A180

Angle for 180°

public static Angle A180 { get; }

Property Value

Angle

A270

Angle for 270°

public static Angle A270 { get; }

Property Value

Angle

A30

Angle for 30°

public static Angle A30 { get; }

Property Value

Angle

A45

Angle for 45°

public static Angle A45 { get; }

Property Value

Angle

A60

Angle for 60°

public static Angle A60 { get; }

Property Value

Angle

A90

Angle for 90°

public static Angle A90 { get; }

Property Value

Angle

Degree

The value of this angle in degrees. A value that is set is converted to radians and reduced modulo 360°.

public double Degree { get; set; }

Property Value

double

The angle in degrees.

Direction

Sets the angle to the angle of the given vector. Gets a unit vector with the angle.

public GeoVector2D Direction { get; set; }

Property Value

GeoVector2D

Quadrant

Quadrant of the angle. Yields 0 to 3. 0: right top, 1: left top, 2: left bottom, 3: right bottom

public int Quadrant { get; }

Property Value

int

Radian

The value of this angle in radians. A value that is set is reduced modulo 2*pi.

public double Radian { get; set; }

Property Value

double

The angle in radians.

Methods

Deg(double)

Creates an angle from the provided parameter (in degrees)

public static Angle Deg(double deg)

Parameters

deg double

Degrees of the angle

Returns

Angle

The resulting angle

FromDegree(double)

Returns an angle from the parameter interpreted as degrees

public static Angle FromDegree(double d)

Parameters

d double

Degrees of the angle

Returns

Angle

The angle

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(Angle, double)

Returns true if the radians differ less than 1e-6 or provided tolerance

public bool IsCloseTo(Angle ang, double tolerance = 1E-06)

Parameters

ang Angle
tolerance double

Returns

bool

Sweeps(SweepAngle, Angle)

Determines whether the angle test lies within the range that is swept when starting at this angle and turning by the sweep angle sa (counterclockwise for a positive, clockwise for a negative sweep angle). The limits of the range count as inside.

public bool Sweeps(SweepAngle sa, Angle test)

Parameters

sa SweepAngle

the sweep, starting at this angle

test Angle

the angle to test

Returns

bool

true if test is within the swept range

ToString()

Representation of this angle as a string in degrees

public override string ToString()

Returns

string

Operators

operator +(Angle, SweepAngle)

Adds the sweep angle to the angle

public static Angle operator +(Angle angA, SweepAngle angB)

Parameters

angA Angle

First operand

angB SweepAngle

Sweep angle to add

Returns

Angle

The sum

implicit operator double(Angle)

Casts an angle to a double. The radian of the angle is returned.

the angle the radian
public static implicit operator double(Angle ang)

Parameters

ang Angle

Returns

double

implicit operator Angle(SweepAngle)

Casts the sweep angle to an angle with the same value

public static implicit operator Angle(SweepAngle sw)

Parameters

sw SweepAngle

Returns

Angle

implicit operator Angle(double)

Casts a double to an angle. The result will be between 0 and 2*pi

double value Angle
public static implicit operator Angle(double v)

Parameters

v double

Returns

Angle

operator -(Angle, Angle)

Returns the sweep angle that leads from angB to angA

public static SweepAngle operator -(Angle angA, Angle angB)

Parameters

angA Angle

Target of the rotation

angB Angle

Source of the rotation

Returns

SweepAngle

The difference

operator -(Angle, SweepAngle)

Returns the angle minus the provided sweep angle

public static Angle operator -(Angle angA, SweepAngle angB)

Parameters

angA Angle

first argument

angB SweepAngle

subtract this

Returns

Angle

the difference