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


Python Edge.setAttributes方法代码示例

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


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

示例1: initial_triangulation

# 需要导入模块: from edge import Edge [as 别名]
# 或者: from edge.Edge import setAttributes [as 别名]
    def initial_triangulation(self):
        n1 = Edge(); n2 = Edge(); n3 = Edge(); n4 = Edge()
        p1 = Edge(); p2 = Edge(); p3 = Edge(); p4 = Edge()
        c1 = Edge(); c2 = Edge()

        self.edges = [n1,n2,n3,n4,p1,p2,p3,p4,c1,c2]

        topleft     = Vertex(Vector(-0.1, 1.1, 0), p2)
        topright    = Vertex(Vector(1.1, 1.1, 0), p1)
        bottomleft  = Vertex(Vector(-0.1, -0.1, 0), p3)
        bottomright = Vertex(Vector(1.1, -0.1, 0), p4)
        self.vertices    = [topleft, topright, bottomleft, bottomright]
        self.initial_vertices = [topleft, topright, bottomleft, bottomright]

        a     = Face(p1)
        b     = Face(p2)
        self.faces = [a, b]

        n1.setAttributes(topleft, p1, None, n4, n2)
        n2.setAttributes(bottomleft, p2, None, n1, n3)
        n3.setAttributes(bottomright, p3, None, n2, n4)
        n4.setAttributes(topright, p4, None, n3, n1)

        p1.setAttributes(topright, n1, a, c1, p4)
        p2.setAttributes(topleft, n2, b, p3, c2)
        p3.setAttributes(bottomleft, n3, b, c2, p2)
        p4.setAttributes(bottomright, n4, a, p1, c1)

        c1.setAttributes(topleft,     c2, a, p4, p1)
        c2.setAttributes(bottomright, c1, b, p2, p3)

        self.updated = True
开发者ID:akathorn,项目名称:terrains,代码行数:34,代码来源:dcel.py

示例2: split_face

# 需要导入模块: from edge import Edge [as 别名]
# 或者: from edge.Edge import setAttributes [as 别名]
    def split_face(self, face, point):
        self.faces.remove(face)
        [e1, e2, e3] = face.edges
        [a, b, c]    = face.vertices
        a1 = Edge(); a2 = Edge()
        b1 = Edge(); b2 = Edge()
        c1 = Edge(); c2 = Edge()

        v = Vertex(point, a2)

        f1 = Face(a2)
        f2 = Face(b2)
        f3 = Face(c2)

        e1.next = b1; e1.prev = a2; e1.face = f1
        e2.next = c1; e2.prev = b2; e2.face = f2
        e3.next = a1; e3.prev = c2; e3.face = f3

        # setAttributes(origin, twin, face, next, prev):
        a1.setAttributes (a, a2, f3, c2, e3)
        a2.setAttributes (v, a1, f1, e1, b1)
        b1.setAttributes (b, b2, f1, a2, e1)
        b2.setAttributes (v, b1, f2, e2, c1)
        c1.setAttributes (c, c2, f2, b2, e2)
        c2.setAttributes (v, c1, f3, e3, a1)

        self.vertices.append(v)
        self.edges.extend([a1,a2,b1,b2,c1,c2])
        self.faces.extend([f1,f2,f3])

        return [v,[a1,a2,b1,b2,c1,c2],[f1,f2,f3]]

        self.updated = True
开发者ID:akathorn,项目名称:terrains,代码行数:35,代码来源:dcel.py


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