Example
Vector3 este un vector cu precizie dublă, cu 3 componente cu x, y, și z componente. Este utilizat în tot Aspose.3D pentru poziții, direcții, normale și valori de scară. Toate operațiile aritmetice returnează noi Vector3 instanțe; originalul nu este modificat.
Example
| Example | Example |
|---|
Vector3() | Construiește vectorul zero (0, 0, 0) |
Vector3(double x, double y, double z) | Construiește din trei componente |
Vector3(Vector3 other) | Constructor de copiere |
Câmpuri publice
Vector3 folosește câmpuri publice pentru accesarea componentelor (nu metode getter/setter):
| Example | Example | Example | Example |
|---|
x | double | v.x | componenta X |
y | double | v.y | Componenta Y |
z | double | v.z | Componenta Z |
Proprietăți calculate
| Example | Example | Example | Example |
|---|
length | double | getLength() | Lungimea euclidiană (sqrt(x^2+y^2+z^2)), numai pentru citire |
length2 | double | getLength2() | Lungime pătratică, numai pentru citire; mai ieftină decât getLength() când este necesară doar compararea |
Câmpuri statice
| Example | Example | Example |
|---|
ZERO | Vector3 | Vector3(0, 0, 0) |
ONE | Vector3 | Vector3(1, 1, 1) |
UNIT_X | Vector3 | Vector3(1, 0, 0) |
UNIT_Y | Vector3 | Vector3(0, 1, 0) |
UNIT_Z | Vector3 | Vector3(0, 0, 1) |
Example
| Example | Tip de returnare | Example |
|---|
set(double x, double y, double z) | void | Setează toate cele trei componente la loc |
dot(Vector3 rhs) | double | Produs scalar cu altul Vector3 |
cross(Vector3 rhs) | Vector3 | Produs vectorial – returnează un vector perpendicular pe ambele operanzi |
normalize() | Vector3 | Returnează o copie cu lungime unitate; returnează vectorul zero dacă lungimea este zero |
angleBetween(Vector3 dir) | double | Unghi în radiani între acest vector și dir |
angleBetween(Vector3 dir, Vector3 up) | double | Unghi semnat în radiani proiectat pe planul definit de up |
sin() | Vector3 | Sinus pe componentă |
cos() | Vector3 | Cosinus pe componentă |
compareTo(Vector3 other) | int | Comparare lexicografică: returnează -1, 0 sau 1 |
Vector3.parse(String s) | Vector3 | Static. Analizează "x y z" reprezentare șir |
Example
Vezi și