FVector3, FVector4 — Aspose.3D FOSS for Java
Paket: com.aspose.threed (aspose-3d-foss 26.1.0)
Example FVector aile, tek duyarlıklı (float) çift duyarlıklı olanlara alternatifler Vector türler. Bunlar, normal, teğet ve UV koordinatlarının sıkıştırılmış depolanması için köşe öğesi veri dizileri tarafından dahili olarak kullanılır.
Not: FVector2 yapmaz var değil Java sürümünde. Yalnızca FVector3 ve FVector4 mevcuttur.
FVector3
Tek duyarlıklı 3 bileşenli float vektör. Normal ve teğetler için vertex öğesi veri dizilerinde görülür.
Example
| Example | Example |
|---|---|
FVector3() | Example (0, 0, 0) |
FVector3(float x, float y, float z) | Üç bileşenden oluşan yapılar |
FVector3(Vector3 v) | Çift duyarlıklı birinden oluşan yapılar Vector3 |
Genel Alanlar
FVector3 kullanır public alanlar bileşen erişimi için:
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | X bileşeni |
y | float | v.y | Y bileşeni |
z | float | v.z | Z bileşeni |
Example
| Example | Dönüş Tipi | Example |
|---|---|---|
normalize() | FVector3 | Birim uzunluklu bir kopya döndürür |
cross(FVector3 rhs) | FVector3 | Çapraz çarpım |
dot(FVector3 rhs) | float | Nokta çarpımı |
FVector4
Tek duyarlıklı 4 bileşenli float vektör. Depolama türü VertexElementFVector veri.
Example
| Example | Example |
|---|---|
FVector4() | Example (0, 0, 0, 0) |
FVector4(float x, float y, float z, float w) | Dört bileşenden oluşturur |
FVector4(Vector4 v) | double-precision’dan oluşturur Vector4 |
Genel Alanlar
FVector4 kullanır genel alanlar bileşen erişimi için:
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | X bileşeni |
y | float | v.y | Y bileşeni |
z | float | v.z | Z bileşeni |
w | float | v.w | W bileşeni |
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