vedo icon indicating copy to clipboard operation
vedo copied to clipboard

Ribbon return a in-closed surface

Open zhang-qiang-github opened this issue 2 years ago • 5 comments

I input two contours to Ribbon to generate a surface. The two contours are closed, but the Ribbon generated surface is not closed. The result is:

image

The red tube (green arrow) is the input contours, and we can see that the input contours are closed.

However, the Ribbon generated surface is not closed.

The code is:

contour1 = [
    [ -52.91988754272461 , -63.421424865722656 , 33.930017594805236 ] ,
    [ -52.88783264160156 , -62.40203857421875 , 33.930017594805236 ] ,
    [ -52.79113006591797 , -61.37962341308594 , 33.930017594805236 ] ,
    [ -52.628143310546875 , -60.351165771484375 , 33.930017594805236 ] ,
    [ -52.39610290527344 , -59.31369400024414 , 33.930017594805236 ] ,
    [ -52.09104537963867 , -58.26431655883789 , 33.930017594805236 ] ,
    [ -51.70772933959961 , -57.20026397705078 , 33.930017594805236 ] ,
    [ -51.239505767822266 , -56.118961334228516 , 33.930017594805236 ] ,
    [ -50.678226470947266 , -55.01810836791992 , 33.930017594805236 ] ,
    [ -50.01406478881836 , -53.895835876464844 , 33.930017594805236 ] ,
    [ -49.23539733886719 , -52.75087356567383 , 33.930017594805236 ] ,
    [ -48.328678131103516 , -51.582801818847656 , 33.930017594805236 ] ,
    [ -47.27836990356445 , -50.39238357543945 , 33.930017594805236 ] ,
    [ -46.066959381103516 , -49.18196105957031 , 33.930017594805236 ] ,
    [ -44.6751823425293 , -47.95600128173828 , 33.930017594805236 ] ,
    [ -43.082454681396484 , -46.721675872802734 , 33.930017594805236 ] ,
    [ -41.26771926879883 , -45.48957061767578 , 33.930017594805236 ] ,
    [ -39.210777282714844 , -44.27433776855469 , 33.930017594805236 ] ,
    [ -36.89424133300781 , -43.095272064208984 , 33.930017594805236 ] ,
    [ -34.30614471435547 , -41.97657775878906 , 33.930017594805236 ] ,
    [ -31.4431209564209 , -40.94705581665039 , 33.930017594805236 ] ,
    [ -28.313764572143555 , -40.039031982421875 , 33.930017594805236 ] ,
    [ -24.941631317138672 , -39.2862548828125 , 33.930017594805236 ] ,
    [ -21.36693000793457 , -38.7208366394043 , 33.930017594805236 ] ,
    [ -17.646066665649414 , -38.36959457397461 , 33.930017594805236 ] ,
    [ -13.848474502563477 , -38.25041580200195 , 33.930017594805236 ] ,
    [ -10.050881385803223 , -38.36959457397461 , 33.930017594805236 ] ,
    [ -6.330018043518066 , -38.7208366394043 , 33.930017594805236 ] ,
    [ -2.755316734313965 , -39.2862548828125 , 33.930017594805236 ] ,
    [ 0.6168161034584045 , -40.039031982421875 , 33.930017594805236 ] ,
    [ 3.7461719512939453 , -40.94705581665039 , 33.930017594805236 ] ,
    [ 6.609197616577148 , -41.97657775878906 , 33.930017594805236 ] ,
    [ 9.197291374206543 , -43.095272064208984 , 33.930017594805236 ] ,
    [ 11.51382827758789 , -44.27433395385742 , 33.930017594805236 ] ,
    [ 13.570771217346191 , -45.48957061767578 , 33.930017594805236 ] ,
    [ 15.385506629943848 , -46.721675872802734 , 33.930017594805236 ] ,
    [ 16.978233337402344 , -47.95600128173828 , 33.930017594805236 ] ,
    [ 18.370010375976562 , -49.18196105957031 , 33.930017594805236 ] ,
    [ 19.581418991088867 , -50.39238357543945 , 33.930017594805236 ] ,
    [ 20.631731033325195 , -51.582801818847656 , 33.930017594805236 ] ,
    [ 21.538450241088867 , -52.75087356567383 , 33.930017594805236 ] ,
    [ 22.317115783691406 , -53.895835876464844 , 33.930017594805236 ] ,
    [ 22.981279373168945 , -55.01810836791992 , 33.930017594805236 ] ,
    [ 23.542558670043945 , -56.11895751953125 , 33.930017594805236 ] ,
    [ 24.010780334472656 , -57.20026397705078 , 33.930017594805236 ] ,
    [ 24.39409828186035 , -58.26431655883789 , 33.930017594805236 ] ,
    [ 24.699155807495117 , -59.31369400024414 , 33.930017594805236 ] ,
    [ 24.931196212768555 , -60.351165771484375 , 33.930017594805236 ] ,
    [ 25.09418296813965 , -61.37962341308594 , 33.930017594805236 ] ,
    [ 25.190885543823242 , -62.40203857421875 , 33.930017594805236 ] ,
    [ 25.22294044494629 , -63.42142105102539 , 33.930017594805236 ] ,
    [ 25.190885543823242 , -64.44080352783203 , 33.930017594805236 ] ,
    [ 25.09418296813965 , -65.46321868896484 , 33.930017594805236 ] ,
    [ 24.931196212768555 , -66.4916763305664 , 33.930017594805236 ] ,
    [ 24.699155807495117 , -67.5291519165039 , 33.930017594805236 ] ,
    [ 24.39409828186035 , -68.57852935791016 , 33.930017594805236 ] ,
    [ 24.010780334472656 , -69.642578125 , 33.930017594805236 ] ,
    [ 23.542558670043945 , -70.72388458251953 , 33.930017594805236 ] ,
    [ 22.981279373168945 , -71.82473754882812 , 33.930017594805236 ] ,
    [ 22.31711769104004 , -72.94700622558594 , 33.930017594805236 ] ,
    [ 21.538450241088867 , -74.09197235107422 , 33.930017594805236 ] ,
    [ 20.631731033325195 , -75.26004028320312 , 33.930017594805236 ] ,
    [ 19.5814208984375 , -76.4504623413086 , 33.930017594805236 ] ,
    [ 18.370012283325195 , -77.66088104248047 , 33.930017594805236 ] ,
    [ 16.978233337402344 , -78.88684844970703 , 33.930017594805236 ] ,
    [ 15.385506629943848 , -80.12117004394531 , 33.930017594805236 ] ,
    [ 13.570771217346191 , -81.353271484375 , 33.930017594805236 ] ,
    [ 11.51382827758789 , -82.56851196289062 , 33.930017594805236 ] ,
    [ 9.19729232788086 , -83.74757385253906 , 33.930017594805236 ] ,
    [ 6.609197616577148 , -84.86626434326172 , 33.930017594805236 ] ,
    [ 3.7461721897125244 , -85.89579010009766 , 33.930017594805236 ] ,
    [ 0.6168164610862732 , -86.8038101196289 , 33.930017594805236 ] ,
    [ -2.7553164958953857 , -87.55659484863281 , 33.930017594805236 ] ,
    [ -6.330017566680908 , -88.12200927734375 , 33.930017594805236 ] ,
    [ -10.050881385803223 , -88.47325134277344 , 33.930017594805236 ] ,
    [ -13.84847354888916 , -88.5924301147461 , 33.930017594805236 ] ,
    [ -17.646066665649414 , -88.47325134277344 , 33.930017594805236 ] ,
    [ -21.36693000793457 , -88.12200927734375 , 33.930017594805236 ] ,
    [ -24.941631317138672 , -87.55659484863281 , 33.930017594805236 ] ,
    [ -28.313764572143555 , -86.8038101196289 , 33.930017594805236 ] ,
    [ -31.443119049072266 , -85.89579010009766 , 33.930017594805236 ] ,
    [ -34.30614471435547 , -84.86626434326172 , 33.930017594805236 ] ,
    [ -36.89424133300781 , -83.74757385253906 , 33.930017594805236 ] ,
    [ -39.210777282714844 , -82.56851196289062 , 33.930017594805236 ] ,
    [ -41.26771926879883 , -81.35327911376953 , 33.930017594805236 ] ,
    [ -43.082454681396484 , -80.12117004394531 , 33.930017594805236 ] ,
    [ -44.6751823425293 , -78.88684844970703 , 33.930017594805236 ] ,
    [ -46.066959381103516 , -77.66088104248047 , 33.930017594805236 ] ,
    [ -47.27836608886719 , -76.4504623413086 , 33.930017594805236 ] ,
    [ -48.328678131103516 , -75.26004028320312 , 33.930017594805236 ] ,
    [ -49.23539733886719 , -74.09197235107422 , 33.930017594805236 ] ,
    [ -50.01406478881836 , -72.94701385498047 , 33.930017594805236 ] ,
    [ -50.678226470947266 , -71.82473754882812 , 33.930017594805236 ] ,
    [ -51.239505767822266 , -70.72388458251953 , 33.930017594805236 ] ,
    [ -51.707725524902344 , -69.642578125 , 33.930017594805236 ] ,
    [ -52.09104537963867 , -68.57852935791016 , 33.930017594805236 ] ,
    [ -52.39610290527344 , -67.5291519165039 , 33.930017594805236 ] ,
    [ -52.628143310546875 , -66.49168395996094 , 33.930017594805236 ] ,
    [ -52.79113006591797 , -65.46321868896484 , 33.930017594805236 ] ,
    [ -52.88783264160156 , -64.44080352783203 , 33.930017594805236 ] ,
    [ -52.91988754272461 , -63.421424865722656 , 33.930017594805236 ] ,

]

contour2 = [
    [ -52.91988754272461 , -63.421424865722656 , 222.37630627254498 ] ,
    [ -52.88783264160156 , -62.40203857421875 , 222.37630627254498 ] ,
    [ -52.79113006591797 , -61.37962341308594 , 222.37630627254498 ] ,
    [ -52.628143310546875 , -60.351165771484375 , 222.37630627254498 ] ,
    [ -52.39610290527344 , -59.31369400024414 , 222.37630627254498 ] ,
    [ -52.09104537963867 , -58.26431655883789 , 222.37630627254498 ] ,
    [ -51.70772933959961 , -57.20026397705078 , 222.37630627254498 ] ,
    [ -51.239505767822266 , -56.118961334228516 , 222.37630627254498 ] ,
    [ -50.678226470947266 , -55.01810836791992 , 222.37630627254498 ] ,
    [ -50.01406478881836 , -53.895835876464844 , 222.37630627254498 ] ,
    [ -49.23539733886719 , -52.75087356567383 , 222.37630627254498 ] ,
    [ -48.328678131103516 , -51.582801818847656 , 222.37630627254498 ] ,
    [ -47.27836990356445 , -50.39238357543945 , 222.37630627254498 ] ,
    [ -46.066959381103516 , -49.18196105957031 , 222.37630627254498 ] ,
    [ -44.6751823425293 , -47.95600128173828 , 222.37630627254498 ] ,
    [ -43.082454681396484 , -46.721675872802734 , 222.37630627254498 ] ,
    [ -41.26771926879883 , -45.48957061767578 , 222.37630627254498 ] ,
    [ -39.210777282714844 , -44.27433776855469 , 222.37630627254498 ] ,
    [ -36.89424133300781 , -43.095272064208984 , 222.37630627254498 ] ,
    [ -34.30614471435547 , -41.97657775878906 , 222.37630627254498 ] ,
    [ -31.4431209564209 , -40.94705581665039 , 222.37630627254498 ] ,
    [ -28.313764572143555 , -40.039031982421875 , 222.37630627254498 ] ,
    [ -24.941631317138672 , -39.2862548828125 , 222.37630627254498 ] ,
    [ -21.36693000793457 , -38.7208366394043 , 222.37630627254498 ] ,
    [ -17.646066665649414 , -38.36959457397461 , 222.37630627254498 ] ,
    [ -13.848474502563477 , -38.25041580200195 , 222.37630627254498 ] ,
    [ -10.050881385803223 , -38.36959457397461 , 222.37630627254498 ] ,
    [ -6.330018043518066 , -38.7208366394043 , 222.37630627254498 ] ,
    [ -2.755316734313965 , -39.2862548828125 , 222.37630627254498 ] ,
    [ 0.6168161034584045 , -40.039031982421875 , 222.37630627254498 ] ,
    [ 3.7461719512939453 , -40.94705581665039 , 222.37630627254498 ] ,
    [ 6.609197616577148 , -41.97657775878906 , 222.37630627254498 ] ,
    [ 9.197291374206543 , -43.095272064208984 , 222.37630627254498 ] ,
    [ 11.51382827758789 , -44.27433395385742 , 222.37630627254498 ] ,
    [ 13.570771217346191 , -45.48957061767578 , 222.37630627254498 ] ,
    [ 15.385506629943848 , -46.721675872802734 , 222.37630627254498 ] ,
    [ 16.978233337402344 , -47.95600128173828 , 222.37630627254498 ] ,
    [ 18.370010375976562 , -49.18196105957031 , 222.37630627254498 ] ,
    [ 19.581418991088867 , -50.39238357543945 , 222.37630627254498 ] ,
    [ 20.631731033325195 , -51.582801818847656 , 222.37630627254498 ] ,
    [ 21.538450241088867 , -52.75087356567383 , 222.37630627254498 ] ,
    [ 22.317115783691406 , -53.895835876464844 , 222.37630627254498 ] ,
    [ 22.981279373168945 , -55.01810836791992 , 222.37630627254498 ] ,
    [ 23.542558670043945 , -56.11895751953125 , 222.37630627254498 ] ,
    [ 24.010780334472656 , -57.20026397705078 , 222.37630627254498 ] ,
    [ 24.39409828186035 , -58.26431655883789 , 222.37630627254498 ] ,
    [ 24.699155807495117 , -59.31369400024414 , 222.37630627254498 ] ,
    [ 24.931196212768555 , -60.351165771484375 , 222.37630627254498 ] ,
    [ 25.09418296813965 , -61.37962341308594 , 222.37630627254498 ] ,
    [ 25.190885543823242 , -62.40203857421875 , 222.37630627254498 ] ,
    [ 25.22294044494629 , -63.42142105102539 , 222.37630627254498 ] ,
    [ 25.190885543823242 , -64.44080352783203 , 222.37630627254498 ] ,
    [ 25.09418296813965 , -65.46321868896484 , 222.37630627254498 ] ,
    [ 24.931196212768555 , -66.4916763305664 , 222.37630627254498 ] ,
    [ 24.699155807495117 , -67.5291519165039 , 222.37630627254498 ] ,
    [ 24.39409828186035 , -68.57852935791016 , 222.37630627254498 ] ,
    [ 24.010780334472656 , -69.642578125 , 222.37630627254498 ] ,
    [ 23.542558670043945 , -70.72388458251953 , 222.37630627254498 ] ,
    [ 22.981279373168945 , -71.82473754882812 , 222.37630627254498 ] ,
    [ 22.31711769104004 , -72.94700622558594 , 222.37630627254498 ] ,
    [ 21.538450241088867 , -74.09197235107422 , 222.37630627254498 ] ,
    [ 20.631731033325195 , -75.26004028320312 , 222.37630627254498 ] ,
    [ 19.5814208984375 , -76.4504623413086 , 222.37630627254498 ] ,
    [ 18.370012283325195 , -77.66088104248047 , 222.37630627254498 ] ,
    [ 16.978233337402344 , -78.88684844970703 , 222.37630627254498 ] ,
    [ 15.385506629943848 , -80.12117004394531 , 222.37630627254498 ] ,
    [ 13.570771217346191 , -81.353271484375 , 222.37630627254498 ] ,
    [ 11.51382827758789 , -82.56851196289062 , 222.37630627254498 ] ,
    [ 9.19729232788086 , -83.74757385253906 , 222.37630627254498 ] ,
    [ 6.609197616577148 , -84.86626434326172 , 222.37630627254498 ] ,
    [ 3.7461721897125244 , -85.89579010009766 , 222.37630627254498 ] ,
    [ 0.6168164610862732 , -86.8038101196289 , 222.37630627254498 ] ,
    [ -2.7553164958953857 , -87.55659484863281 , 222.37630627254498 ] ,
    [ -6.330017566680908 , -88.12200927734375 , 222.37630627254498 ] ,
    [ -10.050881385803223 , -88.47325134277344 , 222.37630627254498 ] ,
    [ -13.84847354888916 , -88.5924301147461 , 222.37630627254498 ] ,
    [ -17.646066665649414 , -88.47325134277344 , 222.37630627254498 ] ,
    [ -21.36693000793457 , -88.12200927734375 , 222.37630627254498 ] ,
    [ -24.941631317138672 , -87.55659484863281 , 222.37630627254498 ] ,
    [ -28.313764572143555 , -86.8038101196289 , 222.37630627254498 ] ,
    [ -31.443119049072266 , -85.89579010009766 , 222.37630627254498 ] ,
    [ -34.30614471435547 , -84.86626434326172 , 222.37630627254498 ] ,
    [ -36.89424133300781 , -83.74757385253906 , 222.37630627254498 ] ,
    [ -39.210777282714844 , -82.56851196289062 , 222.37630627254498 ] ,
    [ -41.26771926879883 , -81.35327911376953 , 222.37630627254498 ] ,
    [ -43.082454681396484 , -80.12117004394531 , 222.37630627254498 ] ,
    [ -44.6751823425293 , -78.88684844970703 , 222.37630627254498 ] ,
    [ -46.066959381103516 , -77.66088104248047 , 222.37630627254498 ] ,
    [ -47.27836608886719 , -76.4504623413086 , 222.37630627254498 ] ,
    [ -48.328678131103516 , -75.26004028320312 , 222.37630627254498 ] ,
    [ -49.23539733886719 , -74.09197235107422 , 222.37630627254498 ] ,
    [ -50.01406478881836 , -72.94701385498047 , 222.37630627254498 ] ,
    [ -50.678226470947266 , -71.82473754882812 , 222.37630627254498 ] ,
    [ -51.239505767822266 , -70.72388458251953 , 222.37630627254498 ] ,
    [ -51.707725524902344 , -69.642578125 , 222.37630627254498 ] ,
    [ -52.09104537963867 , -68.57852935791016 , 222.37630627254498 ] ,
    [ -52.39610290527344 , -67.5291519165039 , 222.37630627254498 ] ,
    [ -52.628143310546875 , -66.49168395996094 , 222.37630627254498 ] ,
    [ -52.79113006591797 , -65.46321868896484 , 222.37630627254498 ] ,
    [ -52.88783264160156 , -64.44080352783203 , 222.37630627254498 ] ,
    [ -52.91988754272461 , -63.421424865722656 , 222.37630627254498 ] ,
]

