PyDoc: use complete sentences in comments for templates & examples
This commit is contained in:
@@ -1,27 +1,27 @@
|
||||
import mathutils
|
||||
import math
|
||||
|
||||
# a new rotation 90 degrees about the Y axis
|
||||
# A new rotation 90 degrees about the Y axis.
|
||||
quat_a = mathutils.Quaternion((0.7071068, 0.0, 0.7071068, 0.0))
|
||||
|
||||
# passing values to Quaternion's directly can be confusing so axis, angle
|
||||
# is supported for initializing too
|
||||
# Passing values to Quaternion's directly can be confusing so axis, angle
|
||||
# is supported for initializing too.
|
||||
quat_b = mathutils.Quaternion((0.0, 1.0, 0.0), math.radians(90.0))
|
||||
|
||||
print("Check quaternions match", quat_a == quat_b)
|
||||
|
||||
# like matrices, quaternions can be multiplied to accumulate rotational values
|
||||
# Like matrices, quaternions can be multiplied to accumulate rotational values.
|
||||
quat_a = mathutils.Quaternion((0.0, 1.0, 0.0), math.radians(90.0))
|
||||
quat_b = mathutils.Quaternion((0.0, 0.0, 1.0), math.radians(45.0))
|
||||
quat_out = quat_a @ quat_b
|
||||
|
||||
# print the quat, euler degrees for mere mortals and (axis, angle)
|
||||
# Print the quaternion, euler degrees for mere mortals and (axis, angle).
|
||||
print("Final Rotation:")
|
||||
print(quat_out)
|
||||
print("{:.2f}, {:.2f}, {:.2f}".format(*(math.degrees(a) for a in quat_out.to_euler())))
|
||||
print("({:.2f}, {:.2f}, {:.2f}), {:.2f}".format(*quat_out.axis, math.degrees(quat_out.angle)))
|
||||
|
||||
# multiple rotations can be interpolated using the exponential map
|
||||
# Multiple rotations can be interpolated using the exponential map.
|
||||
quat_c = mathutils.Quaternion((1.0, 0.0, 0.0), math.radians(15.0))
|
||||
exp_avg = (quat_a.to_exponential_map() +
|
||||
quat_b.to_exponential_map() +
|
||||
|
||||
Reference in New Issue
Block a user