FVector3, FVector4 — Aspose.3D FOSS for Java
חבילה: com.aspose.threed (aspose-3d-foss 26.1.0)
Example FVector המשפחה מספקת single-precision (float) אלטרנטיבות ל-double-precision Vector סוגים. הם משמשים פנימית במערכי נתוני רכיבי קודקוד לאחסון קומפקטי של נורמליים, טנגנטים וקואורדינטות UV.
הערה: FVector2 אינו קיים במהדורת Java. רק FVector3 ו FVector4 זמינים.
FVector3
וקטור float בת שלושה רכיבים ברמת דיוק יחיד. מופיע במערכי נתוני רכיבי קודקוד לנורמליות ולטנגנטים.
Example
| Example | Example |
|---|---|
FVector3() | Example (0, 0, 0) |
FVector3(float x, float y, float z) | מבנים משלושה רכיבים |
FVector3(Vector3 v) | מבנים מדו-דיוק 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
Single-precision וקטור צף של 4 רכיבים. סוג האחסון של VertexElementFVector נתונים.
Example
| Example | Example |
|---|---|
FVector4() | Example (0, 0, 0, 0) |
FVector4(float x, float y, float z, float w) | בונה מארבעה רכיבים |
FVector4(Vector4 v) | בונה מ‑double-precision 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