示例#1
0
def plot_chart():
    import matplotlib.pyplot as plt
    
    global faces
    faces = bpypolyskel.polygonize(verts, firstVertIndex, numPolygonVerts, holesInfo, 0.0, 0.5, faces, unitVectors)

    # plot the hipped roof in 3D
    fig = plt.figure()
    ax = fig.gca(projection='3d')
    for face in faces:
        for edge in zip(face, face[1:] + face[:1]):
            p1 = verts[edge[0]]
            p2 = verts[edge[1]]
            ax.plot([p1.x,p2.x],[p1.y,p2.y],[p1.z,p2.z],'k')
    plt.show()

#plot_chart()
    Vector((-0.018335461616516113, -0.9998318552970886, 0.0)),
    Vector((-0.6169271469116211, -0.7870202660560608, 0.0)),
    Vector((-0.017690317705273628, -0.9998435378074646, 0.0)),
    Vector((0.9998777508735657, -0.015640797093510628, 0.0)),
    Vector((-0.017158597707748413, -0.9998527765274048, 0.0)),
    Vector((0.9998718500137329, -0.016015157103538513, 0.0)),
    Vector((0.016878722235560417, 0.9998576045036316, 0.0)),
    Vector((-0.9998364448547363, 0.018087849020957947, 0.0)),
    Vector((0.01667594537138939, 0.999860942363739, 0.0)),
    Vector((-0.9998506307601929, 0.01728552207350731, 0.0)),
    Vector((-0.017496813088655472, -0.999846875667572, 0.0))
]
holesInfo = None
firstVertIndex = 12
numPolygonVerts = 12

bpypolyskel.debugOutputs["skeleton"] = 1

faces = bpypolyskel.polygonize(verts, firstVertIndex, numPolygonVerts,
                               holesInfo, 0.0, 0.5, None, unitVectors)

# the number of vertices in a face
for face in faces:
    assert len(face) >= 3

# duplications of vertex indices
for face in faces:
    assert len(face) == len(set(face))

# edge crossing
assert not bpypolyskel.checkEdgeCrossing(bpypolyskel.debugOutputs["skeleton"])