Struct GeoVector
A 3-dimensional vector with double x,y and z components. The vector is not necessary normalized.
Inherited Members
Namespace: CADability
Assembly: CADability.dll
Syntax
[Serializable]
[JsonVersion(serializeAsStruct = true, version = 1)]
public struct GeoVector : ISerializable, IJsonSerialize, IExportStep
Constructors
| Improve this Doc View SourceGeoVector(Angle, Angle)
Constructs a new GeoVector with the given angles a longitude and latitude. The resulting GeoVector is normed.
Declaration
public GeoVector(Angle longitude, Angle latitude)
Parameters
| Type | Name | Description |
|---|---|---|
| Angle | longitude | |
| Angle | latitude |
GeoVector(GeoPoint, GeoPoint)
Constructs a new GeoVector which points from the StartPoint to the EndPoint.
Declaration
public GeoVector(GeoPoint StartPoint, GeoPoint EndPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | StartPoint | from here |
| GeoPoint | EndPoint | to here |
GeoVector(GeoVector, GeoVector, Double)
Declaration
public GeoVector(GeoVector v1, GeoVector v2, double ratio)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector | v1 | |
| GeoVector | v2 | |
| System.Double | ratio |
GeoVector(GeoVector[])
Declaration
public GeoVector(params GeoVector[] v)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector[] | v |
GeoVector(GeoVector2D)
Constructs a new GeoVector from a 2d vector assumed in the xy plane
Declaration
public GeoVector(GeoVector2D v)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector2D | v |
GeoVector(IJsonReadStruct)
Declaration
public GeoVector(IJsonReadStruct data)
Parameters
| Type | Name | Description |
|---|---|---|
| IJsonReadStruct | data |
GeoVector(Double, Double, Double)
Constructs a new GeoVector with the given components
Declaration
public GeoVector(double x, double y, double z)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | x | x-component |
| System.Double | y | y-component |
| System.Double | z | z-component |
GeoVector(SerializationInfo, StreamingContext)
Constructor required by deserialization
Declaration
public GeoVector(SerializationInfo info, StreamingContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Runtime.Serialization.SerializationInfo | info | SerializationInfo |
| System.Runtime.Serialization.StreamingContext | context | StreamingContext |
Fields
| Improve this Doc View SourceNullVector
The nullvector, same as new GeoVector(0.0,0.0,0.0);
Declaration
public static readonly GeoVector NullVector
Field Value
| Type | Description |
|---|---|
| GeoVector |
x
x-component
Declaration
public double x
Field Value
| Type | Description |
|---|---|
| System.Double |
XAxis
The x-axis, same as new GeoVector(1.0,0.0,0.0);
Declaration
public static readonly GeoVector XAxis
Field Value
| Type | Description |
|---|---|
| GeoVector |
y
y-component
Declaration
public double y
Field Value
| Type | Description |
|---|---|
| System.Double |
YAxis
The y-axis, same as new GeoVector(0.0,1.0,0.0);
Declaration
public static readonly GeoVector YAxis
Field Value
| Type | Description |
|---|---|
| GeoVector |
z
z-component
Declaration
public double z
Field Value
| Type | Description |
|---|---|
| System.Double |
ZAxis
The z-axis, same as new GeoVector(0.0,0.0,1.0);
Declaration
public static readonly GeoVector ZAxis
Field Value
| Type | Description |
|---|---|
| GeoVector |
Properties
| Improve this Doc View SourceInvalid
An invalid GeoVector (NaN,NaN,NaN)
Declaration
public static GeoVector Invalid { get; }
Property Value
| Type | Description |
|---|---|
| GeoVector |
Item[Int32]
Declaration
public double this[int index] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index |
Property Value
| Type | Description |
|---|---|
| System.Double |
Length
Returns the length of this vector.
Declaration
public double Length { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
LengthSqared
Declaration
public double LengthSqared { get; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Normalized
Declaration
public GeoVector Normalized { get; }
Property Value
| Type | Description |
|---|---|
| GeoVector |
TaxicabLength
Declaration
public double TaxicabLength { get; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Methods
| Improve this Doc View SourceArbitraryNormals(out GeoVector, out GeoVector)
Declaration
public void ArbitraryNormals(out GeoVector dirx, out GeoVector diry)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector | dirx | |
| GeoVector | diry |
Bisector(GeoVector, GeoVector)
Returns the bisector vector of the two provided vectors. The result will be normalized (length = 1)
Declaration
public static GeoVector Bisector(GeoVector v1, GeoVector v2)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector | v1 | First vector |
| GeoVector | v2 | Second vector |
Returns
| Type | Description |
|---|---|
| GeoVector | The bisector |
Cos(GeoVector, GeoVector)
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(GeoVector v1, GeoVector v2)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector | v1 | First vector |
| GeoVector | v2 | Second vector |
Returns
| Type | Description |
|---|---|
| System.Double | Cosine of the inner angle |
Equals(Object)
Overrides object.Equals.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | object to compare with |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if exactly equal |
Overrides
GetHashCode()
Overrides object.GetHashCode
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 | the hashcode |
Overrides
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. |
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 |
IsPerpendicular(GeoVector)
Determines whether this vector and the othe vector are perpendicular. Use IsPerpendicular(GeoVector, GeoVector, Boolean) if you need more control over precision.
Declaration
public bool IsPerpendicular(GeoVector other)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector | other | other vector |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if perpendicular |
IsValid()
Declaration
public bool IsValid()
Returns
| Type | Description |
|---|---|
| System.Boolean |
Norm()
Normalizes this vector. After this operation the vector will have the Length 1.0 Throws a GeoVectorException if the vector is the nullvector.
Declaration
public void Norm()
NormIfNotNull()
Declaration
public void NormIfNotNull()
Reverse()
Reverses this vector.
Declaration
public void Reverse()
To2D()
Returns the coresponding 2d vector by omitting the z coordinate
Declaration
public GeoVector2D To2D()
Returns
| Type | Description |
|---|---|
| GeoVector2D | the coresponding 2d vector |
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String |
Overrides
Operators
| Improve this Doc View SourceAddition(GeoVector, GeoVector)
Adds the two vectors.
Declaration
public static GeoVector operator +(GeoVector v1, GeoVector v2)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector | v1 | first vector |
| GeoVector | v2 | second vector |
Returns
| Type | Description |
|---|---|
| GeoVector | sum |
Division(GeoVector, Double)
Divides the given GeoVector v by the given scalar value v.
Declaration
public static GeoVector operator /(GeoVector v, double d)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector | v | vector |
| System.Double | d | divider |
Returns
| Type | Description |
|---|---|
| GeoVector | scaled vector |
Equality(GeoVector, GeoVector)
Determins whether the given vectors are exactly equal. Use SameDirection(GeoVector, GeoVector, Boolean) if you need more control over precision.
Declaration
public static bool operator ==(GeoVector v1, GeoVector v2)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector | v1 | first operand |
| GeoVector | v2 | second operand |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if equal |
ExclusiveOr(GeoVector, GeoVector)
Cross product of the to vectors.
Declaration
public static GeoVector operator ^(GeoVector left, GeoVector right)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector | left | left operand |
| GeoVector | right | right operand |
Returns
| Type | Description |
|---|---|
| GeoVector | Cross product |
Implicit(GeoVector to Double[])
Declaration
public static implicit operator double[](GeoVector v)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector | v |
Returns
| Type | Description |
|---|---|
| System.Double[] |
Inequality(GeoVector, GeoVector)
Determins whether the given vectors are not exactly equal. Use SameDirection(GeoVector, GeoVector, Boolean) if you need more control over precision.
Declaration
public static bool operator !=(GeoVector v1, GeoVector v2)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector | v1 | first operand |
| GeoVector | v2 | second operand |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if not equal |
Multiply(GeoVector, GeoVector)
Calculates the scalar product (dot product, inner product) of the two given vectors
Declaration
public static double operator *(GeoVector v1, GeoVector v2)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector | v1 | first vector |
| GeoVector | v2 | second vector |
Returns
| Type | Description |
|---|---|
| System.Double | the scalar product |
Multiply(Matrix, GeoVector)
Declaration
public static GeoVector operator *(Matrix m, GeoVector v)
Parameters
| Type | Name | Description |
|---|---|---|
| MathNet.Numerics.LinearAlgebra.Double.Matrix | m | |
| GeoVector | v |
Returns
| Type | Description |
|---|---|
| GeoVector |
Multiply(Double, GeoVector)
Scales the given vector by the given double
Declaration
public static GeoVector operator *(double d, GeoVector v)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | d | factor |
| GeoVector | v | vector |
Returns
| Type | Description |
|---|---|
| GeoVector | scaled vector |
Subtraction(GeoVector, GeoVector)
Subtracts the second vector from the first vector
Declaration
public static GeoVector operator -(GeoVector v1, GeoVector v2)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector | v1 | first vector |
| GeoVector | v2 | second vector |
Returns
| Type | Description |
|---|---|
| GeoVector | difference |
UnaryNegation(GeoVector)
Reverses the driection of the given vector
Declaration
public static GeoVector operator -(GeoVector v)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector | v | vector to reverse |
Returns
| Type | Description |
|---|---|
| GeoVector | reversed vector |
Explicit Interface Implementations
| Improve this Doc View SourceIExportStep.Export(ExportStep, Boolean)
Declaration
int IExportStep.Export(ExportStep export, bool topLevel)
Parameters
| Type | Name | Description |
|---|---|---|
| ExportStep | export | |
| System.Boolean | topLevel |
Returns
| Type | Description |
|---|---|
| System.Int32 |
IJsonSerialize.GetObjectData(IJsonWriteData)
Declaration
void IJsonSerialize.GetObjectData(IJsonWriteData data)
Parameters
| Type | Name | Description |
|---|---|---|
| IJsonWriteData | data |
IJsonSerialize.SetObjectData(IJsonReadData)
Declaration
void IJsonSerialize.SetObjectData(IJsonReadData data)
Parameters
| Type | Name | Description |
|---|---|---|
| IJsonReadData | data |