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


Python Vector.y方法代码示例

本文整理汇总了Python中mathutils.Vector.y方法的典型用法代码示例。如果您正苦于以下问题:Python Vector.y方法的具体用法?Python Vector.y怎么用?Python Vector.y使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mathutils.Vector的用法示例。


在下文中一共展示了Vector.y方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: calcAlign

# 需要导入模块: from mathutils import Vector [as 别名]
# 或者: from mathutils.Vector import y [as 别名]
    def calcAlign(self, localArea):
        alnVec = Vector([0, 0, 0])
        if len(localArea) == 0:
            return alnVec
        agents = self.sim.agents
        for neighbour in localArea:
            alnVec.x += agents[neighbour].arx
            alnVec.y += agents[neighbour].ary
            alnVec.z += agents[neighbour].arz
        alnVec /= len(localArea)

        alnVec.x -= agents[self.userid].arx
        alnVec.y -= agents[self.userid].ary
        alnVec.z -= agents[self.userid].arz

        alnVec.x %= 2 * math.pi
        alnVec.y %= 2 * math.pi
        alnVec.z %= 2 * math.pi

        if alnVec.x < math.pi:
            alnVec.x = alnVec.x / math.pi
        else:
            alnVec.x = -2 + alnVec.x / math.pi
        if alnVec.y < math.pi:
            alnVec.y = alnVec.y / math.pi
        else:
            alnVec.y = -2 + alnVec.y / math.pi
        if alnVec.z < math.pi:
            alnVec.z = alnVec.z / math.pi
        else:
            alnVec.z = -2 + alnVec.z / math.pi
        return alnVec
开发者ID:sambler,项目名称:myblendercontrib,代码行数:34,代码来源:cm_flockChannels.py

示例2: getBoundsBF

# 需要导入模块: from mathutils import Vector [as 别名]
# 或者: from mathutils.Vector import y [as 别名]
def getBoundsBF(obj:Object):
    """ brute force method for obtaining object bounding box """
    # initialize min and max
    min = Vector((math.inf, math.inf, math.inf))
    max = Vector((-math.inf, -math.inf, -math.inf))
    # calculate min and max verts
    for v in obj.data.vertices:
        if v.co.x > max.x:
            max.x = v.co.x
        elif v.co.x < min.x:
            min.x = v.co.x
        if v.co.y > max.y:
            max.y = v.co.y
        elif v.co.y < min.y:
            min.y = v.co.y
        if v.co.z > max.z:
            max.z = v.co.z
        elif v.co.z < min.z:
            min.z = v.co.z
    # set up bounding box list of coord lists
    bound_box = [list(min),
                 [min.x, min.y, min.z],
                 [min.x, min.y, max.z],
                 [min.x, max.y, max.z],
                 [min.x, max.y, min.z],
                 [max.x, min.y, min.z],
                 [max.y, min.y, max.z],
                 list(max),
                 [max.x, max.y, min.z]]
    return bound_box
开发者ID:patmo141,项目名称:object_alignment,代码行数:32,代码来源:transform.py

示例3: getBoundingBox

# 需要导入模块: from mathutils import Vector [as 别名]
# 或者: from mathutils.Vector import y [as 别名]
def getBoundingBox(scene):
  minimum = Vector() 
  maximum = Vector()

  for obj in scene.objects:
    if obj.type == 'MESH':
      bbox_corners = [obj.matrix_world * Vector(corner) for corner in obj.bound_box]

      for v in bbox_corners:
        if v.x < minimum.x:
          minimum.x = v.x
        if v.y < minimum.y:
          minimum.y = v.y
        if v.z < minimum.z:
          minimum.z = v.z
        if v.x > maximum.x:
          maximum.x = v.x
        if v.y > maximum.y:
          maximum.y = v.y
        if v.z > maximum.z:
          maximum.z = v.z

  return  {
    "minimum" : { "x" : minimum.x, "y" : minimum.y, "z" : minimum.z },
    "maximum" : { "x" : maximum.x, "y" : maximum.y, "z" : maximum.z }
  }
开发者ID:bnolan,项目名称:mv-asset-server,代码行数:28,代码来源:convert.py

示例4: readPackedVector

# 需要导入模块: from mathutils import Vector [as 别名]
# 或者: from mathutils.Vector import y [as 别名]
def readPackedVector(f, format):
    packed = f

    output = Vector()
    if format == 'XZY':
        output.x = packed
        output.y = packed / 65536.0
        output.z = packed / 256.0
    elif format == 'ZXY':
        output.x = packed / 256.0
        output.y = packed / 65536.0
        output.z = packed
    elif format == 'XYZ':
        output.x = packed
        output.y = packed / 256.0
        output.z = packed / 65536.0

    output.x -= math.floor(output.x)
    output.y -= math.floor(output.y)
    output.z -= math.floor(output.z)

    output.x = output.x*2 - 1
    output.y = output.y*2 - 1
    output.z = output.z*2 - 1

    return output
开发者ID:trixnz,项目名称:jc2-rbm-tools,代码行数:28,代码来源:testPacking.py

示例5: analyzeMeshObject

# 需要导入模块: from mathutils import Vector [as 别名]
# 或者: from mathutils.Vector import y [as 别名]
def analyzeMeshObject(obj, meshFaces):
    global DEFAULT_PART_NAME

    mesh = obj.data
    parts = []
    halfSize = obj.dimensions * 0.5
    candidParts = []
    centerOfMass = Vector((0.0, 0.0, 0.0))
    trianglesCount = 0
    meshVerticesCount = len(mesh.vertices)
    meshMaterialCount = len(mesh.materials)

    if meshMaterialCount > 0:
        # Create parts. It is important to iterate it manually 
        # so material names order is preserved.
        for i in range(meshMaterialCount):
            candidParts.append({'name': mesh.materials[i].name, 'start': 0, 'count': 0})
    else:
        # If there are no materials defined, create default part placeholder.
        candidParts.append({'name': DEFAULT_PART_NAME, 'start': 0, 'count': 0})

    for f in meshFaces:
        # Some faces can be quads - values have to doubled then.
        modifier = 2 if len(f.vertices) == 4 else 1
        candidParts[f.material_index]['count'] += 3 * modifier
        trianglesCount += 1 * modifier

    # Update part`s start attribute so they take other parts into account.
    for i in range(0, len(candidParts)):
        if i > 0:
            candidParts[i]['start'] = candidParts[i - 1]['start'] + candidParts[i - 1]['count']

    # Only export parts that have any triangles assigned.
    for p in candidParts:
        if p['count'] > 0:
            parts.append(p)

    centerMax = Vector((-9999.999, -9999.999, -9999.999))
    centerMin = Vector(( 9999.999,  9999.999,  9999.999))

    for v in mesh.vertices:
        centerMax.x = max(centerMax.x, v.co.x)
        centerMin.x = min(centerMin.x, v.co.x)
        centerMax.y = max(centerMax.y, v.co.y)
        centerMin.y = min(centerMin.y, v.co.y)
        centerMax.z = max(centerMax.z, v.co.z)
        centerMin.z = min(centerMin.z, v.co.z)

    centerOfMass.x = abs(centerMax.x) - abs(centerMin.x)
    centerOfMass.y = abs(centerMax.y) - abs(centerMin.y)
    centerOfMass.z = abs(centerMax.z) - abs(centerMin.z)

    centerOfMass *= 0.5

    return centerOfMass, halfSize, trianglesCount, parts
开发者ID:creepydragon,项目名称:revision1,代码行数:57,代码来源:export_maa.py

示例6: __get_uv_max_min

# 需要导入模块: from mathutils import Vector [as 别名]
# 或者: from mathutils.Vector import y [as 别名]
    def __get_uv_max_min(self, loop_seqs, uv_layer):
        uv_max = Vector((-1000000.0, -1000000.0))
        uv_min = Vector((1000000.0, 1000000.0))
        for hseq in loop_seqs:
            for l in hseq[0]:
                uv = l[uv_layer].uv
                uv_max.x = max(uv.x, uv_max.x)
                uv_max.y = max(uv.y, uv_max.y)
                uv_min.x = min(uv.x, uv_min.x)
                uv_min.y = min(uv.y, uv_min.y)

        return uv_max, uv_min
开发者ID:nutti,项目名称:Magic-UV,代码行数:14,代码来源:align_uv.py

示例7: bounding_box

# 需要导入模块: from mathutils import Vector [as 别名]
# 或者: from mathutils.Vector import y [as 别名]
def bounding_box(mesh):
    v0 = mesh.vertices[0].co
    vmin = Vector((v0.x, v0.y, v0.z))
    vmax = Vector((v0.x, v0.y, v0.z))
    for i in range(1, len(mesh.vertices)):
        v = mesh.vertices[i].co
        vmin.x = min(vmin.x, v.x)
        vmin.y = min(vmin.y, v.y)
        vmin.z = min(vmin.z, v.z)
        vmax.x = max(vmax.x, v.x)
        vmax.y = max(vmax.y, v.y)
        vmax.z = max(vmax.z, v.z)
    return vmin, vmax
开发者ID:albsalgar,项目名称:AlbSalGarBeta,代码行数:15,代码来源:sculpty.py

示例8: __get_island_info

# 需要导入模块: from mathutils import Vector [as 别名]
# 或者: from mathutils.Vector import y [as 别名]
def __get_island_info(uv_layer, islands):
    """
    get information about each island
    """

    island_info = []
    for isl in islands:
        info = {}
        max_uv = Vector((-10000000.0, -10000000.0))
        min_uv = Vector((10000000.0, 10000000.0))
        ave_uv = Vector((0.0, 0.0))
        num_uv = 0
        for face in isl:
            n = 0
            a = Vector((0.0, 0.0))
            ma = Vector((-10000000.0, -10000000.0))
            mi = Vector((10000000.0, 10000000.0))
            for l in face['face'].loops:
                uv = l[uv_layer].uv
                ma.x = max(uv.x, ma.x)
                ma.y = max(uv.y, ma.y)
                mi.x = min(uv.x, mi.x)
                mi.y = min(uv.y, mi.y)
                a = a + uv
                n = n + 1
            ave_uv = ave_uv + a
            num_uv = num_uv + n
            a = a / n
            max_uv.x = max(ma.x, max_uv.x)
            max_uv.y = max(ma.y, max_uv.y)
            min_uv.x = min(mi.x, min_uv.x)
            min_uv.y = min(mi.y, min_uv.y)
            face['max_uv'] = ma
            face['min_uv'] = mi
            face['ave_uv'] = a
        ave_uv = ave_uv / num_uv

        info['center'] = ave_uv
        info['size'] = max_uv - min_uv
        info['num_uv'] = num_uv
        info['group'] = -1
        info['faces'] = isl
        info['max'] = max_uv
        info['min'] = min_uv

        island_info.append(info)

    return island_info
开发者ID:nutti,项目名称:Magic-UV,代码行数:50,代码来源:common.py

示例9: saveVertex

# 需要导入模块: from mathutils import Vector [as 别名]
# 或者: from mathutils.Vector import y [as 别名]
def saveVertex(fh, fnormal, useSmooth, uvLayer, vtx, vInx, ofst, exportType):
    uv = Vector((0.0, 1.0))
    normal = Vector((fnormal.x, fnormal.y, fnormal.z))
    weights = (0.0, 0.0, 0.0, 0.0)
    co = vtx.co - ofst

    if uvLayer != None:
        uv.x = uvLayer.uv_raw[vInx * 2 + 0]
        uv.y = -uvLayer.uv_raw[vInx * 2 + 1]

    if useSmooth:
        normal = vtx.normal

    rotationMatrix = Matrix.Rotation(math.radians(-90.0), 3, "X")

    co = rotationMatrix * co
    normal = rotationMatrix * normal

    if exportType == eTypes.TYPE0:
        saveVertexType0(fh, co, uv)
    elif exportType == eTypes.TYPE1:
        saveVertexType1(fh, co, normal, uv)
    elif exportType == eTypes.TYPE2:
        saveVertexType2(fh, co, normal, uv, weights)
    elif exportType == eTypes.TYPE3:
        saveVertexType3(fh, co, normal, uv)
    elif exportType == eTypes.TYPE4:
        saveVertexType4(fh, co, normal, uv, weights)
