Struct GeoVector2D
A two dimensional vector with double x and y components.
Keep in mind that this is a value type. Passing a value type as a (non ref) parameter and changing it's value
inside the invoked method leaves the original unchanged.
Implements
System.Runtime.Serialization.ISerializable
Inherited Members
System.ValueType.Equals(System.Object)
System.ValueType.GetHashCode()
System.ValueType.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: CADability.dll
Syntax
[Serializable]
[JsonVersion(serializeAsStruct = true, version = 1)]
public struct GeoVector2D : ISerializable, IJsonSerialize
Constructors
|
Improve this Doc
View Source
GeoVector2D(Angle)
Declaration
public GeoVector2D(Angle dir)
Parameters
| Type |
Name |
Description |
| Angle |
dir |
|
|
Improve this Doc
View Source
GeoVector2D(GeoVector)
Declaration
public GeoVector2D(GeoVector v3)
Parameters
|
Improve this Doc
View Source
GeoVector2D(IJsonReadStruct)
Declaration
public GeoVector2D(IJsonReadStruct data)
Parameters
|
Improve this Doc
View Source
GeoVector2D(Double, Double)
Declaration
public GeoVector2D(double x, double y)
Parameters
| Type |
Name |
Description |
| System.Double |
x |
|
| System.Double |
y |
|
Fields
|
Improve this Doc
View Source
x
Declaration
Field Value
| Type |
Description |
| System.Double |
|
|
Improve this Doc
View Source
y
Declaration
Field Value
| Type |
Description |
| System.Double |
|
Properties
|
Improve this Doc
View Source
Angle
Declaration
public Angle Angle { get; set; }
Property Value
|
Improve this Doc
View Source
IsMoreHorizontal
Simple test, whether the vector is more horizontal than vertical
Declaration
public bool IsMoreHorizontal { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
|
Improve this Doc
View Source
Length
Declaration
public double Length { get; set; }
Property Value
| Type |
Description |
| System.Double |
|
|
Improve this Doc
View Source
Normalized
Declaration
public GeoVector2D Normalized { get; }
Property Value
|
Improve this Doc
View Source
NullVector
Declaration
public static GeoVector2D NullVector { get; }
Property Value
|
Improve this Doc
View Source
TaxicabLength
Declaration
public double TaxicabLength { get; }
Property Value
| Type |
Description |
| System.Double |
|
|
Improve this Doc
View Source
XAxis
Declaration
public static GeoVector2D XAxis { get; }
Property Value
|
Improve this Doc
View Source
YAxis
Declaration
public static GeoVector2D YAxis { get; }
Property Value
Methods
|
Improve this Doc
View Source
Area(GeoVector2D, GeoVector2D)
Returns the area of the parallelogram defined by the two vectors. The result will be positive
if the sweep-direction from from to to is counterclockwise
otherwise it will be negative. If you need the angle of the triangle divide the result by 2.0
Declaration
public static double Area(GeoVector2D from, GeoVector2D to)
Parameters
Returns
| Type |
Description |
| System.Double |
the area
|
|
Improve this Doc
View Source
Cos(GeoVector2D, GeoVector2D)
Returns the cosine of the angle between the two vectors. Throws an arithmetic exception if any of the vectors
is the nullvector.
Declaration
public static double Cos(GeoVector2D v1, GeoVector2D v2)
Parameters
Returns
| Type |
Description |
| System.Double |
Cosine of the inner angle
|
|
Improve this Doc
View Source
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.
|
|
Improve this Doc
View Source
IsNullVector()
Returns true, if this vector is exactly the nullvector. Use IsNullVector(GeoVector)
if you need more control over precision.
Declaration
public bool IsNullVector()
Returns
| Type |
Description |
| System.Boolean |
true if nullvector
|
|
Improve this Doc
View Source
Norm()
Declaration
|
Improve this Doc
View Source
Opposite()
Declaration
public GeoVector2D Opposite()
Returns
|
Improve this Doc
View Source
Orientation(GeoVector2D, GeoVector2D)
Returns a positive value if the second vector turns to the left relative to the direction of the first vector,
a negative value if it turns to the right and 0.0 if the vectors are parallel. The value is the length of the crossproduct
of the two vectors in 3D or the area of the parallelogram build by the two vectors.
Declaration
public static double Orientation(GeoVector2D v1, GeoVector2D v2)
Parameters
Returns
| Type |
Description |
| System.Double |
The orientation
|
|
Improve this Doc
View Source
ToLeft()
Declaration
public GeoVector2D ToLeft()
Returns
|
Improve this Doc
View Source
ToRight()
Declaration
public GeoVector2D ToRight()
Returns
Operators
|
Improve this Doc
View Source
Addition(GeoVector2D, GeoVector2D)
Declaration
public static GeoVector2D operator +(GeoVector2D v1, GeoVector2D v2)
Parameters
Returns
|
Improve this Doc
View Source
Implicit(GeoVector2D to Double[])
Declaration
public static implicit operator double[](GeoVector2D p)
Parameters
Returns
| Type |
Description |
| System.Double[] |
|
|
Improve this Doc
View Source
Multiply(GeoVector2D, GeoVector2D)
Declaration
public static double operator *(GeoVector2D v1, GeoVector2D v2)
Parameters
Returns
| Type |
Description |
| System.Double |
|
|
Improve this Doc
View Source
Multiply(Double, GeoVector2D)
Declaration
public static GeoVector2D operator *(double d, GeoVector2D v)
Parameters
Returns
|
Improve this Doc
View Source
Subtraction(GeoVector2D, GeoVector2D)
Declaration
public static GeoVector2D operator -(GeoVector2D v1, GeoVector2D v2)
Parameters
Returns
|
Improve this Doc
View Source
UnaryNegation(GeoVector2D)
Declaration
public static GeoVector2D operator -(GeoVector2D v1)
Parameters
Returns
Explicit Interface Implementations
|
Improve this Doc
View Source
IJsonSerialize.GetObjectData(IJsonWriteData)
Declaration
void IJsonSerialize.GetObjectData(IJsonWriteData data)
Parameters
|
Improve this Doc
View Source
IJsonSerialize.SetObjectData(IJsonReadData)
Declaration
void IJsonSerialize.SetObjectData(IJsonReadData data)
Parameters
Implements
System.Runtime.Serialization.ISerializable