当前位置: 首页>>代码示例>>Python>>正文


Python Vector.resized方法代码示例

本文整理汇总了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
开发者ID:randfb,项目名称:pyslapi,代码行数:33,代码来源:__init__.py

示例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
开发者ID:bdon,项目名称:pyslapi,代码行数:25,代码来源:__init__.py


注:本文中的mathutils.Vector.resized方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。