Show / Hide Table of Contents

Class Vector

The Vector Class: Defines vector mathematics and functionality for the dxf library

Inheritance
System.Object
GeoBase
Vector
Implements
System.ComponentModel.INotifyPropertyChanged
Inherited Members
GeoBase.GeometryEntityType
GeoBase.PropertyChanged
GeoBase.OnPropertyChanged(String)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Dxflib.LinAlg
Assembly: Dxflib.dll
Syntax
public class Vector : GeoBase, INotifyPropertyChanged

Constructors

| Improve this Doc View Source

Vector()

Default Constructor

Declaration
public Vector()
| Improve this Doc View Source

Vector(GeoLine)

Constructor from a line

Declaration
public Vector(GeoLine line)
Parameters
Type Name Description
GeoLine line
| Improve this Doc View Source

Vector(Vertex, Vertex)

PositionVector Constructor: This will create a vector with its tail at the origin and it's head at where the components are on the cartesian 3D space.

Declaration
public Vector(Vertex startingVertex, Vertex endingVertex)
Parameters
Type Name Description
Vertex startingVertex

The Starting Vertex for the position vector

Vertex endingVertex

The Ending Vertex for the position vector

| Improve this Doc View Source

Vector(Vector)

Constructor from another vector

Declaration
public Vector(Vector other)
Parameters
Type Name Description
Vector other
| Improve this Doc View Source

Vector(Double, Double, Double)

UnitVector Constructor

Declaration
public Vector(double xComponent, double yComponent, double zComponent = 0)
Parameters
Type Name Description
System.Double xComponent

The x component of a unit vector

System.Double yComponent

The y component of a unit vector

System.Double zComponent

The z component of a unit vector

Properties

| Improve this Doc View Source

HeadVertex

The Head of the vector or the ending vector (Point of Application)

Declaration
public Vertex HeadVertex { get; set; }
Property Value
Type Description
Vertex
| Improve this Doc View Source

Length

The vector's length or magnitude

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

Slope

The 2D Slope of the vector (dY/dX)

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

TailVertex

The Tail of the vector: where the vector originates

Declaration
public Vertex TailVertex { get; set; }
Property Value
Type Description
Vertex
| Improve this Doc View Source

X

The vector's x component

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

Y

The vector's y component

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

Z

The vector's z component

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

Methods

| Improve this Doc View Source

AngleBetweenVectors(Vector, Vector)

The Angle between two vectors

Declaration
public static double AngleBetweenVectors(Vector vec0, Vector vec1)
Parameters
Type Name Description
Vector vec0

Vector 1

Vector vec1

Vector 2

Returns
Type Description
System.Double

The angle between two vectors in radians

| Improve this Doc View Source

CrossProduct(Vector)

The Cross product of this vector and the other vector (ThisVector x OtherVector)

Declaration
public Vector CrossProduct(Vector other)
Parameters
Type Name Description
Vector other

The other vector that is in the cross function

Returns
Type Description
Vector

A new vector that is the resultant of the cross product

| Improve this Doc View Source

DotProduct(Vector)

The Mathematical Dot Product of two vectors

Declaration
public double DotProduct(Vector other)
Parameters
Type Name Description
Vector other

The other vector in the dot product equation

Returns
Type Description
System.Double

A double value that is the dot product of other and this vector

| Improve this Doc View Source

Rotate(Double)

Rotate the vector about is tail

Declaration
public void Rotate(double angle)
Parameters
Type Name Description
System.Double angle

Rotation angle in radians

| Improve this Doc View Source

Scale(Double)

Declaration
public void Scale(double scaler)
Parameters
Type Name Description
System.Double scaler
| Improve this Doc View Source

ToUnitVector()

Creates a new vector that is the unit vector of this vector

Declaration
public Vector ToUnitVector()
Returns
Type Description
Vector

A new Vector object

| Improve this Doc View Source

Transform(Vector, Vector, Vector)

Transform method transforms this vector using a new set of basis vectors

Declaration
public void Transform(Vector newXBasis, Vector newYBasis, Vector newZBasis)
Parameters
Type Name Description
Vector newXBasis

The new basis for the x component

Vector newYBasis

The new basis for the y component

Vector newZBasis

The new basis for the z component

| Improve this Doc View Source

Translate(Vertex)

Translate a vertex to a new point by its tail

Declaration
public void Translate(Vertex newTail)
Parameters
Type Name Description
Vertex newTail

The new tail vertex

| Improve this Doc View Source

UpdateGeometry(String)

Update the Geometry of the Vector

Declaration
protected override sealed void UpdateGeometry(string command = "")
Parameters
Type Name Description
System.String command
Overrides
GeoBase.UpdateGeometry(String)

Operators

| Improve this Doc View Source

Addition(Vector, Vector)

The Addition overload operator for the vector class

Declaration
public static Vector operator +(Vector vec1, Vector vec2)
Parameters
Type Name Description
Vector vec1
Vector vec2
Returns
Type Description
Vector
| Improve this Doc View Source

Division(Vector, Double)

Declaration
public static Vector operator /(Vector vec, double scaler)
Parameters
Type Name Description
Vector vec
System.Double scaler
Returns
Type Description
Vector
| Improve this Doc View Source

Multiply(Vector, Double)

The overloaded operator *

Declaration
public static Vector operator *(Vector vec, double scaler)
Parameters
Type Name Description
Vector vec
System.Double scaler
Returns
Type Description
Vector

A new vector that is the resultant of the scaler

| Improve this Doc View Source

Multiply(Double, Vector)

Declaration
public static Vector operator *(double scaler, Vector vec)
Parameters
Type Name Description
System.Double scaler
Vector vec
Returns
Type Description
Vector
| Improve this Doc View Source

Subtraction(Vector, Vector)

The overloaded operator "-"

Declaration
public static Vector operator -(Vector vec1, Vector vec2)
Parameters
Type Name Description
Vector vec1
Vector vec2
Returns
Type Description
Vector

A new vector that is the resultant of the subtraction

Implements

System.ComponentModel.INotifyPropertyChanged
  • Improve this Doc
  • View Source
Back to top Generated by DocFX