Vector3

Methods

Vector3 çift duyarlıklı 3 bileşenli bir vektördür x, y, ve z bileşenler. Aspose.3D içinde konumlar, yönler, normaller ve ölçek değerleri için yaygın olarak kullanılır. Tüm aritmetik işlemler yeni Vector3 örnekler döndürür; orijinali değiştirilmez.

from aspose.threed.utilities import Vector3

# Construct from components
v = Vector3(1.0, 2.0, 3.0)

# Copy constructor
v2 = Vector3(v)

# Default (zero vector)
zero = Vector3()

Methods

MethodsMethods
Vector3()Sıfır vektörünü oluşturur (0, 0, 0)
Vector3(x, y, z)Üçünden oluşturur float bileşen
Vector3(other)Kopya yapıcı — başka bir Vector3

Methods

Tüm bileşenler okunabilir ve yazılabilir özelliklerdir; parantez kullanmadan erişin.

MethodsMethodsMethods
xfloatX bileşeni
yfloatY bileşeni
zfloatZ bileşeni
lengthfloatÖklidyen uzunluk (sqrt(x²+y²+z²)), yalnızca okunur
length2floatKaresel uzunluk (x²+y²+z²), yalnızca okunur; daha ucuz length sadece karşılaştırma gerektiğinde
zeroVector3Methods Vector3(0, 0, 0)
oneVector3Methods Vector3(1, 1, 1)
unit_xVector3Methods Vector3(1, 0, 0)
unit_yVector3Methods Vector3(0, 1, 0)
unit_zVector3Methods Vector3(0, 0, 1)

Methods

MethodsDönüş TipiMethods
set(x, y, z)NoneÜç bileşeni yerinde ayarlar
dot(rhs)floatBaşka birine nokta çarpımı Vector3
cross(rhs)Vector3Çapraz çarpım — iki operandın her ikisine de dik bir vektör döndürür
normalize()Vector3Birim uzunluklu bir kopya döndürür; uzunluk sıfır ise sıfır vektör döndürür
angle_between(dir)floatBu vektör ile arasındaki açı (radyan cinsinden) dir
angle_between(dir, up)floatTanımlanan düzleme göre projekte edilen işaretli açı (radyan cinsinden) up
sin()Vector3Bileşen bazlı sinüs
cos()Vector3Bileşen bazlı kosinüs
compare_to(other)intSözlük sıralamasına göre karşılaştırma: −1, 0 veya 1 döndürür
Vector3.parse(s)Vector3Statik. Ayrıştırır "x y z" dize temsili

İndeks Erişimi

Bileşenlere tam sayı indeksiyle erişilebilir: v[0] → x, v[1] → y, v[2] → z.

Methods

from aspose.threed.utilities import Vector3

# Basic arithmetic (standard Python operators are supported)
a = Vector3(1.0, 0.0, 0.0)
b = Vector3(0.0, 1.0, 0.0)

# Dot and cross products
dot = a.dot(b)           # 0.0
perp = a.cross(b)        # Vector3(0, 0, 1)

# Normalize
direction = Vector3(3.0, 4.0, 0.0)
unit = direction.normalize()   # Vector3(0.6, 0.8, 0.0)
print(unit.length)             # 1.0

# Angle between vectors
import math
angle = a.angle_between(b)
print(math.degrees(angle))    # 90.0

# Use with a scene node transform
from aspose.threed import Scene
scene = Scene()
node = scene.root_node.create_child_node("box")
node.transform.translation = Vector3(10.0, 0.0, 0.0)

Ayrıca Bakınız

 Türkçe