Skip to content

thaliumFr/Vector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Vector

Recreation of Unity's Vectors structs in python. Can be used for maths, physic, simulations, games...

it's composed of 2 main classes:

  • Vector2 (2D)
  • Vector3 (3D)

Might not be 100% accurate, this is still in devloppment.
Feel free to open issue request if you find bugs.

Vector 2

Representation of 2D vectors and points. https://docs.unity3d.com/ScriptReference/Vector2.html

Constructor

Vector2(x, y)

x -> float
y -> float

Properties

magnitude

Returns the length/intensity/norm of this vector (Read Only)
-> float

x

X Component of the vector
-> float | int | bytes

y

Y Component of the vector
-> float | int | bytes

Static Properties

down

Vector2(0, -1)

left

Vector2(-1, 0)

one

Vector2(1, 1)

right

Vector2(1, 0)

up

Vector2(0, 1)

zero

Vector2(0, 0)

Static Methods

Angle(va, vb)

Calculates the lowest angle between va and vb in degrees
va -> Vector2
vb -> Vector2
--> float

Distance(va, vb)

Calculates the distance between va and vb
va -> Vector2
vb -> Vector2
--> float

Lerp(va, vb, t)

Lerp between vector A and vector B
va -> Vector2
vb -> Vector2
t -> float clamped between 0 and 1
--> Vector2

Vector3

Representation of 3D vectors and points. https://docs.unity3d.com/ScriptReference/Vector3.html

Constructor

Vector3(x, y, z)

x -> float
y -> float
z -> float

Properties

magnitude

Returns the length (norm) of this vector (Read Only)
--> float

x

X Component of the vector
-> float | int | bytes

y

Y Component of the vector
-> float | int | bytes

z

Z Component of the vector
-> float | int | bytes

Static Properties

back

Vector3(0, 0, -1)

down

Vector3(0, -1, 0)

forward

Vector3(0, 0, 1)

left

Vector3(-1, 0, 0)

one

Vector3(1, 1, 1)

right

Vector3(1, 0, 0)

up

Vector3(0, 1, 0)

zero

Vector3(0, 0, 0)

Static Methods

Angle(va, vb)

Calculates the lowest angle between va and vb in degrees
va -> Vector3
vb -> Vector3
--> float

Distance(va, vb)

Calculates the distance between va and vb
va -> Vector3
vb -> Vector3
--> float

Lerp(va, vb, t)

Lerp between vector A and vector B
va -> Vector3
vb -> Vector3
t -> float clamped between 0 and 1
--> Vector3

Dot(va, vb)

return the dot product of va.vb
--> float

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages