java.lang.Object
dev.aurumbyte.sypherengine.math.Vector2
The Vector2 class of SypherEngine, the base of all position
- Since:
- 0.3.0
- Author:
- AurumByte
- 
Field SummaryFieldsModifier and TypeFieldDescription(package private) floatThe rotation of the vectorfloatThe xPos and yPos (in float)intThe integer position of xPos and yPos, for people who are too lazy to cast to int XDfloatThe xPos and yPos (in float)intThe integer position of xPos and yPos, for people who are too lazy to cast to int XD
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdds a Vector2 with another Vector2static doubleCalculates the distance between two vectorsvoidDivides a Vector2 with another Vector2Gets the vector positionfloatGets the rotation of the VectorvoidMultiplies a Vector2 with another Vector2voidNormalizes the Vectorvoidrotate(float rotation) Rotates the VectorvoidsetPosition(float xPos, float yPos) Set the Vector's positionvoidSubtracts a Vector2 with another Vector2
- 
Field Details- 
xPosipublic int xPosiThe integer position of xPos and yPos, for people who are too lazy to cast to int XD
- 
yPosipublic int yPosiThe integer position of xPos and yPos, for people who are too lazy to cast to int XD
- 
xPospublic float xPosThe xPos and yPos (in float)
- 
yPospublic float yPosThe xPos and yPos (in float)
- 
rotationfloat rotationThe rotation of the vector
 
- 
- 
Constructor Details- 
Vector2public Vector2()Create an empty Vector of coords (0, 0) - Since:
- 0.3.0
 
- 
Vector2public Vector2(float x, float y) Creates a Vector2 instance with x and y position - Parameters:
- x- x position
- y- y position
- Since:
- 0.3.0
 
- 
Vector2public Vector2(float x, float y, float rotation) Creates a Vector2 instance with a specified position and rotation - Parameters:
- x- x position
- y- y position
- rotation- rotation of the vector
- Since:
- 0.3.0
 
 
- 
- 
Method Details- 
addAdds a Vector2 with another Vector2 - Parameters:
- vector2- The other Vector
- Since:
- 0.3.0
 
- 
subtractSubtracts a Vector2 with another Vector2 - Parameters:
- vector2- The other Vector
- Since:
- 0.3.0
 
- 
multiplyMultiplies a Vector2 with another Vector2 - Parameters:
- vector2- The other Vector
- Since:
- 0.3.0
 
- 
divideDivides a Vector2 with another Vector2 - Parameters:
- vector2- The other Vector
- Since:
- 0.3.0
 
- 
rotatepublic void rotate(float rotation) Rotates the Vector - Parameters:
- rotation- The amount of rotation needed for the vector
- Since:
- 0.3.0
 
- 
setPositionpublic void setPosition(float xPos, float yPos) Set the Vector's position - Parameters:
- xPos- The x position
- yPos- The y position
- Since:
- 0.3.0
 
- 
getPositionGets the vector position - Since:
- 0.3.0
 
- 
getRotationpublic float getRotation()Gets the rotation of the Vector - Since:
- 0.3.0
 
- 
normalizepublic void normalize()Normalizes the Vector - Since:
- v0.3.0
 
- 
distanceCalculates the distance between two vectors - Parameters:
- a- A Vector
- b- Another vector
 
 
-