Show / Hide Table of Contents

Struct Vector3d

Vector 3D Type for handling vectors

Implements
IEquatable<Vector3d>
Namespace: FpAssistantCore.General
Assembly: FpAssistantCoreScl.dll
Syntax
public struct Vector3d

Constructors

View Source

Vector3d(Point3d, Point3d)

Create a 3D vector passing through two points

Declaration
public Vector3d(Point3d point1, Point3d point2)
Parameters
Type Name Description
Point3d point1

First point

Point3d point2

Second point

View Source

Vector3d(Double, Double, Double)

Create a 3D vector passing the three components; X, Y and Z

Declaration
public Vector3d(double vectorX = null, double vectorY = null, double vectorZ = null)
Parameters
Type Name Description
System.Double vectorX

X values of the 3D vector

System.Double vectorY

Y values of the 3D vector

System.Double vectorZ

Z values of the 3D vector

Properties

View Source

Magnitude

The magnitude of the vector

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

Calculated magnitude of this 3D vector

Remarks

The magnitude (or absolute value) of a vector is its length, irrespective of direction

View Source

UnitVectorXAxis

Value of the unit vector along the X-Axis

Declaration
public static readonly Vector3d UnitVectorXAxis { get; }
Property Value
Type Description
Vector3d

Value of the unit vector along the X-Axis

View Source

UnitVectorYAxis

Value of the unit vector along the Y-Axis

Declaration
public static readonly Vector3d UnitVectorYAxis { get; }
Property Value
Type Description
Vector3d

Value of the unit vector along the Y-Axis

View Source

UnitVectorZAxis

Value of the unit vector along the Z-Axis

Declaration
public static readonly Vector3d UnitVectorZAxis { get; }
Property Value
Type Description
Vector3d

Value of the unit vector along the Z-Axis

View Source

X

Property to access the X compoment of the vector

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

X value of the 3D vector

View Source

Y

Property to access the Y compoment of the vector

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

Y value of the 3D vector

View Source

Z

Property to access the Z compoment of the vector

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

Z value of the 3D vector

Methods

View Source

Add(Vector3d, Vector3d)

Vector addition using 'Add'

Declaration
public static Vector3d Add(Vector3d vector1, Vector3d vector2)
Parameters
Type Name Description
Vector3d vector1

First vector to add

Vector3d vector2

Second vector ao add

Returns
Type Description
Vector3d

Result of addition

Remarks

Static function

View Source

AngleBetween(Vector3d, Vector3d)

Computes the angle between two vectors

Declaration
public static double AngleBetween(Vector3d vector1, Vector3d vector2)
Parameters
Type Name Description
Vector3d vector1

First vector.

Vector3d vector2

Second vector.

Returns
Type Description
System.Double

Returns the angle required to rotate vector1 into vector2 in degrees. This will return a value between [0, 180] degrees. (Note that this is slightly different from the Vector member function of the same name. Signed angles do not extend to 3D.)

View Source

DotProduct(Vector3d)

Vector dot product

Declaration
public double DotProduct(Vector3d vector3d)
Parameters
Type Name Description
Vector3d vector3d
Returns
Type Description
System.Double

Dot product of two vectors

View Source

DotProduct(Vector3d, Vector3d)

Vector dot product

Declaration
public static double DotProduct(Vector3d vector3d1, Vector3d vector3d2)
Parameters
Type Name Description
Vector3d vector3d1

First vector

Vector3d vector3d2

Second vector

Returns
Type Description
System.Double

Dot product of two vectors

Remarks

Static function

View Source

Equals(Vector3d)

Indicates whether the current vector is equal to another vector

Declaration
public bool Equals(Vector3d other)
Parameters
Type Name Description
Vector3d other

Vector to compare with this vector

Returns
Type Description
System.Boolean

true if the current vector is equal to the vector parameter; otherwise false

View Source

Equals(Object)

Indicates whether this instance and a specified object are equal

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj

The object to compare to

Returns
Type Description
System.Boolean

True if the instances are equal; otherwise false

View Source

Gamma()

Return the angle from x-axis,

Declaration
public double Gamma()
Returns
Type Description
System.Double

Angle from the x-axis in radians, ccw +ve

Remarks

In radians. Name taken from Euler angles

View Source

Gamma(Vector3d)

Return the angle from x-axis, in radians

Declaration
public static double Gamma(Vector3d vector3d)
Parameters
Type Name Description
Vector3d vector3d

Vector3d parameter

Returns
Type Description
System.Double

Angle from the x-axis in radians

Remarks

Name taken from Euler angles

