Vector3i

struct Vector3i

Description

Vector with three dimensions and integer type. Vector3i used for dealing with translation, sizes, angles of objects where where don't require the float point precision. In all other cases Vector3f or Vector2f will be used.

Static Properties

Left

Represents a Left direction of vector. [-1, 0, 0].

Right

Represents a Right direction of vector. [1, 0, 0].

Up

Represents a Up direction of vector. [0, 1, 0].

Down

Represents a Down direction of vector. [0, -1, 0].

Forward

Represents a Forward direction of vector. [0, 0, 1].

Backward

Represents a Backward direction of vector. [0, 0, -1].

One

Constructs the Vector3i with [1, 1, 1] values.

Zero

Constructs the Vector3i with [0, 0, 0] values

Properties

x

The X component of this vector.

y

The Y component of this vector.

z

The Z component of this vector.

this[int index]

Access to X or Y or Z component of this vector as [0], [1], [2].

Count

Returns the length (count of components) of the Vector3i.

Constructors

Vector3i

Construct new Vector3i with default values [0, 0, 0].

Vector3i(float x, float y, float z)

Construct new Vector3i from x, y, z values.

Vector3i(float scalar)

Construct new Vector3i and set all its values to scalar.

Vector3i(Vector3i v)

Construct new Vector3i from another Vector3i.

Vector3i(Vector2i v)

Construct new Vector3i from another Vector2i, z values stay untouched.

Methods

Set

Set vector values. (3 overloads)

Equals

Check if this vector equals v.

Clamp

Clamps the Vector3i to min and max bounds.

ToString

Convert Vector3i to String.

AsString

String representation of Vector3i. This another version in format of x: 0, y: 0, z: 0.

Static Methods

Distance

Computes the distance between two vectors.

Min

Returns the vector witch made from the largest components of two vectors.

Max

Returns the vector witch made from the smallest components of two vectors.

Ceil

Ceil each component of given Vector3f and returns result in Vector3i.

Floor

Floor each component of given Vector3f and returns result in Vector3i.

Round

Round each component of given Vector3f and returns result in Vector3i.

Scale

Scales two vectors component-wise. This is the same as operator* a * b.

Operators

operator +(Vector3i v, Vector3i o)

Adds this Vector3i to another.

operator +(Vector3i v, float scalar)

Adds each component of Vector3i by scalar.

operator +(Vector3i v, Vector2i o)

Vector2i to this Vector3i.

operator -(Vector3i v, Vector3i o)

Subtract this Vector3i from another.

operator -(Vector3i v, float scalar)

Subtract scalar from each Vector3i component.

Vector4 operator -(Vector3i v, Vector2i o)

Subtract Vector2i from this Vector3i.

operator *(Vector3i v, Vector3i o)

Multiply Vector3i with another Vector3i .

operator *(Vector3i m, float scalar)

Multiply scalar by each Vector3i component.

operator *(Vector3i v, Vector3i o)

Multiply Vector3f by this Vector3i .

operator /(Vector3i v, Vector3i o)

Divide this Vector3i another Vector3i.

operator /(Vector3i v, float scalar)

Divide scalar value from this vector.

operator /(Vector3i v, Vector2i o)

Divide this Vector3i by Vector2i.

explicit operator Vector2i(Vector3i v)

Converts a Vector3i to Vector2i.

explicit operator Vector3f(Vector3i v)

Converts a Vector3i to Vector3f.

See Also

Matrix4, Vector4, Vector3

Last updated