Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

VRageMath.Vector3

Morten Aune Lyrstad edited this page Apr 13, 2023 · 53 revisions

IndexNamespace Index

Vector3 Struct

public struct Vector3: IEquatable<Vector3>

Defines a vector with three components.

Namespace: VRageMath
Assembly: VRage.Math.dll

Implements:

Fields

static Vector3 Backward

static Vector3 Down

static Vector3 Forward

static Vector3 Half

static Vector3 Invalid

static Vector3 Left

static Vector3 MaxValue

static Vector3 MinusOne

static Vector3 MinValue

static Vector3 NegativeInfinity

static Vector3 One

static Vector3 PositiveInfinity

static Vector3 Right

static Vector3 UnitX

static Vector3 UnitY

static Vector3 UnitZ

static Vector3 Up

static Vector3 Zero

float X

Gets or sets the x-component of the vector.

float Y

Gets or sets the y-component of the vector.

float Z

Gets or sets the z-component of the vector.

Properties

float Sum { get; }

float Volume { get; }

Constructors

Vector3(float x, float y, float z)

Vector3(double x, double y, double z)

Vector3(float value)

Vector3(Vector2 value, float z)

Vector3(Vector4 xyz)

Vector3(ref Vector3I value)

Vector3(Vector3I value)

Methods

static Vector3 Abs(Vector3 value)

static Vector3 Add(Vector3 value1, Vector3 value2)

Adds two vectors.

static void Add(ref Vector3 value1, ref Vector3 value2, out Vector3 result)

Adds two vectors.

static double Angle(Vector3 a, Vector3 b)

Gets angle between 2 vectors in radians

static bool ArePerpendicular(ref Vector3 a, ref Vector3 b)

static bool ArePerpendicular(Vector3 a, Vector3 b)

static Vector3 Barycentric(Vector3 value1, Vector3 value2, Vector3 value3, float amount1, float amount2)

Returns a Vector3 containing the 3D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 3D triangle.

static void Barycentric(ref Vector3 value1, ref Vector3 value2, ref Vector3 value3, float amount1, float amount2, out Vector3 result)

Returns a Vector3 containing the 3D Cartesian coordinates of a point specified in barycentric (areal) coordinates relative to a 3D triangle.

static void Barycentric(Vector3 p, Vector3 a, Vector3 b, Vector3 c, out float u, out float v, out float w)

Compute barycentric coordinates (u, v, w) for point p with respect to triangle (a, b, c) From : Real-Time Collision Detection, Christer Ericson, CRC Press 3.4 Barycentric Coordinates

static Vector3 CalculatePerpendicularVector(Vector3 v)

static Vector3 CatmullRom(Vector3 value1, Vector3 value2, Vector3 value3, Vector3 value4, float amount)

Performs a Catmull-Rom interpolation using the specified positions.

static void CatmullRom(ref Vector3 value1, ref Vector3 value2, ref Vector3 value3, ref Vector3 value4, float amount, out Vector3 result)

Performs a Catmull-Rom interpolation using the specified positions.

static Vector3 Ceiling(Vector3 v)

static Vector3 Clamp(Vector3 value1, Vector3 min, Vector3 max)

Restricts a value to be within a specified range.

static Vector3 Clamp(Vector3 value1, Vector3 min, Vector3 max, out Vector3 clampedBy, out Vector3 minRemaining, out Vector3 maxRemaining)

Restricts a value to be within a specified range.

static void Clamp(ref Vector3 value1, ref Vector3 min, ref Vector3 max, out Vector3 result)

Restricts a value to be within a specified range.

static Vector3 ClampToSphere(Vector3 vector, float radius)

static void ClampToSphere(ref Vector3 vector, float radius)

static void CreateFromAzimuthAndElevation(float azimuth, float elevation, out Vector3 direction)

static Vector3 Cross(Vector3 vector1, Vector3 vector2)

Calculates the cross product of two vectors.

static void Cross(ref Vector3 vector1, ref Vector3 vector2, out Vector3 result)

Calculates the cross product of two vectors.

static float Distance(Vector3 value1, Vector3 value2)

Calculates the distance between two vectors.

static void Distance(ref Vector3 value1, ref Vector3 value2, out float result)

Calculates the distance between two vectors.

static float DistanceSquared(Vector3 value1, Vector3 value2)

Calculates the distance between two vectors squared.

static void DistanceSquared(ref Vector3 value1, ref Vector3 value2, out float result)

Calculates the distance between two vectors squared.

static Vector3 Divide(Vector3 value1, Vector3 value2)

Divides the components of a vector by the components of another vector.

static void Divide(ref Vector3 value1, ref Vector3 value2, out Vector3 result)

Divides the components of a vector by the components of another vector.

static Vector3 Divide(Vector3 value1, float value2)

Divides a vector by a scalar value.

static void Divide(ref Vector3 value1, float value2, out Vector3 result)

Divides a vector by a scalar value.

static Vector3 DominantAxisProjection(Vector3 value1)

Returns a vector that is equal to the projection of the input vector to the coordinate axis that corresponds to the original vector's largest value.

static void DominantAxisProjection(ref Vector3 value1, out Vector3 result)

Calculates a vector that is equal to the projection of the input vector to the coordinate axis that corresponds to the original vector's largest value. The result is saved into a user-specified variable.

static float Dot(Vector3 vector1, Vector3 vector2)

Calculates the dot product of two vectors. If the two vectors are unit vectors, the dot product returns a floating point value between -1 and 1 that can be used to determine some properties of the angle between two vectors. For example, it can show whether the vectors are orthogonal, parallel, or have an acute or obtuse angle between them.

static void Dot(ref Vector3 vector1, ref Vector3 vector2, out float result)

Calculates the dot product of two vectors and writes the result to a user-specified variable. If the two vectors are unit vectors, the dot product returns a floating point value between -1 and 1 that can be used to determine some properties of the angle between two vectors. For example, it can show whether the vectors are orthogonal, parallel, or have an acute or obtuse angle between them.

static Vector3 Floor(Vector3 v)

static void GetAzimuthAndElevation(Vector3 v, out float azimuth, out float elevation)

static bool GetNormalized(ref Vector3 value)

static Vector3 Hermite(Vector3 value1, Vector3 tangent1, Vector3 value2, Vector3 tangent2, float amount)

Performs a Hermite spline interpolation.

static void Hermite(ref Vector3 value1, ref Vector3 tangent1, ref Vector3 value2, ref Vector3 tangent2, float amount, out Vector3 result)

Performs a Hermite spline interpolation.

static bool IsUnit(ref Vector3 value)

static bool IsZero(ref Vector3 vec)

static bool IsZero(Vector3 value)

static bool IsZero(Vector3 value, float epsilon)

static Vector3 IsZeroVector(Vector3 value)

static Vector3 IsZeroVector(Vector3 value, float epsilon)

static Vector3 Lerp(Vector3 value1, Vector3 value2, float amount)

Performs a linear interpolation between two vectors.

static void Lerp(ref Vector3 value1, ref Vector3 value2, float amount, out Vector3 result)

Performs a linear interpolation between two vectors.

static Vector3 Max(Vector3 value1, Vector3 value2)

Returns a vector that contains the highest value from each matching pair of components.

static void Max(ref Vector3 value1, ref Vector3 value2, out Vector3 result)

Returns a vector that contains the highest value from each matching pair of components.

static Vector3 Min(Vector3 value1, Vector3 value2)

Returns a vector that contains the lowest value from each matching pair of components.

static void Min(ref Vector3 value1, ref Vector3 value2, out Vector3 result)

Returns a vector that contains the lowest value from each matching pair of components.

static void MinMax(ref Vector3 min, ref Vector3 max)

Separates minimal and maximal values of any two input vectors

static Vector3 Multiply(Vector3 value1, Vector3 value2)

Multiplies the components of two vectors by each other.

static void Multiply(ref Vector3 value1, ref Vector3 value2, out Vector3 result)

Multiplies the components of two vectors by each other.

static Vector3 Multiply(Vector3 value1, float scaleFactor)

Multiplies a vector by a scalar value.

static void Multiply(ref Vector3 value1, float scaleFactor, out Vector3 result)

Multiplies a vector by a scalar value.

static Vector3 Negate(Vector3 value)

Returns a vector pointing in the opposite direction.

static void Negate(ref Vector3 value, out Vector3 result)

Returns a vector pointing in the opposite direction.

static Vector3 Normalize(Vector3 value)

Creates a unit vector from the specified vector. The result is a vector one unit in length pointing in the same direction as the original vector.

static Vector3 Normalize(Vector3D value)

static void Normalize(ref Vector3 value, out Vector3 result)

Creates a unit vector from the specified vector, writing the result to a user-specified variable. The result is a vector one unit in length pointing in the same direction as the original vector.

static Vector3 ProjectOnPlane(ref Vector3 vec, ref Vector3 planeNormal)

Projects given vector on plane specified by it's normal.

static Vector3 ProjectOnVector(ref Vector3 vec, ref Vector3 guideVector)

Projects vector on another vector resulting in new vector in guided vector's direction with different length.

static float RectangularDistance(Vector3 value1, Vector3 value2)

Calculates rectangular distance (a.k.a. Manhattan distance or Chessboard distace) between two vectors.

static float RectangularDistance(ref Vector3 value1, ref Vector3 value2)

Calculates rectangular distance (a.k.a. Manhattan distance or Chessboard distace) between two vectors.

static Vector3 Reflect(Vector3 vector, Vector3 normal)

Returns the reflection of a vector off a surface that has the specified normal. Reference page contains code sample.

static void Reflect(ref Vector3 vector, ref Vector3 normal, out Vector3 result)

Returns the reflection of a vector off a surface that has the specified normal. Reference page contains code sample.

static Vector3 Reject(Vector3 vector, Vector3 direction)

Returns the rejection of vector from direction, i.e. projection of vector onto the plane defined by origin and direction

static void Reject(ref Vector3 vector, ref Vector3 direction, out Vector3 result)

Returns the rejection of vector from direction, i.e. projection of vector onto the plane defined by origin and direction

static void RotateAndScale(ref Vector3 vector, ref Matrix matrix, out Vector3 result)

static Vector3 RotateAndScale(Vector3 vector, Matrix matrix)

static Vector3 Round(Vector3 v)

static Vector3 Round(Vector3 v, int numDecimals)

static Vector3 Sign(Vector3 value)

static Vector3 Sign(Vector3 value, float epsilon)

static Vector3 SignNonZero(Vector3 value)

Returns per component sign, never returns zero. For zero component returns sign 1. Faster than Sign.

static Vector3 SmoothStep(Vector3 value1, Vector3 value2, float amount)

Interpolates between two values using a cubic equation.

static void SmoothStep(ref Vector3 value1, ref Vector3 value2, float amount, out Vector3 result)

Interpolates between two values using a cubic equation.

static Vector3 Step(Vector3 value)

static Vector3 Subtract(Vector3 value1, Vector3 value2)

Subtracts a vector from a vector.

static void Subtract(ref Vector3 value1, ref Vector3 value2, out Vector3 result)

Subtracts a vector from a vector.

static Vector3 SwapYZCoordinates(Vector3 v)

static void Transform(Vector3&#91] sourceArray, ref Quaternion rotation, Vector3&#91] destinationArray)

Transforms a source array of Vector3s by a specified Quaternion rotation and writes the results to an existing destination array.

static void Transform(Vector3&#91] sourceArray, int sourceIndex, ref Quaternion rotation, Vector3&#91] destinationArray, int destinationIndex, int length)

Applies a specified Quaternion rotation to a specified range of an array of Vector3s and writes the results into a specified range of a destination array.

static Vector3 Transform(Vector3 position, Matrix matrix)

Transforms a 3D vector by the given matrix.

static Vector3D Transform(Vector3 position, MatrixD matrix)

Transforms a 3D vector by the given matrix.

static Vector3 Transform(Vector3 position, ref Matrix matrix)

static void Transform(ref Vector3 position, ref Matrix matrix, out Vector3 result)

Transforms a Vector3 by the given Matrix.

static void Transform(ref Vector3 position, ref MatrixI matrix, out Vector3 result)

static Vector3 Transform(Vector3 value, Quaternion rotation)

Transforms a Vector3 by a specified Quaternion rotation.

static void Transform(ref Vector3 value, ref Quaternion rotation, out Vector3 result)

Transforms a Vector3 by a specified Quaternion rotation.

static void Transform(Vector3&#91] sourceArray, ref Matrix matrix, Vector3&#91] destinationArray)

Transforms a source array of Vector3s by a specified Matrix and writes the results to an existing destination array.

static void Transform(Vector3&#91] sourceArray, int sourceIndex, ref Matrix matrix, Vector3&#91] destinationArray, int destinationIndex, int length)

Applies a specified transform Matrix to a specified range of an array of Vector3s and writes the results into a specified range of a destination array.

static void TransformNoProjection(ref Vector3 vector, ref Matrix matrix, out Vector3 result)

static Vector3 TransformNormal(Vector3 normal, Matrix matrix)

Transforms a 3D vector normal by a matrix.

static Vector3 TransformNormal(Vector3 normal, MatrixD matrix)

Transforms a 3D vector normal by a matrix.

static Vector3 TransformNormal(Vector3D normal, Matrix matrix)

Transforms a 3D vector normal by a matrix.

static void TransformNormal(ref Vector3 normal, ref Matrix matrix, out Vector3 result)

Transforms a vector normal by a matrix.

static void TransformNormal(ref Vector3 normal, ref MatrixD matrix, out Vector3 result)

static void TransformNormal(ref Vector3 normal, ref MatrixI matrix, out Vector3 result)

static Vector3 TransformNormal(Vector3 normal, MyBlockOrientation orientation)

static void TransformNormal(ref Vector3 normal, MyBlockOrientation orientation, out Vector3 result)

static Vector3 TransformNormal(Vector3 normal, ref Matrix matrix)

static void TransformNormal(Vector3&#91] sourceArray, ref Matrix matrix, Vector3&#91] destinationArray)

Transforms an array of 3D vector normals by a specified Matrix.

static void TransformNormal(Vector3&#91] sourceArray, int sourceIndex, ref Matrix matrix, Vector3&#91] destinationArray, int destinationIndex, int length)

Transforms a specified range in an array of 3D vector normals by a specified Matrix and writes the results to a specified range in a destination array.

static void TransformProjection(ref Vector3 position, ref Matrix matrix, out Vector3 result)

Transforms a Vector3 by the given projection matrix (both ortho and perspective are supported)

static float TriangleArea(Vector3 v1, Vector3 v2, Vector3 v3)

static float TriangleArea(ref Vector3 v1, ref Vector3 v2, ref Vector3 v3)

float AbsMax()

Returns the component of the vector, whose absolute value is largest of all the three components.

float AbsMin()

Returns the component of the vector, whose absolute value is smallest of all the three components.

void Add(Vector3 other)

void AssertIsValid()

void CalculatePerpendicularVector(out Vector3 result)

Vector3 Cross(Vector3 v)

void Divide(float divider)

float Dot(Vector3 v)

float Dot(ref Vector3 v)

bool Equals(Vector3 other)

Determines whether the specified Object is equal to the Vector3.

bool Equals(Vector3 other, float epsilon)

bool Equals(object obj)

Returns a value that indicates whether the current instance is equal to a specified object.

float GetDim(int i)

long GetHash()

Gets the hash code of the vector object.

int GetHashCode()

void Interpolate3(Vector3 v0, Vector3 v1, float rt)

bool IsInsideInclusive(ref Vector3 min, ref Vector3 max)

bool IsValid()

float Length()

Calculates the length of the vector.

float LengthSquared()

Calculates the length of the vector squared.

float Max()

Returns the component of the vector that is largest of all the three components.

Vector3 MaxAbsComponent()

Keeps only component with maximal absolute, others are set to zero.

float Min()

Returns the component of the vector that is smallest of all the three components.

void Multiply(float scale)

float Normalize()

Turns the current vector into a unit vector. The result is a vector one unit in length pointing in the same direction as the original vector.

Vector3 Normalized()

Creates a unit vector from the specified vector. The result is a vector one unit in length pointing in the same direction as the original vector.

void SetDim(int i, float value)

string ToString()

Retrieves a string representation of the current object.

string ToString(string format)

long VolumeInt(float multiplier)

Clone this wiki locally