FVector3, FVector4 — Aspose.3D FOSS for Java
Paket: com.aspose.threed (aspose-3d-foss 26.1.0)
Example FVector familjen tillhandahåller enkelprecision (float) alternativ till dubbelprecision Vector typer. De används internt av vertex-elementdatavektorer för kompakt lagring av normaler, tangenter och UV-koordinater.
Obs: FVector2 gör inte existera i Java-utgåvan. Endast FVector3 och FVector4 är tillgängliga.
FVector3
Enkelprecisions 3-komponents flyttalsvektor. Förekommer i vertex-elementdatamatriser för normaler och tangenter.
Example
| Example | Example |
|---|---|
FVector3() | Example (0, 0, 0) |
FVector3(float x, float y, float z) | Konstruktioner från tre komponenter |
FVector3(Vector3 v) | Konstruktioner från dubbelprecision Vector3 |
Publika fält
FVector3 använder publika fält för komponentåtkomst:
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | X komponent |
y | float | v.y | Y komponent |
z | float | v.z | Z komponent |
Example
| Example | Returtyp | Example |
|---|---|---|
normalize() | FVector3 | Returnerar en kopia med enhetslängd |
cross(FVector3 rhs) | FVector3 | Korsprodukt |
dot(FVector3 rhs) | float | Skalarprodukt |
FVector4
Enkelprecision 4-komponents flyttalsvektor. Lagringstypen för VertexElementFVector data.
Example
| Example | Example |
|---|---|
FVector4() | Example (0, 0, 0, 0) |
FVector4(float x, float y, float z, float w) | Skapar från fyra komponenter |
FVector4(Vector4 v) | Skapar från dubbelprecision Vector4 |
Publika fält
FVector4 använder publika fält för komponentåtkomst:
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | X-komponent |
y | float | v.y | Y-komponent |
z | float | v.z | Z-komponent |
w | float | v.w | W-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