Show / Hide Table of Contents

Struct GeoVector

A 3-dimensional vector with double x,y and z components. The vector is not necessary normalized. 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
IJsonSerialize
IExportStep
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: CADability
Assembly: CADability.dll
Syntax
[Serializable]
[JsonVersion(serializeAsStruct = true, version = 1)]
public struct GeoVector : ISerializable, IJsonSerialize, IExportStep

Constructors

| Improve this Doc View Source

GeoVector(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
| Improve this Doc View Source

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

| Improve this Doc View Source

GeoVector(GeoVector, GeoVector, Double)

Declaration
public GeoVector(GeoVector v1, GeoVector v2, double ratio)
Parameters
Type Name Description
GeoVector v1
GeoVector v2
System.Double ratio
| Improve this Doc View Source

GeoVector(GeoVector[])

Declaration
public GeoVector(params GeoVector[] v)
Parameters
Type Name Description
GeoVector[] v
| Improve this Doc View Source

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
| Improve this Doc View Source

GeoVector(IJsonReadStruct)

Declaration
public GeoVector(IJsonReadStruct data)
Parameters
Type Name Description
IJsonReadStruct data
| Improve this Doc View Source

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

| Improve this Doc View Source

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 Source

NullVector

The nullvector, same as new GeoVector(0.0,0.0,0.0);

Declaration
public static readonly GeoVector NullVector
Field Value
Type Description
GeoVector
| Improve this Doc View Source

x

x-component

Declaration
public double x
Field Value
Type Description
System.Double
| Improve this Doc View Source

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
| Improve this Doc View Source

y

y-component

Declaration
public double y
Field Value
Type Description
System.Double
| Improve this Doc View Source

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
| Improve this Doc View Source

z

z-component

Declaration
public double z
Field Value
Type Description
System.Double
| Improve this Doc View Source

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 Source

Invalid

An invalid GeoVector (NaN,NaN,NaN)

Declaration
public static GeoVector Invalid { get; }
Property Value
Type Description
GeoVector
| Improve this Doc View Source

Item[Int32]

Declaration
public double this[int index] { get; set; }
Parameters
Type Name Description
System.Int32 index
Property Value
Type Description
System.Double
| Improve this Doc View Source

Length

Returns the length of this vector.

Declaration
public double Length { get; set; }
Property Value
Type Description
System.Double
| Improve this Doc View Source

LengthSqared

Declaration
public double LengthSqared { get; }
Property Value
Type Description
System.Double
| Improve this Doc View Source

Normalized

Declaration
public GeoVector Normalized { get; }
Property Value
Type Description
GeoVector
| Improve this Doc View Source

TaxicabLength

Declaration
public double TaxicabLength { get; }
Property Value
Type Description
System.Double

Methods

| Improve this Doc View Source

ArbitraryNormals(out GeoVector, out GeoVector)

Declaration
public void ArbitraryNormals(out GeoVector dirx, out GeoVector diry)
Parameters
Type Name Description
GeoVector dirx
GeoVector diry
| Improve this Doc View Source

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

| Improve this Doc View Source

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

| Improve this Doc View Source

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
System.ValueType.Equals(System.Object)
| Improve this Doc View Source

GetHashCode()

Overrides object.GetHashCode

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

the hashcode

Overrides
System.ValueType.GetHashCode()
| 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

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

| Improve this Doc View Source

IsValid()

Declaration
public bool IsValid()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

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()
| Improve this Doc View Source

NormIfNotNull()

Declaration
public void NormIfNotNull()
| Improve this Doc View Source

Reverse()

Reverses this vector.

Declaration
public void Reverse()
| Improve this Doc View Source

To2D()

Returns the coresponding 2d vector by omitting the z coordinate

Declaration
public GeoVector2D To2D()
Returns
Type Description
GeoVector2D

the coresponding 2d vector

| Improve this Doc View Source

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.ValueType.ToString()

Operators

| Improve this Doc View Source

Addition(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

| Improve this Doc View Source

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

| Improve this Doc View Source

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

| Improve this Doc View Source

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

| Improve this Doc View Source

Implicit(GeoVector to Double[])

Declaration
public static implicit operator double[](GeoVector v)
Parameters
Type Name Description
GeoVector v
Returns
Type Description
System.Double[]
| Improve this Doc View Source

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

| Improve this Doc View Source

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

| Improve this Doc View Source

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
| Improve this Doc View Source

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

| Improve this Doc View Source

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

| Improve this Doc View Source

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 Source

IExportStep.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
| Improve this Doc View Source

IJsonSerialize.GetObjectData(IJsonWriteData)

Declaration
void IJsonSerialize.GetObjectData(IJsonWriteData data)
Parameters
Type Name Description
IJsonWriteData data
| Improve this Doc View Source

IJsonSerialize.SetObjectData(IJsonReadData)

Declaration
void IJsonSerialize.SetObjectData(IJsonReadData data)
Parameters
Type Name Description
IJsonReadData data

Implements

System.Runtime.Serialization.ISerializable
IJsonSerialize
IExportStep
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX