FVector3 / FVector4

FVector3, FVector4 — Aspose.3D FOSS for Java

Balík: com.aspose.threed (aspose-3d-foss 26.1.0)

Example FVector rodina poskytuje jednopresné (float) alternatívy k dvojitej presnosti Vector typy. Používajú sa interne v poliach dát vrcholových elementov na kompaktné ukladanie normál, tangents a UV coordinates.

Poznámka: FVector2 ne existuje v edícii Java. Iba FVector3 a FVector4 sú k dispozícii.


FVector3

Jednoduchá presnosť 3‑komponentový float vektor. Vyskytuje sa v poliach dát prvkov vrchola pre normály a tangencie.

Example

ExampleExample
FVector3()Example (0, 0, 0)
FVector3(float x, float y, float z)Konštrukcie z troch komponentov
FVector3(Vector3 v)Konštrukcie z dvojitej presnosti Vector3

Verejné polia

FVector3 používa verejné polia pre prístup k komponentom:

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

Example

ExampleNávratový typExample
normalize()FVector3Vráti kópiu s jednotkovou dĺžkou
cross(FVector3 rhs)FVector3Vektorový súčin
dot(FVector3 rhs)floatSkalárny súčin

FVector4

Jednoprecízny 4-komponentový float vektor. Typ úložiska VertexElementFVector dáta.

Example

ExampleExample
FVector4()Example (0, 0, 0, 0)
FVector4(float x, float y, float z, float w)Vytvára zo štyroch komponentov
FVector4(Vector4 v)Vytvára z dvojitej presnosti Vector4

Verejné polia

FVector4 používa verejné polia pre prístup k komponentom:

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

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

Pozri tiež

 Slovenčina