riangle~Triangle Removetrianglesthis; forint i=0;i3;i++ ifvertexi Removevertexi-facethis; for int i = 0; i3; i++ int i2 = i+13; if!vertexi !vertexi2 continue; vertexi -RemoveIfNonNeighborverte
这段代码是一个三角形类析构函数的实现。
首先,调用Remove(triangles,this)将当前三角形从三角形列表中移除。
然后,遍历三角形的三个顶点,如果顶点存在,就将当前三角形从顶点的面列表中移除。
接下来,再次遍历三角形的三个顶点,对于每对顶点(vertex[i]和vertex[i2]),如果它们都存在,则调用顶点的RemoveIfNonNeighbor函数。
RemoveIfNonNeighbor函数的作用是,如果顶点v不是当前顶点的邻居,则将顶点v从当前顶点的邻居列表中移除。
最后,析构函数执行完毕。
原文地址: https://www.cveoy.top/t/topic/hPWF 著作权归作者所有。请勿转载和采集!