开发者ID:creepydragon,项目名称:revision1,代码行数:30,代码来源:export_emp.py

示例10: modal

# 需要导入模块: from mathutils import Vector [as 别名]
# 或者: from mathutils.Vector import y [as 别名]
    def modal(self, context, event):
        props = context.scene.tom_props
        prefs = context.user_preferences.addons[__name__].preferences

        # 3Dビューの画面を更新
        if context.area:
            context.area.tag_redraw()

        # キーボードのQキーが押された場合は、オブジェクト並進移動モードを終了
        if event.type == 'Q' and event.value == 'PRESS':
            props.running = False
            print("サンプル3-10: 通常モードへ移行しました。")
            return {'FINISHED'}

        if event.value == 'PRESS':
            value = Vector((0.0, 0.0, 0.0))
            if event.type == prefs.x_axis:
                value.x = 1.0 if not event.shift else -1.0
            if event.type == prefs.y_axis:
                value.y = 1.0 if not event.shift else -1.0
            if event.type == prefs.z_axis:
                value.z = 1.0 if not event.shift else -1.0
            # 選択中のオブジェクトを並進移動する
            bpy.ops.transform.translate(value=value)

        return {'RUNNING_MODAL'}
开发者ID:atu-1,项目名称:mirror-introduction,代码行数:28,代码来源:sample_3_10.py

示例11: gui_space

# 需要导入模块: from mathutils import Vector [as 别名]
# 或者: from mathutils.Vector import y [as 别名]
def gui_space(p):
    p = Vector(p).copy()
    
    p.x = p.x*16 - 8
    p.y = p.y*9 - 4.5
    
    p.y *= -1
    
    return p
开发者ID:gandalf3,项目名称:The-Queen-s-Workers,代码行数:11,代码来源:selecter.py

示例12: shade

# 需要导入模块: from mathutils import Vector [as 别名]
# 或者: from mathutils.Vector import y [as 别名]
    def shade(self, stroke):
        it = stroke.stroke_vertices_begin()
        if it.is_end:
            return
        p_min = it.object.point.copy()
        p_max = it.object.point.copy()
        while not it.is_end:
            p = it.object.point
            if p.x < p_min.x:
                p_min.x = p.x
            if p.x > p_max.x:
                p_max.x = p.x
            if p.y < p_min.y:
                p_min.y = p.y
            if p.y > p_max.y:
                p_max.y = p.y
            it.increment()
        stroke.resample(32 * self.__turns)
        sv_nb = stroke.stroke_vertices_size()
#       print("min  :", p_min.x, p_min.y) # DEBUG
#       print("mean :", p_sum.x, p_sum.y) # DEBUG
#       print("max  :", p_max.x, p_max.y) # DEBUG
#       print("----------------------") # DEBUG
#######################################################
        sv_nb = sv_nb // self.__turns
        center = (p_min + p_max) / 2
        radius = (center.x - p_min.x + center.y - p_min.y) / 2
        p_new = Vector((0.0, 0.0))
#######################################################
        R = self.__random_radius
        C = self.__random_center
        i = 0
        it = stroke.stroke_vertices_begin()
        for j in range(self.__turns):
            prev_radius = radius
            prev_center = center
            radius = radius + randint(-R, R)
            center = center + Vector((randint(-C, C), randint(-C, C)))
            while i < sv_nb and not it.is_end:
                t = float(i) / float(sv_nb - 1)
                r = prev_radius + (radius - prev_radius) * t
                c = prev_center + (center - prev_center) * t
                p_new.x = c.x + r * cos(2 * pi * t)
                p_new.y = c.y + r * sin(2 * pi * t)
                it.object.point = p_new
                i = i + 1
                it.increment()
            i = 1
        verticesToRemove = []
        while not it.is_end:
            verticesToRemove.append(it.object)
            it.increment()
        for sv in verticesToRemove:
            stroke.remove_vertex(sv)
        stroke.update_length()
