Search Results for

    Show / Hide Table of Contents

    Class Vector3D

    Represents a vector in 3-dimensional Cartesian space.

    Inheritance
    object
    Vector3D
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: NetTopologySuite.Mathematics
    Assembly: NetTopologySuite.dll
    Syntax
    public class Vector3D

    Constructors

    | Edit this page View Source

    Vector3D(Coordinate)

    Creates a new 3D vector from a Coordinate.

    The coordinate should have the X,Y and Z ordinates specified.
    Declaration
    public Vector3D(Coordinate coord)
    Parameters
    Type Name Description
    Coordinate coord

    The coordinate to copy

    | Edit this page View Source

    Vector3D(Coordinate, Coordinate)

    Creates a new vector with the direction and magnitude of the difference between the to and from Coordinates.

    Declaration
    public Vector3D(Coordinate from, Coordinate to)
    Parameters
    Type Name Description
    Coordinate from

    The origin coordinate

    Coordinate to

    The destination coordinate

    | Edit this page View Source

    Vector3D(Vector2D, double)

    Creates a new Vector3D using a Vector2D plus a value for z component

    Declaration
    public Vector3D(Vector2D value, double z)
    Parameters
    Type Name Description
    Vector2D value

    A vector containing the values with which to initialize the X and Y components.

    double z

    Initial value for the Z component of the vector.

    | Edit this page View Source

    Vector3D(double, double, double)

    Creates a new vector with the given x, y and z components

    Declaration
    public Vector3D(double x, double y, double z)
    Parameters
    Type Name Description
    double x

    The x component

    double y

    The y component

    double z

    The z component

    Properties

    | Edit this page View Source

    X

    Gets a value indicating the x-ordinate

    Declaration
    public double X { get; }
    Property Value
    Type Description
    double
    | Edit this page View Source

    Y

    Gets a value indicating the y-ordinate

    Declaration
    public double Y { get; }
    Property Value
    Type Description
    double
    | Edit this page View Source

    Z

    Gets a value indicating the z-ordinate

    Declaration
    public double Z { get; }
    Property Value
    Type Description
    double
    | Edit this page View Source

    Zero

    Creates a new vector with all components set to Zero

    Declaration
    public static Vector3D Zero { get; }
    Property Value
    Type Description
    Vector3D

    Methods

    | Edit this page View Source

    Add(Vector3D)

    Computes a vector which is the sum of this vector and the given vector.

    Declaration
    public Vector3D Add(Vector3D v)
    Parameters
    Type Name Description
    Vector3D v

    The vector to add

    Returns
    Type Description
    Vector3D

    The sum of this and v

    | Edit this page View Source

    Create(Coordinate)

    Creates a vector from a 3D Coordinate.

    The coordinate should have the X,Y and Z ordinates specified.
    Declaration
    public static Vector3D Create(Coordinate coord)
    Parameters
    Type Name Description
    Coordinate coord

    The coordinate to copy

    Returns
    Type Description
    Vector3D

    A new vector

    | Edit this page View Source

    Create(double, double, double)

    Creates a new vector with given x, y and z components.

    Declaration
    public static Vector3D Create(double x, double y, double z)
    Parameters
    Type Name Description
    double x

    The x component

    double y

    The y component

    double z

    The z component

    Returns
    Type Description
    Vector3D

    A new vector

    | Edit this page View Source

    Cross(Vector3D)

    Computes the cross-product of this Vector3D and v

    Declaration
    public Vector3D Cross(Vector3D v)
    Parameters
    Type Name Description
    Vector3D v
    Returns
    Type Description
    Vector3D

    The cross product of the vectors

    | Edit this page View Source

    Cross(Vector3D, Vector3D)

    Calculates the cross product of two vectors.

    Declaration
    public static Vector3D Cross(Vector3D left, Vector3D right)
    Parameters
    Type Name Description
    Vector3D left

    First source vector.

    Vector3D right

    Second source vector.

    Returns
    Type Description
    Vector3D
    | Edit this page View Source

    Divide(double)

    Creates a new vector which has the same direction and with length equals to the length of this vector divided by the scalar value d.

    Declaration
    public Vector3D Divide(double d)
    Parameters
    Type Name Description
    double d

    The scalar divisor

    Returns
    Type Description
    Vector3D

    A new vector with divided length

    | Edit this page View Source

    Dot(Coordinate, Coordinate)

    Computes the 3D dot-product of two Coordinates

    Declaration
    public static double Dot(Coordinate v1, Coordinate v2)
    Parameters
    Type Name Description
    Coordinate v1

    The 1st vector

    Coordinate v2

    The 2nd vector

    Returns
    Type Description
    double

    The dot product of the (coordinate) vectors

    | Edit this page View Source

    Dot(Coordinate, Coordinate, Coordinate, Coordinate)

    Computes the dot product of the 3D vectors AB and CD.

    Declaration
    public static double Dot(Coordinate A, Coordinate B, Coordinate C, Coordinate D)
    Parameters
    Type Name Description
    Coordinate A

    The start point of the 1st vector

    Coordinate B

    The end point of the 1st vector

    Coordinate C

    The start point of the 2nd vector

    Coordinate D

    The end point of the 2nd vector

    Returns
    Type Description
    double

    The dot product

    | Edit this page View Source

    Dot(Vector3D)

    Computes the dot-product of this Vector3D and v

    Declaration
    public double Dot(Vector3D v)
    Parameters
    Type Name Description
    Vector3D v
    Returns
    Type Description
    double

    The dot product of the vectors

    | Edit this page View Source

    Equals(object)

    Declaration
    public override bool Equals(object o)
    Parameters
    Type Name Description
    object o
    Returns
    Type Description
    bool
    Overrides
    object.Equals(object)
    | Edit this page View Source

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    object.GetHashCode()
    | Edit this page View Source

    Length()

    Computes the length of this vector

    Declaration
    public double Length()
    Returns
    Type Description
    double

    The length of this vector

    | Edit this page View Source

    Length(Coordinate)

    Computes the length of vector v.

    Declaration
    public static double Length(Coordinate v)
    Parameters
    Type Name Description
    Coordinate v

    A coordinate representing a 3D Vector

    Returns
    Type Description
    double

    The length of v

    | Edit this page View Source

    Normalize()

    Computes a vector having identical direction but normalized to have length 1.

    Declaration
    public Vector3D Normalize()
    Returns
    Type Description
    Vector3D

    A new normalized vector

    | Edit this page View Source

    Normalize(Coordinate)

    Computes a vector having identical direction as v but normalized to have length 1.

    Declaration
    public static Coordinate Normalize(Coordinate v)
    Parameters
    Type Name Description
    Coordinate v

    A coordinate representing a 3D vector

    Returns
    Type Description
    Coordinate

    A coordinate representing the normalized vector

    | Edit this page View Source

    Subtract(Vector3D)

    Computes a vector which is the difference of this vector and the given vector.

    Declaration
    public Vector3D Subtract(Vector3D v)
    Parameters
    Type Name Description
    Vector3D v

    The vector to subtract

    Returns
    Type Description
    Vector3D

    The difference of this and v

    | Edit this page View Source

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    object.ToString()

    Operators

    | Edit this page View Source

    operator +(Vector3D, Vector3D)

    Adds two vectors.

    Declaration
    public static Vector3D operator +(Vector3D left, Vector3D right)
    Parameters
    Type Name Description
    Vector3D left

    The first vector to add.

    Vector3D right

    The second vector to add.

    Returns
    Type Description
    Vector3D

    The sum of the two vectors.

    | Edit this page View Source

    operator /(Vector3D, Vector3D)

    Scales a vector by the given value.

    Declaration
    public static Vector3D operator /(Vector3D value, Vector3D scale)
    Parameters
    Type Name Description
    Vector3D value

    The vector to scale.

    Vector3D scale

    The amount by which to scale the vector.

    Returns
    Type Description
    Vector3D

    The scaled vector.

    | Edit this page View Source

    operator /(Vector3D, double)

    Scales a vector by the given value.

    Declaration
    public static Vector3D operator /(Vector3D value, double scale)
    Parameters
    Type Name Description
    Vector3D value

    The vector to scale.

    double scale

    The amount by which to scale the vector.

    Returns
    Type Description
    Vector3D

    The scaled vector.

    | Edit this page View Source

    operator ==(Vector3D, Vector3D)

    Tests for equality between two objects.

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

    The first value to compare.

    Vector3D right

    The second value to compare.

    Returns
    Type Description
    bool

    true if left has the same value as right; otherwise, false.

    | Edit this page View Source

    operator !=(Vector3D, Vector3D)

    Tests for inequality between two objects.

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

    The first value to compare.

    Vector3D right

    The second value to compare.

    Returns
    Type Description
    bool

    true if left has a different value than right; otherwise, false.

    | Edit this page View Source

    operator *(Vector3D, Vector3D)

    Modulates a vector with another by performing component-wise multiplication.

    Declaration
    public static Vector3D operator *(Vector3D left, Vector3D right)
    Parameters
    Type Name Description
    Vector3D left

    The first vector to multiply.

    Vector3D right

    The second vector to multiply.

    Returns
    Type Description
    Vector3D

    The multiplication of the two vectors.

    | Edit this page View Source

    operator *(Vector3D, double)

    Scales a vector by the given value.

    Declaration
    public static Vector3D operator *(Vector3D value, double scale)
    Parameters
    Type Name Description
    Vector3D value

    The vector to scale.

    double scale

    The amount by which to scale the vector.

    Returns
    Type Description
    Vector3D

    The scaled vector.

    | Edit this page View Source

    operator *(double, Vector3D)

    Scales a vector by the given value.

    Declaration
    public static Vector3D operator *(double scale, Vector3D value)
    Parameters
    Type Name Description
    double scale

    The amount by which to scale the vector.

    Vector3D value

    The vector to scale.

    Returns
    Type Description
    Vector3D

    The scaled vector.

    | Edit this page View Source

    operator -(Vector3D, Vector3D)

    Subtracts two vectors.

    Declaration
    public static Vector3D operator -(Vector3D left, Vector3D right)
    Parameters
    Type Name Description
    Vector3D left

    The first vector to subtract.

    Vector3D right

    The second vector to subtract.

    Returns
    Type Description
    Vector3D

    The difference of the two vectors.

    | Edit this page View Source

    operator -(Vector3D)

    Reverses the direction of a given vector.

    Declaration
    public static Vector3D operator -(Vector3D value)
    Parameters
    Type Name Description
    Vector3D value

    The vector to negate.

    Returns
    Type Description
    Vector3D

    A vector facing in the opposite direction.

    | Edit this page View Source

    operator +(Vector3D)

    Assert a vector (return it unchanged).

    Declaration
    public static Vector3D operator +(Vector3D value)
    Parameters
    Type Name Description
    Vector3D value

    The vector to assert (unchanged).

    Returns
    Type Description
    Vector3D

    The asserted (unchanged) vector.

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX