-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathCalcVector3.py
More file actions
32 lines (24 loc) · 731 Bytes
/
CalcVector3.py
File metadata and controls
32 lines (24 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from pxr import Gf
# float vector.
print("\nfloat vector ----\n")
v1 = Gf.Vec3f(1.0, 2.0, -5.0)
v2 = Gf.Vec3f(2.5, 14.0, 12.0)
v = v1 + v2
print(f"{v1} + {v2} = {v}")
v = v1 / 2
print(f"{v1} / 2 = {v}")
print(f"v.x = {v[0]} type = {type(v[0])}")
print(f"v.y = {v[1]} type = {type(v[1])}")
print(f"v.z = {v[2]} type = {type(v[2])}")
# double vector.
# It seems to be internally converted to Gf.Vec3f.
print("\ndouble vector ----\n")
v1d = Gf.Vec3d(1.0, 2.0, -5.0)
v2d = Gf.Vec3d(2.5, 14.0, 12.0)
v = v1d + v2d
print(f"v.x = {v1d[0]} type = {type(v1d[0])}")
v = v1d / 2
print(f"{v1d} / 2 = {v}")
print(f"v.x = {v[0]} type = {type(v[0])}")
print(f"v.y = {v[1]} type = {type(v[1])}")
print(f"v.z = {v[2]} type = {type(v[2])}")