一直卡在节点向量那儿,然后自己写了个节点向量的生成代码:
knotvector_v=[]
count=0.0
for i in range(len(ctrlpts[0])+4):
knotvector_v.append(count)
if i>1:
if i-1<len(ctrlpts[0]):
if (i-3)%2==0:
count+=1.0
print(knotvector_v)
surf.knotvector_v = knotvector_v
knotvector_u=[]
count=0.0
for i in range(len(ctrlpts)+4):
knotvector_u.append(count)
if i>1:
if i-1<len(ctrlpts):
if (i-3)%2==0:
count+=1.0
print(knotvector_u)
surf.knotvector_u = knotvector_u
完整的代码:
# encoding: utf-8
import geomdl
print(geomdl.__version__)
from geomdl import BSpline
# from geomdl.visualization import VisMPL
# Control points
ctrlpts = [[[-0.14138151959111978, -0.14664847481571902, 0], [-0.14138151959111978, -0.13367998192001185, 0], [-0.14138151959111978, -0.12071148902430469, 0], [-0.14138151959111978, -0.10774299612859753, 0], [-0.14138151959111978, -0.09477450323289036, 0], [-0.14138151959111978, -0.0818060103371832, 0], [-0.14138151959111978, -0.06883751744147604, 0], [-0.14138151959111978, -0.055869024545768864, 0], [-0.14138151959111978, -0.042900531650061705, 0], [-0.14138151959111978, -0.029932038754354545, 0]],
[[-0.13520779955416828, -0.02993203875435455, 0], [-0.13520779955416828, -0.04290053165006171, 0], [-0.13520779955416828, -0.05586902454576888, 0], [-0.13520779955416828, -0.06883751744147604, 0], [-0.13520779955416828, -0.08180601033718321, 0], [-0.13520779955416828, -0.09477450323289037, 0], [-0.13520779955416828, -0.10774299612859753, 0], [-0.13520779955416828, -0.1207114890243047, 0], [-0.13520779955416828, -0.13367998192001188, 0], [-0.13520779955416828, -0.14664847481571902, 0]],
[[-0.12903407951721682, -0.14664847481571902, 0], [-0.12903407951721682, -0.13367998192001185, 0], [-0.12903407951721682, -0.12071148902430469, 0], [-0.12903407951721682, -0.10774299612859753, 0], [-0.12903407951721682, -0.09477450323289036, 0], [-0.12903407951721682, -0.0818060103371832, 0], [-0.12903407951721682, -0.06883751744147604, 0], [-0.12903407951721682, -0.055869024545768864, 0], [-0.12903407951721682, -0.042900531650061705, 0], [-0.12903407951721682, -0.029932038754354545, 0]],
[[-0.12286035948026534, -0.02993203875435455, 0], [-0.12286035948026534, -0.04290053165006171, 0], [-0.12286035948026534, -0.05586902454576888, 0], [-0.12286035948026534, -0.06883751744147604, 0], [-0.12286035948026534, -0.08180601033718321, 0], [-0.12286035948026534, -0.09477450323289037, 0], [-0.12286035948026534, -0.10774299612859753, 0], [-0.12286035948026534, -0.1207114890243047, 0], [-0.12286035948026534, -0.13367998192001188, 0], [-0.12286035948026534, -0.14664847481571902, 0]],
[[-0.11668663944331387, -0.14664847481571902, 0], [-0.11668663944331387, -0.13367998192001185, 0], [-0.11668663944331387, -0.12071148902430469, 0], [-0.11668663944331387, -0.10774299612859753, 0], [-0.11668663944331387, -0.09477450323289036, 0], [-0.11668663944331387, -0.0818060103371832, 0], [-0.11668663944331387, -0.06883751744147604, 0], [-0.11668663944331387, -0.055869024545768864, 0], [-0.11668663944331387, -0.042900531650061705, 0], [-0.11668663944331387, -0.029932038754354545, 0]],
[[-0.11051291940636239, -0.02993203875435455, 0], [-0.11051291940636239, -0.04290053165006171, 0], [-0.11051291940636239, -0.05586902454576888, 0], [-0.11051291940636239, -0.06883751744147604, 0], [-0.11051291940636239, -0.08180601033718321, 0], [-0.11051291940636239, -0.09477450323289037, 0], [-0.11051291940636239, -0.10774299612859753, 0], [-0.11051291940636239, -0.1207114890243047, 0], [-0.11051291940636239, -0.13367998192001188, 0], [-0.11051291940636239, -0.14664847481571902, 0]],
[[-0.10433919936941091, -0.14664847481571902, 0], [-0.10433919936941091, -0.13367998192001185, 0], [-0.10433919936941091, -0.12071148902430469, 0], [-0.10433919936941091, -0.10774299612859753, 0], [-0.10433919936941091, -0.09477450323289036, 0], [-0.10433919936941091, -0.0818060103371832, 0], [-0.10433919936941091, -0.06883751744147604, 0], [-0.10433919936941091, -0.055869024545768864, 0], [-0.10433919936941091, -0.042900531650061705, 0], [-0.10433919936941091, -0.029932038754354545, 0]],
[[-0.09816547933245942, -0.02993203875435455, 0], [-0.09816547933245942, -0.04290053165006171, 0], [-0.09816547933245942, -0.05586902454576888, 0], [-0.09816547933245942, -0.06883751744147604, 0], [-0.09816547933245942, -0.08180601033718321, 0], [-0.09816547933245942, -0.09477450323289037, 0], [-0.09816547933245942, -0.10774299612859753, 0], [-0.09816547933245942, -0.1207114890243047, 0], [-0.09816547933245942, -0.13367998192001188, 0], [-0.09816547933245942, -0.14664847481571902, 0]],
[[-0.09199175929550796, -0.14664847481571902, 0], [-0.09199175929550796, -0.13367998192001185, 0], [-0.09199175929550796, -0.12071148902430469, 0], [-0.09199175929550796, -0.10774299612859753, 0], [-0.09199175929550796, -0.09477450323289036, 0], [-0.09199175929550796, -0.0818060103371832, 0], [-0.09199175929550796, -0.06883751744147604, 0], [-0.09199175929550796, -0.055869024545768864, 0], [-0.09199175929550796, -0.042900531650061705, 0], [-0.09199175929550796, -0.029932038754354545, 0]],
[[-0.08581803925855647, -0.02993203875435455, 0], [-0.08581803925855647, -0.04290053165006171, 0], [-0.08581803925855647, -0.05586902454576888, 0], [-0.08581803925855647, -0.06883751744147604, 0], [-0.08581803925855647, -0.08180601033718321, 0], [-0.08581803925855647, -0.09477450323289037, 0], [-0.08581803925855647, -0.10774299612859753, 0], [-0.08581803925855647, -0.1207114890243047, 0], [-0.08581803925855647, -0.13367998192001188, 0], [-0.08581803925855647, -0.14664847481571902, 0]],
[[-0.079644319221605, -0.14664847481571902, 0], [-0.079644319221605, -0.13367998192001185, 0], [-0.079644319221605, -0.12071148902430469, 0], [-0.079644319221605, -0.10774299612859753, 0], [-0.079644319221605, -0.09477450323289036, 0], [-0.079644319221605, -0.0818060103371832, 0], [-0.079644319221605, -0.06883751744147604, 0], [-0.079644319221605, -0.055869024545768864, 0], [-0.079644319221605, -0.042900531650061705, 0], [-0.079644319221605, -0.029932038754354545, 0]],
[[-0.07347059918465351, -0.02993203875435455, 0], [-0.07347059918465351, -0.04290053165006171, 0], [-0.07347059918465351, -0.05586902454576888, 0], [-0.07347059918465351, -0.06883751744147604, 0], [-0.07347059918465351, -0.08180601033718321, 0], [-0.07347059918465351, -0.09477450323289037, 0], [-0.07347059918465351, -0.10774299612859753, 0], [-0.07347059918465351, -0.1207114890243047, 0], [-0.07347059918465351, -0.13367998192001188, 0], [-0.07347059918465351, -0.14664847481571902, 0]],
[[-0.06729687914770204, -0.14664847481571902, 0], [-0.06729687914770204, -0.13367998192001185, 0], [-0.06729687914770204, -0.12071148902430469, 0], [-0.06729687914770204, -0.10774299612859753, 0], [-0.06729687914770204, -0.09477450323289036, 0], [-0.06729687914770204, -0.0818060103371832, 0], [-0.06729687914770204, -0.06883751744147604, 0], [-0.06729687914770204, -0.055869024545768864, 0], [-0.06729687914770204, -0.042900531650061705, 0], [-0.06729687914770204, -0.029932038754354545, 0]],
[[-0.06112315911075056, -0.02993203875435455, 0], [-0.06112315911075056, -0.04290053165006171, 0], [-0.06112315911075056, -0.05586902454576888, 0], [-0.06112315911075056, -0.06883751744147604, 0], [-0.06112315911075056, -0.08180601033718321, 0], [-0.06112315911075056, -0.09477450323289037, 0], [-0.06112315911075056, -0.10774299612859753, 0], [-0.06112315911075056, -0.1207114890243047, 0], [-0.06112315911075056, -0.13367998192001188, 0], [-0.06112315911075056, -0.14664847481571902, 0]],
[[-0.05494943907379908, -0.14664847481571902, 0], [-0.05494943907379908, -0.13367998192001185, 0], [-0.05494943907379908, -0.12071148902430469, 0], [-0.05494943907379908, -0.10774299612859753, 0], [-0.05494943907379908, -0.09477450323289036, 0], [-0.05494943907379908, -0.0818060103371832, 0], [-0.05494943907379908, -0.06883751744147604, 0], [-0.05494943907379908, -0.055869024545768864, 0], [-0.05494943907379908, -0.042900531650061705, 0], [-0.05494943907379908, -0.029932038754354545, 0]],
[[-0.0487757190368476, -0.02993203875435455, 0], [-0.0487757190368476, -0.04290053165006171, 0], [-0.0487757190368476, -0.05586902454576888, 0], [-0.0487757190368476, -0.06883751744147604, 0], [-0.0487757190368476, -0.08180601033718321, 0], [-0.0487757190368476, -0.09477450323289037, 0], [-0.0487757190368476, -0.10774299612859753, 0], [-0.0487757190368476, -0.1207114890243047, 0], [-0.0487757190368476, -0.13367998192001188, 0], [-0.0487757190368476, -0.14664847481571902, 0]],
[[-0.042601998999896126, -0.14664847481571902, 0], [-0.042601998999896126, -0.13367998192001185, 0], [-0.042601998999896126, -0.12071148902430469, 0], [-0.042601998999896126, -0.10774299612859753, 0], [-0.042601998999896126, -0.09477450323289036, 0], [-0.042601998999896126, -0.0818060103371832, 0], [-0.042601998999896126, -0.06883751744147604, 0], [-0.042601998999896126, -0.055869024545768864, 0], [-0.042601998999896126, -0.042900531650061705, 0], [-0.042601998999896126, -0.029932038754354545, 0]],
[[-0.03642827896294465, -0.02993203875435455, 0], [-0.03642827896294465, -0.04290053165006171, 0], [-0.03642827896294465, -0.05586902454576888, 0], [-0.03642827896294465, -0.06883751744147604, 0], [-0.03642827896294465, -0.08180601033718321, 0], [-0.03642827896294465, -0.09477450323289037, 0], [-0.03642827896294465, -0.10774299612859753, 0], [-0.03642827896294465, -0.1207114890243047, 0], [-0.03642827896294465, -0.13367998192001188, 0], [-0.03642827896294465, -0.14664847481571902, 0]],
[[-0.030254558925993172, -0.14664847481571902, 0], [-0.030254558925993172, -0.13367998192001185, 0], [-0.030254558925993172, -0.12071148902430469, 0], [-0.030254558925993172, -0.10774299612859753, 0], [-0.030254558925993172, -0.09477450323289036, 0], [-0.030254558925993172, -0.0818060103371832, 0], [-0.030254558925993172, -0.06883751744147604, 0], [-0.030254558925993172, -0.055869024545768864, 0], [-0.030254558925993172, -0.042900531650061705, 0], [-0.030254558925993172, -0.029932038754354545, 0]],
[[-0.024080838889041695, -0.02993203875435455, 0], [-0.024080838889041695, -0.04290053165006171, 0], [-0.024080838889041695, -0.05586902454576888, 0], [-0.024080838889041695, -0.06883751744147604, 0], [-0.024080838889041695, -0.08180601033718321, 0], [-0.024080838889041695, -0.09477450323289037, 0], [-0.024080838889041695, -0.10774299612859753, 0], [-0.024080838889041695, -0.1207114890243047, 0], [-0.024080838889041695, -0.13367998192001188, 0], [-0.024080838889041695, -0.14664847481571902, 0]]
]
# ctrlpts = [
# [[-25.0, -25.0, -10.0], [-25.0, -15.0, -5.0], [-25.0, -5.0, 0.0], [-25.0, 5.0, 0.0], [-25.0, 15.0, -5.0], [-25.0, 25.0, -10.0]],
# [[-15.0, -25.0, -8.0], [-15.0, -15.0, -4.0], [-15.0, -5.0, -4.0], [-15.0, 5.0, -4.0], [-15.0, 15.0, -4.0], [-15.0, 25.0, -8.0]],
# [[-5.0, -25.0, -5.0], [-5.0, -15.0, -3.0], [-5.0, -5.0, -8.0], [-5.0, 5.0, -8.0], [-5.0, 15.0, -3.0], [-5.0, 25.0, -5.0]],
# [[5.0, -25.0, -3.0], [5.0, -15.0, -2.0], [5.0, -5.0, -8.0], [5.0, 5.0, -8.0], [5.0, 15.0, -2.0], [5.0, 25.0, -3.0]],
# [[15.0, -25.0, -8.0], [15.0, -15.0, -4.0], [15.0, -5.0, -4.0], [15.0, 5.0, -4.0], [15.0, 15.0, -4.0], [15.0, 25.0, -8.0]],
# [[25.0, -25.0, -10.0], [25.0, -15.0, -5.0], [25.0, -5.0, 2.0], [25.0, 5.0, 2.0], [25.0, 15.0, -5.0], [25.0, 25.0, -10.0]]
# ]
# ctrlpts = [[[-0.14138151959111978, -0.14664847481571902, 0], [-0.14138151959111978, -0.13367998192001185, 0], [-0.14138151959111978, -0.12071148902430469, 0], [-0.14138151959111978, -0.10774299612859753, 0], [-0.14138151959111978, -0.09477450323289036, 0], [-0.14138151959111978, -0.0818060103371832, 0]],
# [[-0.13520779955416828, -0.02993203875435455, 0], [-0.13520779955416828, -0.04290053165006171, 0], [-0.13520779955416828, -0.05586902454576888, 0], [-0.13520779955416828, -0.06883751744147604, 0], [-0.13520779955416828, -0.08180601033718321, 0], [-0.13520779955416828, -0.09477450323289037, 0]],
# [[-0.12903407951721682, -0.14664847481571902, 0], [-0.12903407951721682, -0.13367998192001185, 0], [-0.12903407951721682, -0.12071148902430469, 0], [-0.12903407951721682, -0.10774299612859753, 0], [-0.12903407951721682, -0.09477450323289036, 0], [-0.12903407951721682, -0.0818060103371832, 0]],
# [[-0.12286035948026534, -0.02993203875435455, 0], [-0.12286035948026534, -0.04290053165006171, 0], [-0.12286035948026534, -0.05586902454576888, 0], [-0.12286035948026534, -0.06883751744147604, 0], [-0.12286035948026534, -0.08180601033718321, 0], [-0.12286035948026534, -0.09477450323289037, 0]],
# [[-0.11668663944331387, -0.14664847481571902, 0], [-0.11668663944331387, -0.13367998192001185, 0], [-0.11668663944331387, -0.12071148902430469, 0], [-0.11668663944331387, -0.10774299612859753, 0], [-0.11668663944331387, -0.09477450323289036, 0], [-0.11668663944331387, -0.0818060103371832, 0]],
# [[-0.11051291940636239, -0.02993203875435455, 0], [-0.11051291940636239, -0.04290053165006171, 0], [-0.11051291940636239, -0.05586902454576888, 0], [-0.11051291940636239, -0.06883751744147604, 0], [-0.11051291940636239, -0.08180601033718321, 0], [-0.11051291940636239, -0.09477450323289037, 0]],
# ]
ctrlpts = [[[-0.14138151959111978, -0.14664847481571902, 0], [-0.14138151959111978, -0.13367998192001185, 0], [-0.14138151959111978, -0.12071148902430469, 0], [-0.14138151959111978, -0.10774299612859753, 0], [-0.14138151959111978, -0.09477450323289036, 0], [-0.14138151959111978, -0.0818060103371832, 0], [-0.14138151959111978, -0.06883751744147604, 0], [-0.14138151959111978, -0.055869024545768864, 0], [-0.14138151959111978, -0.042900531650061705, 0], [-0.14138151959111978, -0.029932038754354545, 0]],
[[-0.12903407951721682, -0.14664847481571902, 0], [-0.12903407951721682, -0.13367998192001185, 0], [-0.12903407951721682, -0.12071148902430469, 0], [-0.12903407951721682, -0.10774299612859753, 0], [-0.12903407951721682, -0.09477450323289036, 0], [-0.12903407951721682, -0.0818060103371832, 0], [-0.12903407951721682, -0.06883751744147604, 0], [-0.12903407951721682, -0.055869024545768864, 0], [-0.12903407951721682, -0.042900531650061705, 0], [-0.12903407951721682, -0.029932038754354545, 0]],
[[-0.11668663944331387, -0.14664847481571902, 0], [-0.11668663944331387, -0.13367998192001185, 0], [-0.11668663944331387, -0.12071148902430469, 0], [-0.11668663944331387, -0.10774299612859753, 0], [-0.11668663944331387, -0.09477450323289036, 0], [-0.11668663944331387, -0.0818060103371832, 0], [-0.11668663944331387, -0.06883751744147604, 0], [-0.11668663944331387, -0.055869024545768864, 0], [-0.11668663944331387, -0.042900531650061705, 0], [-0.11668663944331387, -0.029932038754354545, 0]],
[[-0.10433919936941091, -0.14664847481571902, 0], [-0.10433919936941091, -0.13367998192001185, 0], [-0.10433919936941091, -0.12071148902430469, 0], [-0.10433919936941091, -0.10774299612859753, 0], [-0.10433919936941091, -0.09477450323289036, 0], [-0.10433919936941091, -0.0818060103371832, 0], [-0.10433919936941091, -0.06883751744147604, 0], [-0.10433919936941091, -0.055869024545768864, 0], [-0.10433919936941091, -0.042900531650061705, 0], [-0.10433919936941091, -0.029932038754354545, 0]],
[[-0.09199175929550796, -0.14664847481571902, 0], [-0.09199175929550796, -0.13367998192001185, 0], [-0.09199175929550796, -0.12071148902430469, 0], [-0.09199175929550796, -0.10774299612859753, 0], [-0.09199175929550796, -0.09477450323289036, 0], [-0.09199175929550796, -0.0818060103371832, 0], [-0.09199175929550796, -0.06883751744147604, 0], [-0.09199175929550796, -0.055869024545768864, 0], [-0.09199175929550796, -0.042900531650061705, 0], [-0.09199175929550796, -0.029932038754354545, 0]],
[[-0.079644319221605, -0.14664847481571902, 0], [-0.079644319221605, -0.13367998192001185, 0], [-0.079644319221605, -0.12071148902430469, 0], [-0.079644319221605, -0.10774299612859753, 0], [-0.079644319221605, -0.09477450323289036, 0], [-0.079644319221605, -0.0818060103371832, 0], [-0.079644319221605, -0.06883751744147604, 0], [-0.079644319221605, -0.055869024545768864, 0], [-0.079644319221605, -0.042900531650061705, 0], [-0.079644319221605, -0.029932038754354545, 0]],
[[-0.06729687914770204, -0.14664847481571902, 0], [-0.06729687914770204, -0.13367998192001185, 0], [-0.06729687914770204, -0.12071148902430469, 0], [-0.06729687914770204, -0.10774299612859753, 0], [-0.06729687914770204, -0.09477450323289036, 0], [-0.06729687914770204, -0.0818060103371832, 0], [-0.06729687914770204, -0.06883751744147604, 0], [-0.06729687914770204, -0.055869024545768864, 0], [-0.06729687914770204, -0.042900531650061705, 0], [-0.06729687914770204, -0.029932038754354545, 0]],
[[-0.05494943907379908, -0.14664847481571902, 0], [-0.05494943907379908, -0.13367998192001185, 0], [-0.05494943907379908, -0.12071148902430469, 0], [-0.05494943907379908, -0.10774299612859753, 0], [-0.05494943907379908, -0.09477450323289036, 0], [-0.05494943907379908, -0.0818060103371832, 0], [-0.05494943907379908, -0.06883751744147604, 0], [-0.05494943907379908, -0.055869024545768864, 0], [-0.05494943907379908, -0.042900531650061705, 0], [-0.05494943907379908, -0.029932038754354545, 0]],
[[-0.042601998999896126, -0.14664847481571902, 0], [-0.042601998999896126, -0.13367998192001185, 0], [-0.042601998999896126, -0.12071148902430469, 0], [-0.042601998999896126, -0.10774299612859753, 0], [-0.042601998999896126, -0.09477450323289036, 0], [-0.042601998999896126, -0.0818060103371832, 0], [-0.042601998999896126, -0.06883751744147604, 0], [-0.042601998999896126, -0.055869024545768864, 0], [-0.042601998999896126, -0.042900531650061705, 0], [-0.042601998999896126, -0.029932038754354545, 0]],
[[-0.030254558925993172, -0.14664847481571902, 0], [-0.030254558925993172, -0.13367998192001185, 0], [-0.030254558925993172, -0.12071148902430469, 0], [-0.030254558925993172, -0.10774299612859753, 0], [-0.030254558925993172, -0.09477450323289036, 0], [-0.030254558925993172, -0.0818060103371832, 0], [-0.030254558925993172, -0.06883751744147604, 0], [-0.030254558925993172, -0.055869024545768864, 0], [-0.030254558925993172, -0.042900531650061705, 0], [-0.030254558925993172, -0.029932038754354545, 0]]
]
ctrlpts = [[[-7.61089252801589e-18, -0.2897777575459787, 0], [-7.61089252801589e-18, -0.24607715997095897, 0], [-7.61089252801589e-18, -0.20237656239593924, 0], [-7.61089252801589e-18, -0.1586759648209195, 0], [-7.61089252801589e-18, -0.1149753672458998, 0], [-7.61089252801589e-18, -0.07127476967088009, 0], [-7.61089252801589e-18, -0.027574172095860328, 0], [-7.61089252801589e-18, 0.01612642547915938, 0], [-7.61089252801589e-18, 0.059827023054179085, 0], [-7.61089252801589e-18, 0.10352762062919879, 0]],
[[0.024421897699675375, 0.10352762062919878, 0], [0.024421897699675375, 0.05982702305417906, 0], [0.024421897699675375, 0.016126425479159337, 0], [0.024421897699675375, -0.027574172095860397, 0], [0.024421897699675375, -0.0712747696708801, 0], [0.024421897699675375, -0.11497536724589981, 0], [0.024421897699675375, -0.15867596482091956, 0], [0.024421897699675375, -0.20237656239593926, 0], [0.024421897699675375, -0.24607715997095897, 0], [0.024421897699675375, -0.2897777575459787, 0]],
[[0.048843795399350756, -0.2897777575459787, 0], [0.048843795399350756, -0.24607715997095897, 0], [0.048843795399350756, -0.20237656239593924, 0], [0.048843795399350756, -0.1586759648209195, 0], [0.048843795399350756, -0.1149753672458998, 0], [0.048843795399350756, -0.07127476967088009, 0], [0.048843795399350756, -0.027574172095860328, 0], [0.048843795399350756, 0.01612642547915938, 0], [0.048843795399350756, 0.059827023054179085, 0], [0.048843795399350756, 0.10352762062919879, 0]],
[[0.07326569309902613, 0.10352762062919878, 0], [0.07326569309902613, 0.05982702305417906, 0], [0.07326569309902613, 0.016126425479159337, 0], [0.07326569309902613, -0.027574172095860397, 0], [0.07326569309902613, -0.0712747696708801, 0], [0.07326569309902613, -0.11497536724589981, 0], [0.07326569309902613, -0.15867596482091956, 0], [0.07326569309902613, -0.20237656239593926, 0], [0.07326569309902613, -0.24607715997095897, 0], [0.07326569309902613, -0.2897777575459787, 0]],
[[0.09768759079870151, -0.2897777575459787, 0], [0.09768759079870151, -0.24607715997095897, 0], [0.09768759079870151, -0.20237656239593924, 0], [0.09768759079870151, -0.1586759648209195, 0], [0.09768759079870151, -0.1149753672458998, 0], [0.09768759079870151, -0.07127476967088009, 0], [0.09768759079870151, -0.027574172095860328, 0], [0.09768759079870151, 0.01612642547915938, 0], [0.09768759079870151, 0.059827023054179085, 0], [0.09768759079870151, 0.10352762062919879, 0]],
[[0.1221094884983769, 0.10352762062919878, 0], [0.1221094884983769, 0.05982702305417906, 0], [0.1221094884983769, 0.016126425479159337, 0], [0.1221094884983769, -0.027574172095860397, 0], [0.1221094884983769, -0.0712747696708801, 0], [0.1221094884983769, -0.11497536724589981, 0], [0.1221094884983769, -0.15867596482091956, 0], [0.1221094884983769, -0.20237656239593926, 0], [0.1221094884983769, -0.24607715997095897, 0], [0.1221094884983769, -0.2897777575459787, 0]],
[[0.14653138619805228, -0.2897777575459787, 0], [0.14653138619805228, -0.24607715997095897, 0], [0.14653138619805228, -0.20237656239593924, 0], [0.14653138619805228, -0.1586759648209195, 0], [0.14653138619805228, -0.1149753672458998, 0], [0.14653138619805228, -0.07127476967088009, 0], [0.14653138619805228, -0.027574172095860328, 0], [0.14653138619805228, 0.01612642547915938, 0], [0.14653138619805228, 0.059827023054179085, 0], [0.14653138619805228, 0.10352762062919879, 0]],
[[0.17095328389772768, 0.10352762062919878, 0], [0.17095328389772768, 0.05982702305417906, 0], [0.17095328389772768, 0.016126425479159337, 0], [0.17095328389772768, -0.027574172095860397, 0], [0.17095328389772768, -0.0712747696708801, 0], [0.17095328389772768, -0.11497536724589981, 0], [0.17095328389772768, -0.15867596482091956, 0], [0.17095328389772768, -0.20237656239593926, 0], [0.17095328389772768, -0.24607715997095897, 0], [0.17095328389772768, -0.2897777575459787, 0]],
[[0.19537518159740305, -0.2897777575459787, 0], [0.19537518159740305, -0.24607715997095897, 0], [0.19537518159740305, -0.20237656239593924, 0], [0.19537518159740305, -0.1586759648209195, 0], [0.19537518159740305, -0.1149753672458998, 0], [0.19537518159740305, -0.07127476967088009, 0], [0.19537518159740305, -0.027574172095860328, 0], [0.19537518159740305, 0.01612642547915938, 0], [0.19537518159740305, 0.059827023054179085, 0], [0.19537518159740305, 0.10352762062919879, 0]],
[[0.21979707929707842, 0.10352762062919878, 0], [0.21979707929707842, 0.05982702305417906, 0], [0.21979707929707842, 0.016126425479159337, 0], [0.21979707929707842, -0.027574172095860397, 0], [0.21979707929707842, -0.0712747696708801, 0], [0.21979707929707842, -0.11497536724589981, 0], [0.21979707929707842, -0.15867596482091956, 0], [0.21979707929707842, -0.20237656239593926, 0], [0.21979707929707842, -0.24607715997095897, 0], [0.21979707929707842, -0.2897777575459787, 0]],
[[0.24421897699675382, -0.2897777575459787, 0], [0.24421897699675382, -0.24607715997095897, 0], [0.24421897699675382, -0.20237656239593924, 0], [0.24421897699675382, -0.1586759648209195, 0], [0.24421897699675382, -0.1149753672458998, 0], [0.24421897699675382, -0.07127476967088009, 0], [0.24421897699675382, -0.027574172095860328, 0], [0.24421897699675382, 0.01612642547915938, 0], [0.24421897699675382, 0.059827023054179085, 0], [0.24421897699675382, 0.10352762062919879, 0]],
[[0.2686408746964292, 0.10352762062919878, 0], [0.2686408746964292, 0.05982702305417906, 0], [0.2686408746964292, 0.016126425479159337, 0], [0.2686408746964292, -0.027574172095860397, 0], [0.2686408746964292, -0.0712747696708801, 0], [0.2686408746964292, -0.11497536724589981, 0], [0.2686408746964292, -0.15867596482091956, 0], [0.2686408746964292, -0.20237656239593926, 0], [0.2686408746964292, -0.24607715997095897, 0], [0.2686408746964292, -0.2897777575459787, 0]],
[[0.29306277239610456, -0.2897777575459787, 0], [0.29306277239610456, -0.24607715997095897, 0], [0.29306277239610456, -0.20237656239593924, 0], [0.29306277239610456, -0.1586759648209195, 0], [0.29306277239610456, -0.1149753672458998, 0], [0.29306277239610456, -0.07127476967088009, 0], [0.29306277239610456, -0.027574172095860328, 0], [0.29306277239610456, 0.01612642547915938, 0], [0.29306277239610456, 0.059827023054179085, 0], [0.29306277239610456, 0.10352762062919879, 0]],
[[0.31748467009577996, 0.10352762062919878, 0], [0.31748467009577996, 0.05982702305417906, 0], [0.31748467009577996, 0.016126425479159337, 0], [0.31748467009577996, -0.027574172095860397, 0], [0.31748467009577996, -0.0712747696708801, 0], [0.31748467009577996, -0.11497536724589981, 0], [0.31748467009577996, -0.15867596482091956, 0], [0.31748467009577996, -0.20237656239593926, 0], [0.31748467009577996, -0.24607715997095897, 0], [0.31748467009577996, -0.2897777575459787, 0]],
[[0.34190656779545536, -0.2897777575459787, 0], [0.34190656779545536, -0.24607715997095897, 0], [0.34190656779545536, -0.20237656239593924, 0], [0.34190656779545536, -0.1586759648209195, 0], [0.34190656779545536, -0.1149753672458998, 0], [0.34190656779545536, -0.07127476967088009, 0], [0.34190656779545536, -0.027574172095860328, 0], [0.34190656779545536, 0.01612642547915938, 0], [0.34190656779545536, 0.059827023054179085, 0], [0.34190656779545536, 0.10352762062919879, 0]],
[[0.3663284654951307, 0.10352762062919878, 0], [0.3663284654951307, 0.05982702305417906, 0], [0.3663284654951307, 0.016126425479159337, 0], [0.3663284654951307, -0.027574172095860397, 0], [0.3663284654951307, -0.0712747696708801, 0], [0.3663284654951307, -0.11497536724589981, 0], [0.3663284654951307, -0.15867596482091956, 0], [0.3663284654951307, -0.20237656239593926, 0], [0.3663284654951307, -0.24607715997095897, 0], [0.3663284654951307, -0.2897777575459787, 0]],
[[0.3907503631948061, -0.2897777575459787, 0], [0.3907503631948061, -0.24607715997095897, 0], [0.3907503631948061, -0.20237656239593924, 0], [0.3907503631948061, -0.1586759648209195, 0], [0.3907503631948061, -0.1149753672458998, 0], [0.3907503631948061, -0.07127476967088009, 0], [0.3907503631948061, -0.027574172095860328, 0], [0.3907503631948061, 0.01612642547915938, 0], [0.3907503631948061, 0.059827023054179085, 0], [0.3907503631948061, 0.10352762062919879, 0]],
[[0.4151722608944815, 0.10352762062919878, 0], [0.4151722608944815, 0.05982702305417906, 0], [0.4151722608944815, 0.016126425479159337, 0], [0.4151722608944815, -0.027574172095860397, 0], [0.4151722608944815, -0.0712747696708801, 0], [0.4151722608944815, -0.11497536724589981, 0], [0.4151722608944815, -0.15867596482091956, 0], [0.4151722608944815, -0.20237656239593926, 0], [0.4151722608944815, -0.24607715997095897, 0], [0.4151722608944815, -0.2897777575459787, 0]],
[[0.43959415859415685, -0.2897777575459787, 0], [0.43959415859415685, -0.24607715997095897, 0], [0.43959415859415685, -0.20237656239593924, 0], [0.43959415859415685, -0.1586759648209195, 0], [0.43959415859415685, -0.1149753672458998, 0], [0.43959415859415685, -0.07127476967088009, 0], [0.43959415859415685, -0.027574172095860328, 0], [0.43959415859415685, 0.01612642547915938, 0], [0.43959415859415685, 0.059827023054179085, 0], [0.43959415859415685, 0.10352762062919879, 0]],
[[0.46401605629383225, 0.10352762062919878, 0], [0.46401605629383225, 0.05982702305417906, 0], [0.46401605629383225, 0.016126425479159337, 0], [0.46401605629383225, -0.027574172095860397, 0], [0.46401605629383225, -0.0712747696708801, 0], [0.46401605629383225, -0.11497536724589981, 0], [0.46401605629383225, -0.15867596482091956, 0], [0.46401605629383225, -0.20237656239593926, 0], [0.46401605629383225, -0.24607715997095897, 0], [0.46401605629383225, -0.2897777575459787, 0]]]
ctrlpts = [[[-7.61089252801589e-18, -0.2897777575459787, 0], [-7.61089252801589e-18, -0.24607715997095897, 0], [-7.61089252801589e-18, -0.20237656239593924, 0], [-7.61089252801589e-18, -0.1586759648209195, 0], [-7.61089252801589e-18, -0.1149753672458998, 0], [-7.61089252801589e-18, -0.07127476967088009, 0], [-7.61089252801589e-18, -0.027574172095860328, 0], [-7.61089252801589e-18, 0.01612642547915938, 0], [-7.61089252801589e-18, 0.059827023054179085, 0], [-7.61089252801589e-18, 0.10352762062919879, 0]],
[[0.048843795399350756, -0.2897777575459787, 0], [0.048843795399350756, -0.24607715997095897, 0], [0.048843795399350756, -0.20237656239593924, 0], [0.048843795399350756, -0.1586759648209195, 0], [0.048843795399350756, -0.1149753672458998, 0], [0.048843795399350756, -0.07127476967088009, 0], [0.048843795399350756, -0.027574172095860328, 0], [0.048843795399350756, 0.01612642547915938, 0], [0.048843795399350756, 0.059827023054179085, 0], [0.048843795399350756, 0.10352762062919879, 0]],
[[0.09768759079870151, -0.2897777575459787, 0], [0.09768759079870151, -0.24607715997095897, 0], [0.09768759079870151, -0.20237656239593924, 0], [0.09768759079870151, -0.1586759648209195, 0], [0.09768759079870151, -0.1149753672458998, 0], [0.09768759079870151, -0.07127476967088009, 0], [0.09768759079870151, -0.027574172095860328, 0], [0.09768759079870151, 0.01612642547915938, 0], [0.09768759079870151, 0.059827023054179085, 0], [0.09768759079870151, 0.10352762062919879, 0]],
[[0.14653138619805228, -0.2897777575459787, 0], [0.14653138619805228, -0.24607715997095897, 0], [0.14653138619805228, -0.20237656239593924, 0], [0.14653138619805228, -0.1586759648209195, 0], [0.14653138619805228, -0.1149753672458998, 0], [0.14653138619805228, -0.07127476967088009, 0], [0.14653138619805228, -0.027574172095860328, 0], [0.14653138619805228, 0.01612642547915938, 0], [0.14653138619805228, 0.059827023054179085, 0], [0.14653138619805228, 0.10352762062919879, 0]],
[[0.19537518159740305, -0.2897777575459787, 0], [0.19537518159740305, -0.24607715997095897, 0], [0.19537518159740305, -0.20237656239593924, 0], [0.19537518159740305, -0.1586759648209195, 0], [0.19537518159740305, -0.1149753672458998, 0], [0.19537518159740305, -0.07127476967088009, 0], [0.19537518159740305, -0.027574172095860328, 0], [0.19537518159740305, 0.01612642547915938, 0], [0.19537518159740305, 0.059827023054179085, 0], [0.19537518159740305, 0.10352762062919879, 0]],
[[0.24421897699675382, -0.2897777575459787, 0], [0.24421897699675382, -0.24607715997095897, 0], [0.24421897699675382, -0.20237656239593924, 0], [0.24421897699675382, -0.1586759648209195, 0], [0.24421897699675382, -0.1149753672458998, 0], [0.24421897699675382, -0.07127476967088009, 0], [0.24421897699675382, -0.027574172095860328, 0], [0.24421897699675382, 0.01612642547915938, 0], [0.24421897699675382, 0.059827023054179085, 0], [0.24421897699675382, 0.10352762062919879, 0]],
[[0.29306277239610456, -0.2897777575459787, 0], [0.29306277239610456, -0.24607715997095897, 0], [0.29306277239610456, -0.20237656239593924, 0], [0.29306277239610456, -0.1586759648209195, 0], [0.29306277239610456, -0.1149753672458998, 0], [0.29306277239610456, -0.07127476967088009, 0], [0.29306277239610456, -0.027574172095860328, 0], [0.29306277239610456, 0.01612642547915938, 0], [0.29306277239610456, 0.059827023054179085, 0], [0.29306277239610456, 0.10352762062919879, 0]],
[[0.34190656779545536, -0.2897777575459787, 0], [0.34190656779545536, -0.24607715997095897, 0], [0.34190656779545536, -0.20237656239593924, 0], [0.34190656779545536, -0.1586759648209195, 0], [0.34190656779545536, -0.1149753672458998, 0], [0.34190656779545536, -0.07127476967088009, 0], [0.34190656779545536, -0.027574172095860328, 0], [0.34190656779545536, 0.01612642547915938, 0], [0.34190656779545536, 0.059827023054179085, 0], [0.34190656779545536, 0.10352762062919879, 0]],
[[0.3907503631948061, -0.2897777575459787, 0], [0.3907503631948061, -0.24607715997095897, 0], [0.3907503631948061, -0.20237656239593924, 0], [0.3907503631948061, -0.1586759648209195, 0], [0.3907503631948061, -0.1149753672458998, 0], [0.3907503631948061, -0.07127476967088009, 0], [0.3907503631948061, -0.027574172095860328, 0], [0.3907503631948061, 0.01612642547915938, 0], [0.3907503631948061, 0.059827023054179085, 0], [0.3907503631948061, 0.10352762062919879, 0]],
[[0.43959415859415685, -0.2897777575459787, 0], [0.43959415859415685, -0.24607715997095897, 0], [0.43959415859415685, -0.20237656239593924, 0], [0.43959415859415685, -0.1586759648209195, 0], [0.43959415859415685, -0.1149753672458998, 0], [0.43959415859415685, -0.07127476967088009, 0], [0.43959415859415685, -0.027574172095860328, 0], [0.43959415859415685, 0.01612642547915938, 0], [0.43959415859415685, 0.059827023054179085, 0], [0.43959415859415685, 0.10352762062919879, 0]]]
ctrlpts = [[[-7.61089252801589e-18, -0.2897777575459787, 0.24128292790000003], [-7.61089252801589e-18, -0.24607715997095897, 0.23866529070000003], [-7.61089252801589e-18, -0.20237656239593924, 0.2367717987], [-7.61089252801589e-18, -0.1586759648209195, 0.24234888940000002], [-7.61089252801589e-18, -0.1149753672458998, 0.2389167365], [-7.61089252801589e-18, -0.07127476967088009, 0.2431076015], [-7.61089252801589e-18, -0.027574172095860328, 0.24193291749999998], [-7.61089252801589e-18, 0.01612642547915938, 0.24012009532999998], [-7.61089252801589e-18, 0.059827023054179085, 0.228174578], [-7.61089252801589e-18, 0.10352762062919879, 0.229347744]], [[0.024421897699675375, -0.2897777575459787, 0.2381480632], [0.024421897699675375, -0.24607715997095897, 0.23866529070000003], [0.024421897699675375, -0.20237656239593924, 0.2367717987], [0.024421897699675375, -0.1586759648209195, 0.24198836720000003], [0.024421897699675375, -0.1149753672458998, 0.23931915890000002], [0.024421897699675375, -0.07127476967088009, 0.23319710999999999], [0.024421897699675375, -0.027574172095860328, 0.232682633], [0.024421897699675375, 0.01612642547915938, 0.229347744], [0.024421897699675375, 0.059827023054179085, 0.222313173], [0.024421897699675375, 0.10352762062919879, 0.21708676899999998]], [[0.048843795399350756, -0.2897777575459787, 0.2381480632], [0.048843795399350756, -0.24607715997095897, 0.23971904967000002], [0.048843795399350756, -0.20237656239593924, 0.23941031932], [0.048843795399350756, -0.1586759648209195, 0.23264622810000002], [0.048843795399350756, -0.1149753672458998, 0.23551773680000002], [0.048843795399350756, -0.07127476967088009, 0.225225547], [0.048843795399350756, -0.027574172095860328, 0.223425943], [0.048843795399350756, 0.01612642547915938, 0.21708676899999998], [0.048843795399350756, 0.059827023054179085, 0.213317081], [0.048843795399350756, 0.10352762062919879, 0.208976675]], [[0.07326569309902613, -0.2897777575459787, 0.2403961699], [0.07326569309902613, -0.24607715997095897, 0.23167925960000002], [0.07326569309902613, -0.20237656239593924, 0.23291311110000001], [0.07326569309902613, -0.1586759648209195, 0.227828352], [0.07326569309902613, -0.1149753672458998, 0.222709868], [0.07326569309902613, -0.07127476967088009, 0.21650994499999998], [0.07326569309902613, -0.027574172095860328, 0.214997103], [0.07326569309902613, 0.01612642547915938, 0.208976675], [0.07326569309902613, 0.059827023054179085, 0.204813069], [0.07326569309902613, 0.10352762062919879, 0.20695907]], [[0.09768759079870151, -0.2897777575459787, 0.229500361], [0.09768759079870151, -0.24607715997095897, 0.22854929100000002], [0.09768759079870151, -0.20237656239593924, 0.22066884700000003], [0.09768759079870151, -0.1586759648209195, 0.21862977000000003], [0.09768759079870151, -0.1149753672458998, 0.21582428500000003], [0.09768759079870151, -0.07127476967088009, 0.211354773], [0.09768759079870151, -0.027574172095860328, 0.208851874], [0.09768759079870151, 0.01612642547915938, 0.204235578], [0.09768759079870151, 0.059827023054179085, 0.20185667399999999], [0.09768759079870151, 0.10352762062919879, 0.202759823]], [[0.1221094884983769, -0.2897777575459787, 0.22200751500000002], [0.1221094884983769, -0.24607715997095897, 0.21814036300000003], [0.1221094884983769, -0.20237656239593924, 0.21267818300000002], [0.1221094884983769, -0.1586759648209195, 0.21044493100000003], [0.1221094884983769, -0.1149753672458998, 0.207020784], [0.1221094884983769, -0.07127476967088009, 0.20556106999999998], [0.1221094884983769, -0.027574172095860328, 0.201062729], [0.1221094884983769, 0.01612642547915938, 0.197511831], [0.1221094884983769, 0.059827023054179085, 0.195832601], [0.1221094884983769, 0.10352762062919879, 0.193345452]], [[0.14653138619805228, -0.2897777575459787, 0.211311675], [0.14653138619805228, -0.24607715997095897, 0.20956684300000003], [0.14653138619805228, -0.20237656239593924, 0.20713202800000002], [0.14653138619805228, -0.1586759648209195, 0.20604932100000004], [0.14653138619805228, -0.1149753672458998, 0.20194529900000002], [0.14653138619805228, -0.07127476967088009, 0.203969149], [0.14653138619805228, -0.027574172095860328, 0.199576122], [0.14653138619805228, 0.01612642547915938, 0.19421761999999998], [0.14653138619805228, 0.059827023054179085, 0.192907857], [0.14653138619805228, 0.10352762062919879, 0.194479408]], [[0.17095328389772768, -0.2897777575459787, 0.207531335], [0.17095328389772768, -0.24607715997095897, 0.20450680100000002], [0.17095328389772768, -0.20237656239593924, 0.20307632700000003], [0.17095328389772768, -0.1586759648209195, 0.198040986], [0.17095328389772768, -0.1149753672458998, 0.19598473800000002], [0.17095328389772768, -0.07127476967088009, 0.194385906], [0.17095328389772768, -0.027574172095860328, 0.19596861799999998], [0.17095328389772768, 0.01612642547915938, 0.19314960199999998], [0.17095328389772768, 0.059827023054179085, 0.19418976599999999], [0.17095328389772768, 0.10352762062919879, 0.194676423]], [[0.19537518159740305, -0.2897777575459787, 0.20314200400000001], [0.19537518159740305, -0.24607715997095897, 0.19578809100000003], [0.19537518159740305, -0.20237656239593924, 0.194028316], [0.19537518159740305, -0.1586759648209195, 0.19421588000000004], [0.19537518159740305, -0.1149753672458998, 0.19265553500000002], [0.19537518159740305, -0.07127476967088009, 0.19474430500000003], [0.19537518159740305, -0.027574172095860328, 0.191584667], [0.19537518159740305, 0.01612642547915938, 0.192335443], [0.19537518159740305, 0.059827023054179085, 0.190259548], [0.19537518159740305, 0.10352762062919879, 0.193471575]], [[0.21979707929707842, -0.2897777575459787, 0.199092703], [0.21979707929707842, -0.24607715997095897, 0.19369303200000001], [0.21979707929707842, -0.20237656239593924, 0.19420942100000002], [0.21979707929707842, -0.1586759648209195, 0.19253541700000001], [0.21979707929707842, -0.1149753672458998, 0.19179110800000002], [0.21979707929707842, -0.07127476967088009, 0.19453510100000002], [0.21979707929707842, -0.027574172095860328, 0.189472547], [0.21979707929707842, 0.01612642547915938, 0.19585302999999998], [0.21979707929707842, 0.059827023054179085, 0.19295927699999998], [0.21979707929707842, 0.10352762062919879, 0.192552408]], [[0.24421897699675382, -0.2897777575459787, 0.19353207700000002], [0.24421897699675382, -0.24607715997095897, 0.19170584300000001], [0.24421897699675382, -0.20237656239593924, 0.19206821300000002], [0.24421897699675382, -0.1586759648209195, 0.19422611000000004], [0.24421897699675382, -0.1149753672458998, 0.192600542], [0.24421897699675382, -0.07127476967088009, 0.19003549400000003], [0.24421897699675382, -0.027574172095860328, 0.194571098], [0.24421897699675382, 0.01612642547915938, 0.194581227], [0.24421897699675382, 0.059827023054179085, 0.194531569], [0.24421897699675382, 0.10352762062919879, 0.198418965]], [[0.2686408746964292, -0.2897777575459787, 0.19071410400000002], [0.2686408746964292, -0.24607715997095897, 0.19266366000000001], [0.2686408746964292, -0.20237656239593924, 0.19471749100000002], [0.2686408746964292, -0.1586759648209195, 0.193096081], [0.2686408746964292, -0.1149753672458998, 0.19155679100000003], [0.2686408746964292, -0.07127476967088009, 0.19405540200000002], [0.2686408746964292, -0.027574172095860328, 0.193873768], [0.2686408746964292, 0.01612642547915938, 0.197695585], [0.2686408746964292, 0.059827023054179085, 0.200295174], [0.2686408746964292, 0.10352762062919879, 0.19943571999999998]], [[0.29306277239610456, -0.2897777575459787, 0.19043683400000003], [0.29306277239610456, -0.24607715997095897, 0.192143632], [0.29306277239610456, -0.20237656239593924, 0.192500883], [0.29306277239610456, -0.1586759648209195, 0.19186572100000002], [0.29306277239610456, -0.1149753672458998, 0.197159292], [0.29306277239610456, -0.07127476967088009, 0.19304413100000004], [0.29306277239610456, -0.027574172095860328, 0.201695142], [0.29306277239610456, 0.01612642547915938, 0.20155146499999999], [0.29306277239610456, 0.059827023054179085, 0.200350636], [0.29306277239610456, 0.10352762062919879, 0.209189204]], [[0.31748467009577996, -0.2897777575459787, 0.190993817], [0.31748467009577996, -0.24607715997095897, 0.19214587500000002], [0.31748467009577996, -0.20237656239593924, 0.197977854], [0.31748467009577996, -0.1586759648209195, 0.20169926600000002], [0.31748467009577996, -0.1149753672458998, 0.20004697300000002], [0.31748467009577996, -0.07127476967088009, 0.19732170000000002], [0.31748467009577996, -0.027574172095860328, 0.20536218], [0.31748467009577996, 0.01612642547915938, 0.20628407799999998], [0.31748467009577996, 0.059827023054179085, 0.20652380399999998], [0.31748467009577996, 0.10352762062919879, 0.213951269]], [[0.34190656779545536, -0.2897777575459787, 0.20206964900000002], [0.34190656779545536, -0.24607715997095897, 0.19896244400000002], [0.34190656779545536, -0.20237656239593924, 0.19790584400000003], [0.34190656779545536, -0.1586759648209195, 0.20123195400000002], [0.34190656779545536, -0.1149753672458998, 0.20238759200000003], [0.34190656779545536, -0.07127476967088009, 0.20602075500000003], [0.34190656779545536, -0.027574172095860328, 0.20873628700000002], [0.34190656779545536, 0.01612642547915938, 0.212779859], [0.34190656779545536, 0.059827023054179085, 0.22190385099999999], [0.34190656779545536, 0.10352762062919879, 0.22182027599999998]], [[0.3663284654951307, -0.2897777575459787, 0.20067726600000002], [0.3663284654951307, -0.24607715997095897, 0.20478332200000002], [0.3663284654951307, -0.20237656239593924, 0.19872739700000003], [0.3663284654951307, -0.1586759648209195, 0.20437576000000002], [0.3663284654951307, -0.1149753672458998, 0.21054040200000002], [0.3663284654951307, -0.07127476967088009, 0.213384498], [0.3663284654951307, -0.027574172095860328, 0.21837466000000003], [0.3663284654951307, 0.01612642547915938, 0.21788587799999998], [0.3663284654951307, 0.059827023054179085, 0.22929255499999998], [0.3663284654951307, 0.10352762062919879, 0.23501573669999998]], [[0.3907503631948061, -0.2897777575459787, 0.20515258000000003], [0.3907503631948061, -0.24607715997095897, 0.203681199], [0.3907503631948061, -0.20237656239593924, 0.21017697200000002], [0.3907503631948061, -0.1586759648209195, 0.21418501800000003], [0.3907503631948061, -0.1149753672458998, 0.22149628200000002], [0.3907503631948061, -0.07127476967088009, 0.223567176], [0.3907503631948061, -0.027574172095860328, 0.22723658500000002], [0.3907503631948061, 0.01612642547915938, 0.2310638863], [0.3907503631948061, 0.059827023054179085, 0.2368903274], [0.3907503631948061, 0.10352762062919879, 0.23595058989999998]], [[0.4151722608944815, -0.2897777575459787, 0.21017697200000002], [0.4151722608944815, -0.24607715997095897, 0.21199497400000003], [0.4151722608944815, -0.20237656239593924, 0.21927304900000003], [0.4151722608944815, -0.1586759648209195, 0.22315062200000002], [0.4151722608944815, -0.1149753672458998, 0.22857133500000001], [0.4151722608944815, -0.07127476967088009, 0.22965230400000003], [0.4151722608944815, -0.027574172095860328, 0.23310139800000002], [0.4151722608944815, 0.01612642547915938, 0.2377484811], [0.4151722608944815, 0.059827023054179085, 0.24010860769], [0.4151722608944815, 0.10352762062919879, 0.24123687459999998]], [[0.43959415859415685, -0.2897777575459787, 0.21927304900000003], [0.43959415859415685, -0.24607715997095897, 0.22320697400000003], [0.43959415859415685, -0.20237656239593924, 0.228991882], [0.43959415859415685, -0.1586759648209195, 0.23194888030000002], [0.43959415859415685, -0.1149753672458998, 0.23462873860000003], [0.43959415859415685, -0.07127476967088009, 0.2368263197], [0.43959415859415685, -0.027574172095860328, 0.24436860180000003], [0.43959415859415685, 0.01612642547915938, 0.239770729], [0.43959415859415685, 0.059827023054179085, 0.23700326359999999], [0.43959415859415685, 0.10352762062919879, 0.24123687459999998]], [[0.46401605629383225, -0.2897777575459787, 0.228991882], [0.46401605629383225, -0.24607715997095897, 0.23116480350000002], [0.46401605629383225, -0.20237656239593924, 0.24043857086], [0.46401605629383225, -0.1586759648209195, 0.23477968500000002], [0.46401605629383225, -0.1149753672458998, 0.24412456880000002], [0.46401605629383225, -0.07127476967088009, 0.24255738620000003], [0.46401605629383225, -0.027574172095860328, 0.24111023780000002], [0.46401605629383225, 0.01612642547915938, 0.239770729], [0.46401605629383225, 0.059827023054179085, 0.23700326359999999], [0.46401605629383225, 0.10352762062919879, 0.2416414023]]]
print(len(ctrlpts))
print(len(ctrlpts[0]))
# Create a BSpline surface
surf = BSpline.Surface()
# Set degrees
surf.degree_u = 3
surf.degree_v = 3
# Set control points
surf.ctrlpts2d = ctrlpts
# Set knot vectors
# v的维数 = 3+每条路多少点+1
# # u的维数 = 3+多少条路+1
knotvector_v=[]
count=0.0
for i in range(len(ctrlpts[0])+4):
knotvector_v.append(count)
if i>1:
if i-1<len(ctrlpts[0]):
if (i-3)%2==0:
count+=1.0
print(knotvector_v)
surf.knotvector_v = knotvector_v
knotvector_u=[]
count=0.0
for i in range(len(ctrlpts)+4):
knotvector_u.append(count)
if i>1:
if i-1<len(ctrlpts):
if (i-3)%2==0:
count+=1.0
print(knotvector_u)
surf.knotvector_u = knotvector_u
# Set evaluation delta
surf.delta = 0.025
# Evaluate surface points
surf.evaluate()
# Import and use Matplotlib's colormaps
from matplotlib import cm
# # Plot the control points grid and the evaluated surface
# surf.vis = VisMPL.VisSurface()
# surf.render(colormap=cm.cool)
# # Visualize data and evaluated points together
import numpy as np
import matplotlib.pyplot as plt
evalpts = np.array(surf.evalpts)
pts=[]
for i in range(len(ctrlpts)):
for j in range(len(ctrlpts[1])):
pts.append(ctrlpts[i][j])
pts = np.array(pts)
# print(pts[:, 0])
# print(evalpts)
fig = plt.figure()
ax = plt.axes(projection='3d')
ax.scatter(evalpts[:, 0], evalpts[:, 1], evalpts[:, 2])
ax.scatter(pts[:, 0], pts[:, 1], pts[:, 2], color="red")
plt.show()
运行结果:
完整的运行代码:
#! /usr/bin/env python3.8
# encoding: utf-8
import open3d as o3d
import copy
import numpy as np
import math
import rospy
from geometry_msgs.msg import PoseStamped
from pyquaternion import Quaternion
from sensor_msgs.msg import PointCloud2, PointField
from sensor_msgs import point_cloud2
from std_msgs.msg import Header
from sklearn.linear_model import RANSACRegressor
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegression
import geomdl
from geomdl import BSpline
import numpy as np
import matplotlib.pyplot as plt
## 函数区
# 拟合曲面
def nihequmm(xmin,xmax,ymin,ymax,Nx,points,step_num):
paths = []
dx = float(xmax-xmin)/(Nx-1) # the y step-over
path=[]
for n in range(0,Nx):
x = xmin+n*dx # current y-coordinate
p1 = [x,ymin,0] # start-point of line
p2 = [x,ymax,0] # end-point of line
path.append(p1) # add the line to the path
path.append(p2)
fpath=[]
path_n=[]
n=len(path)
for i in range(n//2):
path_temp=[]
for j in range(step_num):
p=[path[2*i][0],path[2*i][1]+j*step,path[2*i][2]]
temp=[]
for m in range(len(points)):
temp.append(math.sqrt((p[0]-points[m][0])**2+(p[1]-points[m][1])**2))
min_index=np.argmin(temp)
# print(min_value)
p[2]=points[min_index][2]
path_temp.append(p)
path_n.append(path_temp)
# 中间点
# Control points
ctrlpts = path_n
# Create a BSpline surface
surf = BSpline.Surface()
# Set degrees
surf.degree_u = 3
surf.degree_v = 3
# Set control points
surf.ctrlpts2d = ctrlpts
# Set knot vectors
# v的维数 = 3+每条路多少点+1 len(ctrlpts)
# u的维数 = 3+多少条路+1 len(ctrlpts[0])
knotvector_v=[]
count=0.0
for i in range(len(ctrlpts[0])+4):
knotvector_v.append(count)
if i>1:
if i-1<len(ctrlpts[0]):
if (i-3)%2==0:
count+=1.0
print(knotvector_v)
surf.knotvector_v = knotvector_v
knotvector_u=[]
count=0.0
for i in range(len(ctrlpts)+4):
knotvector_u.append(count)
if i>1:
if i-1<len(ctrlpts):
if (i-3)%2==0:
count+=1.0
print(knotvector_u)
surf.knotvector_u = knotvector_u
# Set evaluation delta
surf.delta = 0.025
# Evaluate surface points
surf.evaluate()
# 拟合好的点,相当于points
evalpts = np.array(surf.evalpts)
# # Visualize data and evaluated points together
evalpts = np.array(surf.evalpts)
pts=[]
for i in range(len(ctrlpts)):
for j in range(len(ctrlpts[1])):
pts.append(ctrlpts[i][j])
pts = np.array(pts)
print(pts[:, 0])
fig = plt.figure()
ax = plt.axes(projection='3d')
ax.scatter(evalpts[:, 0], evalpts[:, 1], evalpts[:, 2])
ax.scatter(pts[:, 0], pts[:, 1], pts[:, 2], color="red")
plt.show()
return evalpts,ctrlpts
# 考虑x/y方向的路径
def XdirectionZigPath(xmin,xmax,ymin,ymax,Nx):
paths = []
dx = float(xmax-xmin)/(Nx-1) # the y step-over
flag=1 #奇偶分别
path=[]
for n in range(0,Nx):
x = xmin+n*dx # current y-coordinate
# if (n==Nx-1):
# assert( x==xmax)
# elif (n==0):
# assert( x==xmin)
if flag==1:
p1 = [x,ymin,0] # start-point of line
p2 = [x,ymax,0] # end-point of line
# print(flag)
if flag==-2:
p1 = [x,ymax,0] # start-point of line
p2 = [x,ymin,0] # end-point of line
# print(flag)
path.append(p1) # add the line to the path
path.append(p2)
flag=~flag
# paths.append(path)
return path
# 得到步进x/y方向的路径
def feedPath(path,step,step_num):
flag=1 #奇偶分别
fpath=[]
path_n=[]
n=len(path)
for i in range(n//2):
path_temp=[]
for j in range(step_num):
if flag==1:
p=[path[2*i][0],path[2*i][1]+j*step,path[2*i][2]]
if flag==-2:
p=[path[2*i][0],path[2*i][1]-j*step,path[2*i][2]]
fpath.append(p)
path_temp.append(p)
path_n.append(path_temp)
flag=~flag
return fpath,path_n
# 依据点云坐标得到z方向的坐标
# def ZdirectionPath(fpath,points,normals,scan_height,rapid_height):
# zpath=[]
# npath=[]
# n=len(fpath)
# # 初始点
# zpath.append([fpath[0][0],fpath[0][1],rapid_height])
# npath.append([0,0,-1])
# # 中间点
# for i in range(n):
# temp=[]
# for m in range(len(points)):
# temp.append(math.sqrt((fpath[i][0]-points[m][0])**2+(fpath[i][1]-points[m][1])**2))
# min_value=np.min(temp)
# min_index=np.argmin(temp)
# # print(min_value)
# # 如果大于阈值,说明当前位置没有被选上,于是点就会被舍去
# threshold=0.004 #阈值可修改
# if min_value<threshold:
# scan_z=points[min_index][2]+scan_height
# zpath.append([fpath[i][0],fpath[i][1],scan_z])
# npath.append([normals[min_index][0],normals[min_index][1],normals[min_index][2]])
# # 结束点
# zpath.append([fpath[n-1][0],fpath[n-1][1],rapid_height])
# npath.append([0,0,-1])
# # 修改初始点和结束点
# return zpath,npath
# # 依据点云坐标得到z方向的坐标
# def ZdirectionPath(fpath,points,normals,scan_height,rapid_height,flag_curve):
# zpath=[]
# npath=[]
# temp_npath_x=[]
# temp_npath_y=[]
# temp_npath_z=[]
# n=len(fpath)
# # 修改rapid height
# zmax=np.max(points[:,2])
# # 拟合平面,基于SVD奇异值分解
# # 拟合平面,基于SANSAC
# # 提取点云中的 x, y, z 坐标
# x = points[:, 0]
# y = points[:, 1]
# z = points[:, 2]
# # 创建特征矩阵
# X = np.column_stack((x, y))
# # 创建 RANSACRegressor 模型
# model = RANSACRegressor()
# # 拟合平面
# model.fit(X, z)
# # 获取平面参数
# a, b = model.estimator_.coef_
# c = model.estimator_.intercept_
# # 打印平面方程
# print(f"拟合的平面方程为: z = {a:.3f}x + {b:.3f}y + {c:.3f}")
# # 初始点
# zpath.append([fpath[0][0],fpath[0][1],zmax+rapid_height])
# npath.append([0,0,-1])
# # 中间点
# for i in range(n):
# temp=[]
# for m in range(len(points)):
# temp.append(math.sqrt((fpath[i][0]-points[m][0])**2+(fpath[i][1]-points[m][1])**2))
# min_index=np.argmin(temp)
# # print(min_index)
# # scan_z=points[min_index][2]+scan_height # 之前没有拟合的z坐标
# scan_z=a*fpath[i][0] + b*fpath[i][1] + c+scan_height
# zpath.append([fpath[i][0],fpath[i][1],scan_z])
# # 曲面法向量用这个
# if flag_curve==1:
# npath.append([normals[min_index][0],normals[min_index][1],normals[min_index][2]])
# # 平面法向量用这个
# else:
# # 保存法向量
# temp_npath_x.append(normals[min_index][0])
# temp_npath_y.append(normals[min_index][1])
# temp_npath_z.append(normals[min_index][2])
# # 记得改回来
# # npath.append([0,0,-1])
# # 法向量平均
# if flag_curve==0:
# for i in range(n):
# npath.append([np.mean(temp_npath_x),np.mean(temp_npath_y),np.mean(temp_npath_z)])
# # 结束点
# zpath.append([fpath[n-1][0],fpath[n-1][1],zmax+rapid_height])
# npath.append([0,0,-1])
# return zpath,npath
# 依据点云坐标得到z方向的坐标
def ZdirectionPath(fpath,path_n,points,normals,scan_height,rapid_height,flag_curve):
zpath=[]
npath=[]
# 提取点云中的 x, y, z 坐标
x = points[:, 0]
y = points[:, 1]
z = points[:, 2]
n=len(fpath)
# 修改rapid height
zmax=np.max(points[:,2])
if flag_curve==0:
# 拟合平面,基于SANSAC
# 创建特征矩阵
X = np.column_stack((x, y))
# 创建 RANSACRegressor 模型
model = RANSACRegressor()
# 拟合平面
model.fit(X, z)
# 获取平面参数
a, b = model.estimator_.coef_
c = model.estimator_.intercept_
# 打印平面方程
print(f"拟合的平面方程为: z = {a:.3f}x + {b:.3f}y + {c:.3f}")
# 初始点
zpath.append([fpath[0][0],fpath[0][1],zmax+rapid_height])
npath.append([0,0,-1])
# 中间点
for i in range(n):
# 平面路径
scan_z=a*fpath[i][0] + b*fpath[i][1] + c+scan_height
zpath.append([fpath[i][0],fpath[i][1],scan_z])
# 平面法向量
npath.append([a,b,-1])
# 结束点
zpath.append([fpath[n-1][0],fpath[n-1][1],zmax+rapid_height])
npath.append([0,0,-1])
else:
pass
return zpath,npath
# 主函数
if __name__ == "__main__":
mesh_frame = o3d.geometry.TriangleMesh.create_coordinate_frame(size=0.1, origin=[0, 0, 0])
# data = o3d.io.read_point_cloud("./src/data/point_cloud/pointcloud_1.pcd")
# data = o3d.io.read_point_cloud("./src/data/point_cloud/pointcloud_init.pcd")
data = o3d.io.read_point_cloud("./src/data/curvenoise.pcd")
# o3d.visualization.draw_geometries([data,mesh_frame])
# 红色:x
# 绿色:y
# 蓝色:z
# 使用欧拉角创建旋转矩阵
pcd = copy.deepcopy(data).translate((0, 0, -0.24))
# o3d.visualization.draw_geometries([pcd,mesh_frame])
# 旋转网格
R = mesh_frame.get_rotation_matrix_from_xyz((np.pi, 0, 0))
pcd.rotate(R, center=(0, 0, 0))
R = mesh_frame.get_rotation_matrix_from_xyz((0, 0, np.pi/12))
pcd.rotate(R, center=(0, 0, 0))
# o3d.visualization.draw_geometries([pcd,mesh_frame])
# 交互选区
vis = o3d.visualization.VisualizerWithVertexSelection()
vis.create_window(window_name='select region holding shift', visible=True)
vis.add_geometry(pcd)
vis.run()
point = vis.get_picked_points()
vis.destroy_window()
# print(point[0].index, np.asarray(point[0].coord))
# 原文链接:https://blog.csdn.net/qq_45912037/article/details/127096161
point_temp=[]
for i in range(len(point)):
point_temp.append(point[i].coord)
outlier_cloud = o3d.geometry.PointCloud()# 传入3d点云
outlier_cloud.points = o3d.utility.Vector3dVector(point_temp) # point_points 二维 numpy 矩阵,将其转换为 open3d 点云格式
# o3d.visualization.draw_geometries([outlier_cloud,mesh_frame])
# 计算法向量
outlier_cloud.estimate_normals(
search_param=o3d.geometry.KDTreeSearchParamKNN(knn=200) # 计算近邻的20个点
)
o3d.geometry.PointCloud.orient_normals_to_align_with_direction(outlier_cloud, orientation_reference=np.array([0.0, 0.0, -1.0])) #设定法向量在z轴方向上,全部z轴正方向一致
normals = np.array(outlier_cloud.normals) # 法向量结果与点云维度一致(N, 3)
points = np.array(outlier_cloud.points)
# print(points)
# 法向量可视化
# o3d.visualization.draw_geometries([outlier_cloud,mesh_frame],
# window_name="Open3d",
# point_show_normal=True,
# width=800, # 窗口宽度
# height=600) # 窗口高度
# 获取工件x/y方向的最大值和最小值
xmin=np.min(points[:,0])
xmax=np.max(points[:,0])
ymin=np.min(points[:,1])
ymax=np.max(points[:,1])
# 参数
Nx=rospy.get_param("Nx",20) # number of lines in the x-direction
step_num=rospy.get_param("step_num",10)
scan_height_int=rospy.get_param("scan_height_int",10)
rapid_height_int=rospy.get_param("rapid_height_int",20)
flag_curve=rospy.get_param("flag_curve",0) # 曲面是1,平面是0
# 确定x方向分Nx条线
path = XdirectionZigPath(xmin,xmax,ymin,ymax,Nx)
# print(path)
# 设置每条线走几步
step=(ymax-ymin)/(step_num-1)
fpath,path_n=feedPath(path,step,step_num)
# print(path_n)
tool_length = 0.087
scan_height=scan_height_int/1000 + tool_length
rapid_height=rapid_height_int/1000 + tool_length#0.15
zpath,npath=ZdirectionPath(fpath,path_n,points,normals,scan_height,rapid_height,flag_curve)
# print(zpath)
evalpts,ctrlpts=nihequmm(xmin,xmax,ymin,ymax,Nx,points,step_num)
# print(ctrlpts)
# 将路径画在点云上,可视化
#绘制顶点
lines=[]
for i in range(len(zpath)-1):
l=[i,i+1]
lines.append(l) #连接的顺序
color = [[0, 0, 0.8] for i in range(len(lines))]
#添加顶点,点云
points_pcd = o3d.geometry.PointCloud()# 传入3d点云
points_pcd.points = o3d.utility.Vector3dVector(zpath) # point_points 二维 numpy 矩阵,将其转换为 open3d 点云格式
points_pcd.paint_uniform_color([0, 0.8, 0]) #点云颜色
points_pcd.normals= o3d.utility.Vector3dVector(npath)
#绘制线条
lines_pcd = o3d.geometry.LineSet()
lines_pcd.lines = o3d.utility.Vector2iVector(lines)
lines_pcd.colors = o3d.utility.Vector3dVector(color) #线条颜色
lines_pcd.points = o3d.utility.Vector3dVector(zpath)
# 可视化
# o3d.visualization.draw_geometries([points_pcd,lines_pcd,outlier_cloud,mesh_frame])
o3d.visualization.draw_geometries([points_pcd,lines_pcd,outlier_cloud,mesh_frame],point_show_normal=True)
'''
# 发布话题
rospy.init_node("pathplan_select")
pub = rospy.Publisher("pathplanning_select",PoseStamped,queue_size=10)
count=0
rate=rospy.Rate(1)
ps = PoseStamped()
while not rospy.is_shutdown():
# x/y/z坐标
ps.pose.position.x=zpath[count][0]
ps.pose.position.y=zpath[count][1]
ps.pose.position.z=zpath[count][2]
# 构建旋转矩阵
rotate_matrix=[[0,0,0],[0,0,0],[0,0,0]]
Z = np.array([npath[i][0], npath[i][1], npath[i][2]])
X = np.array([Z[1], -Z[0], 0])
Z = Z/np.linalg.norm(Z)
X = X/np.linalg.norm(X)
rotate_matrix[0][2]=Z[0]
rotate_matrix[1][2]=Z[1]
rotate_matrix[2][2]=Z[2]
rotate_matrix[0][0]=X[0]
rotate_matrix[1][0]=X[1]
rotate_matrix[2][0]=X[2]
# 计算叉乘
Y = np.cross(Z,X)
Y = Y/np.linalg.norm(Y)
rotate_matrix[0][1]=Y[0]
rotate_matrix[1][1]=Y[1]
rotate_matrix[2][1]=Y[2]
rotateMatrix = np.array(rotate_matrix)
print(rotateMatrix)
q = Quaternion(matrix=rotateMatrix)
ps.pose.orientation.x=q.x
ps.pose.orientation.y=q.y
ps.pose.orientation.z=q.z
ps.pose.orientation.w=q.w
# 发布话题
pub.publish(ps)
rospy.loginfo("%s",str(ps))
count+=1
if count>=len(zpath):
rospy.loginfo("len%d",len(zpath))
break
'''