Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Vector3: Difference between revisions

From FiguraMC
Redirected page to Vectors and Matrices
Tag: New redirect
 
PenguinEncounter (talk | contribs)
Create Vector3 page
Tags: Removed redirect 2017 source edit
Line 1: Line 1:
#REDIRECT [[Vectors and Matrices]]
{{Hatnote|For general information on vectors, see [[Vector]] and [[Vectors and Matrices]].}}
 
A '''Vector3''' is a [[vector]] that contains 3 numbers.
 
== Methods ==
{| class="wikitable"
! Method !! Brief description
{{:Vector/MethodIndex|T=Vector3|M=Matrix3|Size=3}}
|-
| [[#augmented|augmented]] || Convert this vector into a {{type|Vector4}} by appending a number.
|-
| [[#cross|cross]] ''in-place'' || Calculate the cross product of two vectors.
|-
| [[#crossed|crossed]] || Calculate the cross product of two vectors.
|}
 
== Fields ==
{| class="wikitable"
! Field !! Brief description
{{:Vector/FieldIndex}}
|-
| [[#field_x|x]], [[#field_r|r]], <code>[1]</code> || First component.
|-
| [[#field_y|y]], [[#field_g|g]], <code>[2]</code> || Second component.
|-
| [[#field_z|z]], [[#field_b|b]], <code>[3]</code> || Third component.
|}
 
== Operators ==
{| class="wikitable"
! Operator !! Brief description
{{:Vector/OperatorIndex|T=Vector3|M=Matrix3|Size=3}}
|}
 
== Methods ==
{{:Vector/Methods|T=Vector3|M=Matrix3|Size=3}}
 
=== Vector3 methods ===
==== augmented ====
----
 
Converts this Vector3 into a {{type|Vector4}} using the provided number as the fourth component.
 
{| class="wikitable"
! Arguments !! Return Type
|-
| <code>augmented({{type|number}} d)</code>
| {{type|Vector4}}
|}
 
==== cross ====
----
 
Calculates the [[wikipedia:Cross product|Cross product]] between two Vector3s and stores the result in this vector.
 
{| class="wikitable"
! Arguments !! Return Type
|-
| <code>cross({{type|Vector3}} other)</code>
| self {{type|Vector3}}
|}
 
==== crossed ====
----
 
Calculates the [[wikipedia:Cross product|Cross product]] between two Vector3s and creates a new Vector3 to store the result.
 
{| class="wikitable"
! Arguments !! Return Type
|-
| <code>crossed({{type|Vector3}} other)</code>
| new {{type|Vector3}}
|}
 
== Fields ==
{{:Vector/Fields|T=Vector3|M=Matrix3|Size=3}}
 
=== Vector4 fields ===
==== x, r, 1 <span id="field_x"></span><span id="field_r"></span> ====
----
Read/write {{type|number}}. The first component of the vector.
 
==== y, g, 2 <span id="field_y"></span><span id="field_g"></span> ====
----
Read/write {{type|number}}. The second component of the vector.
 
==== z, b, 3 <span id="field_z"></span><span id="field_b"></span> ====
----
Read/write {{type|number}}. The third component of the vector.
 
== Operators ==
{{:Vector/Operators|T=Vector3|M=Matrix3|Size=3}}

Revision as of 04:50, 29 October 2024

For general information on vectors, see Vector and Vectors and Matrices.

A Vector3 is a vector that contains 3 numbers.

Methods

Method Brief description

Vector/MethodIndex

augmented Convert this vector into a Vector4 by appending a number.
cross in-place Calculate the cross product of two vectors.
crossed Calculate the cross product of two vectors.

Fields

Field Brief description

Vector/FieldIndex

x, r, [1] First component.
y, g, [2] Second component.
z, b, [3] Third component.

Operators

Operator Brief description

Vector/OperatorIndex

Methods

Vector/Methods

Vector3 methods

augmented


Converts this Vector3 into a Vector4 using the provided number as the fourth component.

Arguments Return Type
augmented(number d) Vector4

cross


Calculates the Cross product between two Vector3s and stores the result in this vector.

Arguments Return Type
cross(Vector3 other) self Vector3

crossed


Calculates the Cross product between two Vector3s and creates a new Vector3 to store the result.

Arguments Return Type
crossed(Vector3 other) new Vector3

Fields

Vector/Fields

Vector4 fields

x, r, 1


Read/write number. The first component of the vector.

y, g, 2


Read/write number. The second component of the vector.

z, b, 3


Read/write number. The third component of the vector.

Operators

Vector/Operators