本文整理汇总了Python中mathutils.Vector.resized方法的典型用法代码示例。如果您正苦于以下问题:Python Vector.resized方法的具体用法?Python Vector.resized怎么用?Python Vector.resized使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mathutils.Vector
的用法示例。
在下文中一共展示了Vector.resized方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: write_camera
# 需要导入模块: from mathutils import Vector [as 别名]
# 或者: from mathutils.Vector import resized [as 别名]
def write_camera(self, camera, name="Active Camera"):
pos, target, up = camera.GetOrientation()
bpy.ops.object.add(type='CAMERA', location=pos)
ob = self.context.object
ob.name = name
z = (Vector(pos) - Vector(target))
x = Vector(up).cross(z)
y = z.cross(x)
x.normalize()
y.normalize()
z.normalize()
ob.matrix_world.col[0] = x.resized(4)
ob.matrix_world.col[1] = y.resized(4)
ob.matrix_world.col[2] = z.resized(4)
cam = ob.data
aspect_ratio = camera.aspect_ratio
fov = camera.fov
if aspect_ratio == False: # we seem to be using dynamic / screen aspect ratio
sketchupLog("CAMERA {} uses dynamic / screen aspect ratio ".format(name))
aspect_ratio = self.aspect_ratio
if fov == False:
sketchupLog("CAMERA {} is ortho ".format(name))
cam.type = 'ORTHO'
else:
cam.angle = (pi * fov / 180 ) * aspect_ratio
cam.clip_end = self.prefs.camera_far_plane
cam.name = name
示例2: write_camera
# 需要导入模块: from mathutils import Vector [as 别名]
# 或者: from mathutils.Vector import resized [as 别名]
def write_camera(self, camera, name="Active Camera"):
pos, target, up = camera.GetOrientation()
bpy.ops.object.add(type='CAMERA', location=pos)
ob = self.context.object
ob.name = name
z = (Vector(pos) - Vector(target))
x = Vector(up).cross(z)
y = z.cross(x)
x.normalize()
y.normalize()
z.normalize()
ob.matrix_world.col[0] = x.resized(4)
ob.matrix_world.col[1] = y.resized(4)
ob.matrix_world.col[2] = z.resized(4)
cam = ob.data
aspect_ratio = camera.aspect_ratio if camera.aspect_ratio else self.aspect_ratio
cam.angle = (pi * camera.fov / 180 ) * aspect_ratio
cam.clip_end = self.prefs.camera_far_plane
cam.name = name