FVector3 / FVector4

FVector3, FVector4 — Aspose.3D FOSS for Java

Pachet: com.aspose.threed (aspose-3d-foss 26.1.0)

Example FVector familia oferă precizie simplă (float) alternative la precizia dublă Vector tipuri. Ele sunt utilizate intern de către matricile de date ale elementelor de vârf pentru stocarea compactă a normalelor, tangenților și coordonatelor UV.

Notă: FVector2 nu există în ediția Java. Doar FVector3 și FVector4 sunt disponibile.


FVector3

Vector float cu precizie simplă, cu 3 componente. Apare în matricile de date ale elementelor de vârf pentru normale și tangente.

Example

ExampleExample
FVector3()Example (0, 0, 0)
FVector3(float x, float y, float z)Construit din trei componente
FVector3(Vector3 v)Construit din precizie dublă Vector3

Câmpuri publice

FVector3 utilizează câmpuri publice pentru acces la componente:

ExampleExampleExampleExample
xfloatv.xComponenta X
yfloatv.yComponenta Y
zfloatv.zComponenta Z

Example

ExampleTip de returnareExample
normalize()FVector3Returnează o copie de lungime unitate
cross(FVector3 rhs)FVector3Produs vectorial
dot(FVector3 rhs)floatProdus scalar

FVector4

Vector float cu 4 componente, precizie simplă. Tipul de stocare al VertexElementFVector datele.

Example

ExampleExample
FVector4()Example (0, 0, 0, 0)
FVector4(float x, float y, float z, float w)Construiește din patru componente
FVector4(Vector4 v)Construiește dintr‑o precizie dublă Vector4

Câmpuri publice

FVector4 utilizări câmpuri publice pentru accesul la componentă:

ExampleExampleExampleExample
xfloatv.xcomponenta X
yfloatv.ycomponenta Y
zfloatv.zcomponenta Z
wfloatv.wcomponenta W

Example

import com.aspose.threed.*;

// Create from components
FVector3 normal = new FVector3(0.0f, 1.0f, 0.0f);

// Convert from double-precision
Vector3 dir = new Vector3(3.0, 4.0, 0.0);
FVector3 fDir = new FVector3(dir);

// Normalize
FVector3 unit = fDir.normalize();
System.out.println(unit.x);   // 0.6f
System.out.println(unit.y);   // 0.8f

Vezi și

 Română