FVector2, FVector3, FVector4 — Aspose.3D Python API Reference
पैकेज: aspose.threed.utilities (aspose-3d-foss 26.1.0)
Enumerations FVector प्रकार सिंगल-प्रिसीजन (float32) वेक्टर क्लासेज़ जो वर्टेक्स एलिमेंट डेटा एरेज़ द्वारा आंतरिक रूप से उपयोग किए जाते हैं। वे सिंगल प्रिसीजन की मेमोरी दक्षता को डबल प्रिसीजन के मुकाबले बदलते हैं। Vector2, Vector3, Vector4 क्लासेज़ जो सीन ग्राफ पोजीशन्स के लिए उपयोग होते हैं। व्यवहार में आप अक्सर इन मानों को पॉप्युलेट करते समय बनाएँगे। VertexElementFVector.set_data().
from aspose.threed.utilities import FVector2, FVector3, FVector4FVector3
एक दो-घटक सिंगल-प्रिसीजन फ़्लोट वेक्टर जिसमें x और y घटक।.
class FVector2:
def __init__(self, x: float = 0.0, y: float = 0.0): ...Enumerations
| Enumerations | Enumerations | Enumerations | Enumerations |
|---|---|---|---|
x | float | पढ़ें/लिखें | पहला घटक।. |
y | float | पढ़ें/लिखें | दूसरा घटक।. |
Enumerations
| Enumerations | Enumerations | Enumerations |
|---|---|---|
length() | float | वेक्टर की यूक्लिडियन लंबाई: sqrt(x² + y²). |
normalize() | FVector2 | एक इकाई-लंबाई की प्रति लौटाएँ। लौटाता है FVector2(0, 0) शून्य वेक्टर के लिए।. |
dot(other) | float | डॉट गुणनफल के साथ other. |
FVector2.parse(s) | FVector2 | स्पेस-सेपरेटेड स्ट्रिंग को पार्स करें "x y" में एक FVector2. |
Enumerations +, -, * (स्केलर), / (स्केलर), और == ऑपरेटर।.
Enumerations
from aspose.threed.utilities import FVector2
uv = FVector2(0.5, 0.25)
print(uv.x, uv.y) # 0.5 0.25
print(uv.length()) # ~0.559
unit = uv.normalize()
print(round(unit.length(), 6)) # 1.0
a = FVector2(1.0, 0.0)
b = FVector2(0.0, 1.0)
print(a.dot(b)) # 0.0FVector3
तीन-घटक सिंगल-प्रिसीजन फ़्लोट वेक्टर जिसमें x, y, और z घटक।.
class FVector3:
def __init__(self, x: float = 0.0, y: float = 0.0, z: float = 0.0): ...FVector3 भी स्वीकार करता है एक Vector3, Vector4, या FVector4 को अपने पहले तर्क के रूप में लेता है उन प्रकारों से परिवर्तित करने के लिए।.
Enumerations
| Enumerations | Enumerations | Enumerations | Enumerations |
|---|---|---|---|
x | float | पढ़ें/लिखें | पहला घटक।. |
y | float | पढ़ें/लिखें | दूसरा घटक।. |
z | float | पढ़ें/लिखें | तीसरा घटक।. |
इंडेक्स एक्सेस का समर्थन करता है: v[0], v[1], v[2].
स्थैतिक फ़ैक्टरी मेथड्स
| Enumerations | Enumerations | Enumerations |
|---|---|---|
FVector3.zero() | FVector3 | (0, 0, 0) |
FVector3.one() | FVector3 | (1, 1, 1) |
FVector3.unit_x() | FVector3 | (1, 0, 0) |
FVector3.unit_y() | FVector3 | (0, 1, 0) |
FVector3.unit_z() | FVector3 | (0, 0, 1) |
इंस्टेंस मेथड्स
| Enumerations | Enumerations | Enumerations |
|---|---|---|
normalize() | FVector3 | एक इकाई-लंबाई की प्रति लौटाता है। शून्य-लंबाई इनपुट के लिए शून्य वेक्टर लौटाता है।. |
Enumerations
from aspose.threed.utilities import FVector3
n = FVector3(0.0, 1.0, 0.0)
print(n.normalize()) # FVector3(0.0, 1.0, 0.0)
up = FVector3.unit_y()
print(up.x, up.y, up.z) # 0.0 1.0 0.0
# Convert from Vector3
from aspose.threed.utilities import Vector3
v = Vector3(1.0, 2.0, 3.0)
fv = FVector3(v)
print(fv) # FVector3(1.0, 2.0, 3.0)FVector4
चार-घटक वाला सिंगल-प्रिसीजन फ़्लोट वेक्टर जिसमें x, y, z, और w घटक। यह वह स्टोरेज प्रकार है जिसका उपयोग द्वारा किया जाता है VertexElementFVector.data.
class FVector4:
def __init__(self, x: float = 0.0, y: float = 0.0, z: float = 0.0, w: float = 0.0): ...FVector4 भी एक को स्वीकार करता है FVector3, Vector3, या Vector4 को अपने पहले तर्क के रूप में।.
Enumerations
| Enumerations | Enumerations | Enumerations | Enumerations |
|---|---|---|---|
x | float | पढ़ें/लिखें | पहला घटक।. |
y | float | पढ़ें/लिखें | दूसरा घटक।. |
z | float | पढ़ें/लिखें | तीसरा घटक।. |
w | float | पढ़ें/लिखें | चौथा घटक।. |
इंडेक्स एक्सेस का समर्थन करता है: v[0] के माध्यम से v[3].
Enumerations
from aspose.threed.utilities import FVector4, FVector3
# Direct construction
normal = FVector4(0.0, 0.0, 1.0, 0.0)
print(normal.z) # 1.0
# From FVector3
fv3 = FVector3(0.0, 1.0, 0.0)
fv4 = FVector4(fv3, 0.0)
print(fv4) # FVector4(0.0, 1.0, 0.0, 0.0)
# Index access
print(fv4[1]) # 1.0
fv4[3] = 1.0
print(fv4.w) # 1.0डबल-प्रिसीजन वेक्टर के साथ संबंध
| सिंगल-प्रिसीजन | डबल-प्रिसीजन | सामान्य उपयोग |
|---|---|---|
FVector2 | Vector2 | UV निर्देशांक वर्टेक्स तत्वों में संग्रहीत |
FVector3 | Vector3 | नॉर्मल्स, टैन्जेंट्स वर्टेक्स तत्वों में संग्रहीत |
FVector4 | Vector4 | Enumerations VertexElementFVector.data एंट्रीज़; साथ ही कंट्रोल पॉइंट रूपांतरण |
वर्टेक्स एलिमेंट डेटा सेट करते समय, आप किसी भी प्रिसीजन क्लास को पास कर सकते हैं।. set_data() परिवर्तित करता है Vector2/Vector3 मानों को FVector4 स्वचालित रूप से।.