FVector3 / FVector4

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

ExampleExample
FVector3()Example (0, 0, 0)
FVector3(float x, float y, float z)สร้างจากสามส่วนประกอบ
FVector3(Vector3 v)สร้างจาก double-precision Vector3

ฟิลด์สาธารณะ

FVector3 ใช้ ฟิลด์สาธารณะ สำหรับการเข้าถึงส่วนประกอบ:

ExampleExampleExampleExample
xfloatv.xส่วนประกอบ X
yfloatv.yส่วนประกอบ Y
zfloatv.zส่วนประกอบ Z

Example

Exampleประเภทการคืนค่าExample
normalize()FVector3คืนสำเนาที่มีความยาวเป็นหน่วย
cross(FVector3 rhs)FVector3ผลคูณเชิงขวาง
dot(FVector3 rhs)floatผลคูณจุด

FVector4

เวกเตอร์ float 4 ส่วนประกอบแบบความแม่นยำเดี่ยว. ประเภทการจัดเก็บของ VertexElementFVector ข้อมูล.

Example

ExampleExample
FVector4()Example (0, 0, 0, 0)
FVector4(float x, float y, float z, float w)สร้างจากส่วนประกอบสี่ส่วน
FVector4(Vector4 v)สร้างจากความแม่นยำแบบคู่ Vector4

ฟิลด์สาธารณะ

FVector4 ใช้ ฟิลด์สาธารณะ สำหรับการเข้าถึงคอมโพเนนต์:

ExampleExampleExampleExample
xfloatv.xคอมโพเนนต์ X
yfloatv.yคอมโพเนนต์ Y
zfloatv.zคอมโพเนนต์ Z
wfloatv.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

ดูเพิ่มเติม

 ภาษาไทย