View Source

GetHashCode()

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

Multiply(Vector3d, Vector3d)

Vector cross product

Declaration
public static Vector3d Multiply(Vector3d left, Vector3d right)
Parameters
Type Name Description
Vector3d left
Vector3d right
Returns
Type Description
Vector3d

cross product vector following right hand rule

Remarks

Static function

View Source

Negate(Vector3d)

Operator -Vector (unary negation)

Declaration
public static Vector3d Negate(Vector3d vector3d)
Parameters
Type Name Description
Vector3d vector3d

Vector being negated.

Returns
Type Description
Vector3d

Negation of the given vector

Remarks

Static function

View Source

Normalize()

Create a normalised 3D vector (unit vector)

Declaration
public void Normalize()
Remarks

Updates the vector to maintain its direction, but to have a length of 1. Equivalent to dividing the vector by its Length. Returns NaN if length is zero

View Source

NormalizedCopy()

Returns a normalized (unit vector)

Declaration
public Vector3d NormalizedCopy()
Returns
Type Description
Vector3d

Returns a normalized (unit vector) copy of the vector

Remarks

Does not change the original 3D vector

View Source

Subtract(Vector3d, Vector3d)

Vector subtraction using 'Subtract'

Declaration
public static Vector3d Subtract(Vector3d vector1, Vector3d vector2)
Parameters
Type Name Description
Vector3d vector1

Vector that is subtracted from

Vector3d vector2

Vector being subtracted

Returns
Type Description
Vector3d

Result of subtraction

Remarks

Static function

View Source

ToString()

Return a string of the point

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

string: X,Y,Z

View Source

ToString(IFormatProvider)

String with the current culture number format

Declaration
public string ToString(IFormatProvider iFormatProvider)
Parameters
Type Name Description
IFormatProvider iFormatProvider

IFormatProvider

Returns
Type Description
System.String

string containing Point3d numbers is culture format

Operators

View Source

Addition(Vector3d, Vector3d)

Vector addition using '+'

Declaration
public static Vector3d operator +(Vector3d vector1, Vector3d vector2)
Parameters
Type Name Description
Vector3d vector1

First vector to add

Vector3d vector2

Second vector ao add

Returns
Type Description
Vector3d

Result of addition

Remarks

Static function

View Source

Equality(Vector3d, Vector3d)

Compares two vectors for equality

Declaration
public static bool operator ==(Vector3d left, Vector3d right)
Parameters
Type Name Description
Vector3d left

First vector

Vector3d right

Second vector

Returns
Type Description
System.Boolean

True, if left equals right; false otherwise

View Source

Inequality(Vector3d, Vector3d)

Compares two vectors for inequality

Declaration
public static bool operator !=(Vector3d left, Vector3d right)
Parameters
Type Name Description
Vector3d left

First vector

Vector3d right

Second vector

Returns
Type Description
System.Boolean

True, if left equals right; false otherwise

View Source

Multiply(Vector3d, Vector3d)

Vector cross product

Declaration
public static Vector3d operator *(Vector3d vector1, Vector3d vector2)
Parameters
Type Name Description
Vector3d vector1

Vector 1

Vector3d vector2

Vector 2

Returns
Type Description
Vector3d

cross product vector following right hand rule

Remarks

Static function

View Source

Multiply(Double, Vector3d)

Vector scalar multiplication

Declaration
public static Vector3d operator *(double scalar, Vector3d vector)
Parameters
Type Name Description
System.Double scalar

Scalar value by which the vector is multiplied

Vector3d vector

Vector being multiplied

Returns
Type Description
Vector3d

Result of multiplication

Remarks

Static function

View Source

Subtraction(Vector3d, Vector3d)

Vector subtraction using '-'

Declaration
public static Vector3d operator -(Vector3d vector1, Vector3d vector2)
Parameters
Type Name Description
Vector3d vector1

Vector that is subtracted from

Vector3d vector2

Vector being subtracted

Returns
Type Description
Vector3d

Result of subtraction

Remarks

Static function

View Source

UnaryNegation(Vector3d)

Operator -Vector (unary negation)

Declaration
public static Vector3d operator -(Vector3d vector3d)
Parameters
Type Name Description
Vector3d vector3d

Vector being negated.

Returns
Type Description
Vector3d

Negation of the given vector

Remarks

Static function

Implements

IEquatable<>

Extension Methods

MathExtension.PerpendicularVector2D(Vector3d)
MathExtension.AngleTo(Vector3d, Vector3d)
  • View Source
In This Article
Back to top Copyright 2018-2024 CADology Limited