FVector3 / FVector4

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

ExampleExample
FVector3()Example (0, 0, 0)
FVector3(float x, float y, float z)מבנים משלושה רכיבים
FVector3(Vector3 v)מבנים מדו-דיוק 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

Single-precision וקטור צף של 4 רכיבים. סוג האחסון של VertexElementFVector נתונים.

Example

ExampleExample
FVector4()Example (0, 0, 0, 0)
FVector4(float x, float y, float z, float w)בונה מארבעה רכיבים
FVector4(Vector4 v)בונה מ‑double-precision 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

ראה גם

 עברית