FVector3, FVector4 — Aspose.3D FOSS for Java
แพคเกจ: com.aspose.threed (aspose-3d-foss 26.1.0)
Example FVector family ให้ประเภทความแม่นยำ single-precision (float) ทางเลือกสำหรับ double-precision Vector types. พวกมันถูกใช้ภายในโดยอาร์เรย์ข้อมูลองค์ประกอบเวอร์เท็กซ์เพื่อการจัดเก็บที่กะทัดรัดของ normals, tangents, และพิกัด UV.
หมายเหตุ: FVector2 ทำ ไม่มี ในรุ่น Java เท่านั้น FVector3 และ FVector4 พร้อมใช้งาน.
FVector3
เวกเตอร์ float 3 ส่วนประกอบแบบ single-precision ปรากฏในอาเรย์ข้อมูลองค์ประกอบเวอร์เท็กซ์สำหรับ normals และ tangents.
Example
| Example | Example |
|---|---|
FVector3() | Example (0, 0, 0) |
FVector3(float x, float y, float z) | สร้างจากสามส่วนประกอบ |
FVector3(Vector3 v) | สร้างจาก double-precision Vector3 |
ฟิลด์สาธารณะ
FVector3 ใช้ ฟิลด์สาธารณะ สำหรับการเข้าถึงส่วนประกอบ:
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | ส่วนประกอบ X |
y | float | v.y | ส่วนประกอบ Y |
z | float | v.z | ส่วนประกอบ Z |
Example
| Example | ประเภทการคืนค่า | Example |
|---|---|---|
normalize() | FVector3 | คืนสำเนาที่มีความยาวเป็นหน่วย |
cross(FVector3 rhs) | FVector3 | ผลคูณเชิงขวาง |
dot(FVector3 rhs) | float | ผลคูณจุด |
FVector4
เวกเตอร์ float 4 ส่วนประกอบแบบความแม่นยำเดี่ยว. ประเภทการจัดเก็บของ VertexElementFVector ข้อมูล.
Example
| Example | Example |
|---|---|
FVector4() | Example (0, 0, 0, 0) |
FVector4(float x, float y, float z, float w) | สร้างจากส่วนประกอบสี่ส่วน |
FVector4(Vector4 v) | สร้างจากความแม่นยำแบบคู่ Vector4 |
ฟิลด์สาธารณะ
FVector4 ใช้ ฟิลด์สาธารณะ สำหรับการเข้าถึงคอมโพเนนต์:
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | คอมโพเนนต์ X |
y | float | v.y | คอมโพเนนต์ Y |
z | float | v.z | คอมโพเนนต์ Z |
w | float | v.w | คอมโพเนนต์ 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