FVector2 / FVector3 / FVector4

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, FVector4

FVector3

एक दो-घटक सिंगल-प्रिसीजन फ़्लोट वेक्टर जिसमें x और y घटक।.

class FVector2:
    def __init__(self, x: float = 0.0, y: float = 0.0): ...

Enumerations

EnumerationsEnumerationsEnumerationsEnumerations
xfloatपढ़ें/लिखेंपहला घटक।.
yfloatपढ़ें/लिखेंदूसरा घटक।.

Enumerations

EnumerationsEnumerationsEnumerations
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.0

FVector3

तीन-घटक सिंगल-प्रिसीजन फ़्लोट वेक्टर जिसमें 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

EnumerationsEnumerationsEnumerationsEnumerations
xfloatपढ़ें/लिखेंपहला घटक।.
yfloatपढ़ें/लिखेंदूसरा घटक।.
zfloatपढ़ें/लिखेंतीसरा घटक।.

इंडेक्स एक्सेस का समर्थन करता है: v[0], v[1], v[2].

स्थैतिक फ़ैक्टरी मेथड्स

EnumerationsEnumerationsEnumerations
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)

इंस्टेंस मेथड्स

EnumerationsEnumerationsEnumerations
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

EnumerationsEnumerationsEnumerationsEnumerations
xfloatपढ़ें/लिखेंपहला घटक।.
yfloatपढ़ें/लिखेंदूसरा घटक।.
zfloatपढ़ें/लिखेंतीसरा घटक।.
wfloatपढ़ें/लिखेंचौथा घटक।.

इंडेक्स एक्सेस का समर्थन करता है: 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

डबल-प्रिसीजन वेक्टर के साथ संबंध

सिंगल-प्रिसीजनडबल-प्रिसीजनसामान्य उपयोग
FVector2Vector2UV निर्देशांक वर्टेक्स तत्वों में संग्रहीत
FVector3Vector3नॉर्मल्स, टैन्जेंट्स वर्टेक्स तत्वों में संग्रहीत
FVector4Vector4Enumerations VertexElementFVector.data एंट्रीज़; साथ ही कंट्रोल पॉइंट रूपांतरण

वर्टेक्स एलिमेंट डेटा सेट करते समय, आप किसी भी प्रिसीजन क्लास को पास कर सकते हैं।. set_data() परिवर्तित करता है Vector2/Vector3 मानों को FVector4 स्वचालित रूप से।.


संबंधित देखें

 हिन्दी