Struct Direction2D
Represents a geometric 2D direction.
Inherited Members
Namespace: TopSolid.Kernel.Automating
Assembly: cs.temp.dll.dll
Syntax
[AvailableSinceVersion(7, 6, 0, 0)]
public struct Direction2D
Remarks
The direction is defined by a unit vector, so (X * X + Y * Y) = 1.
This structure is available since v7.6.
Constructors
Direction2D(Double, Double)
Initializes a new instance of the Direction2D structure with its coordinates.
Declaration
public Direction2D(double inX, double inY)
Parameters
Type | Name | Description |
---|---|---|
System.Double | inX | X component. |
System.Double | inY | Y component. |
Fields
DX
Positive X direction, i.e. (1,0).
Declaration
public static readonly Direction2D DX
Field Value
Type | Description |
---|---|
Direction2D |
DY
Positive Y direction, i.e. (0,1).
Declaration
public static readonly Direction2D DY
Field Value
Type | Description |
---|---|
Direction2D |
X
X component.
Declaration
public double X
Field Value
Type | Description |
---|---|
System.Double |
Y
Y component.
Declaration
public double Y
Field Value
Type | Description |
---|---|
System.Double |
Methods
IsParallelTo(Direction2D, Boolean)
Tells whether this direction is parallel to another direction.
Declaration
public bool IsParallelTo(Direction2D inDirection, bool inSense)
Parameters
Type | Name | Description |
---|---|---|
Direction2D | inDirection | Direction to compare with. |
System.Boolean | inSense | Sense is meaningful. |
Returns
Type | Description |
---|---|
System.Boolean | This direction is parallel to the specified direction. |
Remarks
Two directions are considered parallel if they make an angle of less than AngularPrecision.
Operators
Division(Direction2D, Double)
Divides a direction by a double value.
Declaration
public static Vector2D operator /(Direction2D inDirection, double inD)
Parameters
Type | Name | Description |
---|---|---|
Direction2D | inDirection | Left hand side direction. |
System.Double | inD | Right hand side double. |
Returns
Type | Description |
---|---|
Vector2D | Scaled vector. |
ExclusiveOr(Direction2D, Direction2D)
Computes the cross product of two directions.
Declaration
public static double operator ^(Direction2D inDirection1, Direction2D inDirection2)
Parameters
Type | Name | Description |
---|---|---|
Direction2D | inDirection1 | Left hand side direction. |
Direction2D | inDirection2 | Right hand side direction. |
Returns
Type | Description |
---|---|
System.Double | Directions' cross product "Z" component. |
Implicit(Direction2D to Vector2D)
Casts a direction into a vector.
Declaration
public static implicit operator Vector2D(Direction2D inDirection)
Parameters
Type | Name | Description |
---|---|---|
Direction2D | inDirection | Direction to cast. |
Returns
Type | Description |
---|---|
Vector2D |
Multiply(Double, Direction2D)
Multiplies a double value with a direction.
Declaration
public static Vector2D operator *(double inD, Direction2D inDirection)
Parameters
Type | Name | Description |
---|---|---|
System.Double | inD | Left hand side double. |
Direction2D | inDirection | Right hand side direction. |
Returns
Type | Description |
---|---|
Vector2D | Scaled vector. |
Multiply(Direction2D, Double)
Multiplies a direction with a double value.
Declaration
public static Vector2D operator *(Direction2D inDirection, double inD)
Parameters
Type | Name | Description |
---|---|---|
Direction2D | inDirection | Left hand side direction. |
System.Double | inD | Right hand side double. |
Returns
Type | Description |
---|---|
Vector2D | Scaled vector. |
Multiply(Direction2D, Direction2D)
Computes the dot product of two directions.
Declaration
public static double operator *(Direction2D inDirection1, Direction2D inDirection2)
Parameters
Type | Name | Description |
---|---|---|
Direction2D | inDirection1 | Left hand side direction. |
Direction2D | inDirection2 | Right hand side direction. |
Returns
Type | Description |
---|---|
System.Double | Vectors' dot product. |
UnaryNegation(Direction2D)
Negates a direction.
Declaration
public static Direction2D operator -(Direction2D inDirection)
Parameters
Type | Name | Description |
---|---|---|
Direction2D | inDirection | Direction to negate. |
Returns
Type | Description |
---|---|
Direction2D | Negated direction. |