-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vladimir Elistratov
committed
Nov 28, 2020
1 parent
fcbf129
commit 93ea9de
Showing
1 changed file
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import mathutils | ||
import matplotlib.pyplot as plt | ||
from bpypolyskel import bpypolyskel | ||
from collections import Counter | ||
|
||
verts = [ | ||
mathutils.Vector((-8.607595443725586,-11.499296188354492,0.0)), | ||
mathutils.Vector((-6.6846208572387695,-10.842514038085938,0.0)), | ||
mathutils.Vector((-3.338789701461792,-12.879664421081543,0.0)), | ||
mathutils.Vector((1.3594660758972168,-16.853771209716797,0.0)), | ||
mathutils.Vector((8.508980751037598,-11.521560668945312,0.0)), | ||
mathutils.Vector((4.641894817352295,-2.6382699012756348,0.0)), | ||
mathutils.Vector((15.56687068939209,7.313714027404785,0.0)), | ||
mathutils.Vector((14.320107460021973,9.10595417022705,0.0)), | ||
mathutils.Vector((17.447559356689453,11.655179977416992,0.0)), | ||
mathutils.Vector((18.208290100097656,12.445550918579102,0.0)), | ||
mathutils.Vector((18.72248649597168,13.380636215209961,0.0)), | ||
mathutils.Vector((18.659088134765625,14.493830680847168,0.0)), | ||
mathutils.Vector((18.222366333007812,15.55136489868164,0.0)), | ||
mathutils.Vector((17.461631774902344,16.419654846191406,0.0)), | ||
mathutils.Vector((16.383926391601562,16.853796005249023,0.0)), | ||
mathutils.Vector((15.320308685302734,16.798133850097656,0.0)), | ||
mathutils.Vector((14.256692886352539,16.363985061645508,0.0)), | ||
mathutils.Vector((10.74887466430664,14.215510368347168,0.0)), | ||
mathutils.Vector((9.318975448608398,16.26378631591797,0.0)), | ||
mathutils.Vector((-3.5923538208007812,8.894428253173828,0.0)), | ||
mathutils.Vector((-11.072887420654297,15.640399932861328,0.0)), | ||
mathutils.Vector((-18.24351692199707,10.341612815856934,0.0)), | ||
mathutils.Vector((-14.052464485168457,0.8905748724937439,0.0)), | ||
mathutils.Vector((-16.285367965698242,-0.8348707556724548,0.0)), | ||
mathutils.Vector((-18.722545623779297,-3.205967664718628,0.0)), | ||
mathutils.Vector((-11.453317642211914,-13.157951354980469,0.0)), | ||
mathutils.Vector((-8.607595443725586,-11.499296188354492,8.0)), | ||
mathutils.Vector((-6.6846208572387695,-10.842514038085938,8.0)), | ||
mathutils.Vector((-3.338789701461792,-12.879664421081543,8.0)), | ||
mathutils.Vector((1.3594660758972168,-16.853771209716797,8.0)), | ||
mathutils.Vector((8.508980751037598,-11.521560668945312,8.0)), | ||
mathutils.Vector((4.641894817352295,-2.6382699012756348,8.0)), | ||
mathutils.Vector((15.56687068939209,7.313714027404785,8.0)), | ||
mathutils.Vector((14.320107460021973,9.10595417022705,8.0)), | ||
mathutils.Vector((17.447559356689453,11.655179977416992,8.0)), | ||
mathutils.Vector((18.208290100097656,12.445550918579102,8.0)), | ||
mathutils.Vector((18.72248649597168,13.380636215209961,8.0)), | ||
mathutils.Vector((18.659088134765625,14.493830680847168,8.0)), | ||
mathutils.Vector((18.222366333007812,15.55136489868164,8.0)), | ||
mathutils.Vector((17.461631774902344,16.419654846191406,8.0)), | ||
mathutils.Vector((16.383926391601562,16.853796005249023,8.0)), | ||
mathutils.Vector((15.320308685302734,16.798133850097656,8.0)), | ||
mathutils.Vector((14.256692886352539,16.363985061645508,8.0)), | ||
mathutils.Vector((10.74887466430664,14.215510368347168,8.0)), | ||
mathutils.Vector((9.318975448608398,16.26378631591797,8.0)), | ||
mathutils.Vector((-3.5923538208007812,8.894428253173828,8.0)), | ||
mathutils.Vector((-11.072887420654297,15.640399932861328,8.0)), | ||
mathutils.Vector((-18.24351692199707,10.341612815856934,8.0)), | ||
mathutils.Vector((-14.052464485168457,0.8905748724937439,8.0)), | ||
mathutils.Vector((-16.285367965698242,-0.8348707556724548,8.0)), | ||
mathutils.Vector((-18.722545623779297,-3.205967664718628,8.0)), | ||
mathutils.Vector((-11.453317642211914,-13.157951354980469,8.0)) | ||
] | ||
unitVectors = [ | ||
mathutils.Vector((0.9463262557983398,0.3232129216194153,0.0)), | ||
mathutils.Vector((0.8541353940963745,-0.5200508236885071,0.0)), | ||
mathutils.Vector((0.7634936571121216,-0.6458153128623962,0.0)), | ||
mathutils.Vector((0.8016076683998108,0.597850501537323,0.0)), | ||
mathutils.Vector((-0.39914146065711975,0.9168893098831177,0.0)), | ||
mathutils.Vector((0.7392597198486328,0.6734203100204468,0.0)), | ||
mathutils.Vector((-0.5710606575012207,0.8209079504013062,0.0)), | ||
mathutils.Vector((0.7751219272613525,0.6318117380142212,0.0)), | ||
mathutils.Vector((0.6934679746627808,0.7204874753952026,0.0)), | ||
mathutils.Vector((0.4818464517593384,0.8762556910514832,0.0)), | ||
mathutils.Vector((-0.05685960128903389,0.9983821511268616,0.0)), | ||
mathutils.Vector((-0.38169607520103455,0.9242878556251526,0.0)), | ||
mathutils.Vector((-0.6589856743812561,0.7521554231643677,0.0)), | ||
mathutils.Vector((-0.9275659918785095,0.37365925312042236,0.0)), | ||
mathutils.Vector((-0.9986335039138794,-0.0522613450884819,0.0)), | ||
mathutils.Vector((-0.9258416295051575,-0.37791186571121216,0.0)), | ||
mathutils.Vector((-0.8527613878250122,-0.5223007798194885,0.0)), | ||
mathutils.Vector((-0.5724156498908997,0.8199635744094849,0.0)), | ||
mathutils.Vector((-0.8684906363487244,-0.49570560455322266,0.0)), | ||
mathutils.Vector((-0.7426277995109558,0.6697043776512146,0.0)), | ||
mathutils.Vector((-0.8042427897453308,-0.5943008661270142,0.0)), | ||
mathutils.Vector((0.4053783714771271,-0.9141490459442139,0.0)), | ||
mathutils.Vector((-0.791281521320343,-0.6114519834518433,0.0)), | ||
mathutils.Vector((-0.7167569994926453,-0.6973230838775635,0.0)), | ||
mathutils.Vector((0.5898380875587463,-0.807521641254425,0.0)), | ||
mathutils.Vector((0.8639571666717529,0.5035653114318848,0.0)) | ||
] | ||
holesInfo = None | ||
firstVertIndex = 26 | ||
numPolygonVerts = 26 | ||
faces = bpypolyskel.polygonize(verts, firstVertIndex, numPolygonVerts, holesInfo, 0.0, 0.5, None, unitVectors) | ||
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]) | ||
plt.show() |