开发者ID:Gamebasis,项目名称:3DGamebasisServer,代码行数:57,代码来源:shaders.py

示例13: __get_island_info

# 需要导入模块: from mathutils import Vector [as 别名]
# 或者: from mathutils.Vector import y [as 别名]
    def __get_island_info(self, uv_layer, islands):
        """
        get information about each island
        """

        island_info = []
        for isl in islands:
            info = {}
            max_uv = Vector((-10000000.0, -10000000.0))
            min_uv = Vector((10000000.0, 10000000.0))
            ave_uv = Vector((0.0, 0.0))
            num_uv = 0
            for face in isl:
                n = 0
                a = Vector((0.0, 0.0))
                for l in face['face'].loops:
                    uv = l[uv_layer].uv
                    if uv.x > max_uv.x:
                        max_uv.x = uv.x
                    if uv.y > max_uv.y:
                        max_uv.y = uv.y
                    if uv.x < min_uv.x:
                        min_uv.x = uv.x
                    if uv.y < min_uv.y:
                        min_uv.y = uv.y
                    a = a + uv
                    n = n + 1
                ave_uv = ave_uv + a
                num_uv = num_uv + n
                a = a / n
                face['ave_uv'] = a
            ave_uv = ave_uv / num_uv

            info['center'] = ave_uv
            info['size'] = max_uv - min_uv
            info['num_uv'] = num_uv
            info['group'] = -1
            info['faces'] = isl

            island_info.append(info)
        
        return island_info
开发者ID:JimStar,项目名称:OctaneBlender,代码行数:44,代码来源:muv_packuv_ops.py

示例14: __neg__

# 需要导入模块: from mathutils import Vector [as 别名]
# 或者: from mathutils.Vector import y [as 别名]
 def __neg__(self):
     """ return antipodal point """
     coo=Vector()
     if self.co.x > 0:
         coo.x = self.co.x -  math.pi
     else:
         coo.x = self.co.x + math.pi
     coo.y = abs(math.pi - self.co.y)
     coo.z = -self.co.z
     return Reflection(co=coo,
             normalize=False)
开发者ID:katosh,项目名称:sym,代码行数:13,代码来源:transformations.py

示例15: getDimensions

# 需要导入模块: from mathutils import Vector [as 别名]
# 或者: from mathutils.Vector import y [as 别名]
    def getDimensions(self):
        highest = Vector((-10000, -10000, -10000))
        lowest  = Vector(( 10000,  10000,  10000))

        for bone in self.bones:
            if highest.x < bone.restHead.x: highest.x = bone.restHead.x
            if highest.y < bone.restHead.y: highest.y = bone.restHead.y
            if highest.z < bone.restHead.z: highest.z = bone.restHead.z

            if highest.x < bone.restTail.x: highest.x = bone.restTail.x
            if highest.y < bone.restTail.y: highest.y = bone.restTail.y
            if highest.z < bone.restTail.z: highest.z = bone.restTail.z

            if lowest .x > bone.restHead.x: lowest .x = bone.restHead.x
            if lowest .y > bone.restHead.y: lowest .y = bone.restHead.y
            if lowest .z > bone.restHead.z: lowest .z = bone.restHead.z

            if lowest .x > bone.restTail.x: lowest .x = bone.restTail.x
            if lowest .y > bone.restTail.y: lowest .y = bone.restTail.y
            if lowest .z > bone.restTail.z: lowest .z = bone.restTail.z

        return Vector((highest.x - lowest.x, highest.y - lowest.y, highest.z - lowest.z))
开发者ID:NasimiAsl,项目名称:Extensions,代码行数:24,代码来源:armature.py


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