from vedo import *

ribbon = Ribbon(line1=contour1, line2=contour2)

show(ribbon, Tube(contour1, c='r'), Tube(contour2, c='r'))

Sorry for post such long data. Because I can not find a short data that show such bug. Other data is OK.

This problem really make me confuzed.

zhang-qiang-github avatar Apr 28 '22 14:04 zhang-qiang-github

Your data contains something strange to me (you duplicated the last point)

The ribbon2 is made from a similar circles and it works fine...

from vedo import *

contour1 = np.array(list(reversed(contour1)))
contour2 = np.array(list(reversed(contour2)))

ribbon1 = Ribbon(contour1, contour2, closed=1)
ribbon1.c('k3').lighting('off')

contour1 = Circle(r=50).rotateZ(90).pos(-20,-60,33).points()
contour2 = Circle(r=50).rotateZ(90).pos(-20,-50,200).points()

ribbon2 = Ribbon(line1=np.array(contour1), line2=np.array(contour2), closed=True)
ribbon2.c('k5').lighting('off')

show([[ribbon1, ribbon1.labels('id')],
      [ribbon2, ribbon2.labels('id')]],
     N=2, axes=1,
)

Screenshot from 2022-04-28 17-49-50

marcomusy avatar Apr 28 '22 15:04 marcomusy

I also feel very strange. Only some of my data show this in-closed surface, and most of my data is normal.

I don't know why it happen~~~

zhang-qiang-github avatar Apr 29 '22 01:04 zhang-qiang-github

I'll classify it as bug for the moment. I will investigate a bit more if it can be due to vedo but so far it looks like it's probably not.

marcomusy avatar Apr 29 '22 09:04 marcomusy

And the following code also show in-closed surface:

from vedo import *

ellip1 = Circle(pos=[0, 0, 0], c='r')
ellip2 = Circle(pos=[0, 0, 3], c='r')

ribbon = Ribbon(line1=ellip1, line2=ellip2)

show(ellip1, ellip2, ribbon)

image

zhang-qiang-github avatar Apr 30 '22 08:04 zhang-qiang-github

you need ribbon = Ribbon(line1=ellip1, line2=ellip2, closed=True)

marcomusy avatar Apr 30 '22 14:04 marcomusy