本文整理匯總了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
示例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