FVector3 / FVector4

FVector3, FVector4 — Aspose.3D FOSS for Java

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

Example FVector šeima suteikia viengubo tikslumo (float) alternatyvas dvigubo tikslumo Vector tipų. Jos naudojamos viduje viršūnių elementų duomenų masyvuose, kad būtų kompaktiškai saugomi normalės, tangentai ir UV koordinatės.

Pastaba: FVector2 ne egzistuoja Java leidime. Tik FVector3 ir FVector4 yra prieinami.


FVector3

Viengubo tikslumo 3 komponentų slankaus kablelio vektorius. Pasirodo viršūnių elementų duomenų masyvuose normalių ir tangentų saugojimui.

Example

ExampleExample
FVector3()Example (0, 0, 0)
FVector3(float x, float y, float z)Konstrukcijos iš trijų komponentų
FVector3(Vector3 v)Konstrukcijos iš dvigubo tikslumo Vector3

Vieši laukai

FVector3 naudoja vieši laukai komponentų prieigai:

ExampleExampleExampleExample
xfloatv.xX komponentas
yfloatv.yY komponentas
zfloatv.zZ komponentas

Example

ExampleGrąžinimo tipasExample
normalize()FVector3Grąžina vienetinio ilgio kopiją
cross(FVector3 rhs)FVector3Kryžminis sandauga
dot(FVector3 rhs)floatSkaliarinė sandauga

FVector4

Viengubo tikslumo 4 komponentų slankaus kablelio vektorius. Saugojimo tipas VertexElementFVector duomenys.

Example

ExampleExample
FVector4()Example (0, 0, 0, 0)
FVector4(float x, float y, float z, float w)Konstrukcijos iš keturių komponentų
FVector4(Vector4 v)Konstrukcijos iš dvigubo tikslumo Vector4

Vieši laukai

FVector4 naudoja vieši laukai komponentų prieigai:

ExampleExampleExampleExample
xfloatv.xX komponentas
yfloatv.yY komponentas
zfloatv.zZ komponentas
wfloatv.wW komponentas

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

Žr. taip pat

 Lietuvių