[V8i MDL]提取mesh边界的问题

上图中,左侧为一mesh元素,中间为利用MS提取边界命令提取出来的边界(正常),最右侧为利用代码提取出的边界(未封闭),提取方法如下:

	int						pNumIndexPerFace=1;	
	EmbeddedIntArray*		pIndices=jmdlEmbeddedIntArray_grab();
	EmbeddedDPoint3dArray*	pXYZ=jmdlEmbeddedDPoint3dArray_grab();
	EmbeddedDPoint3dArray*	pEdgeXYZArray=jmdlEmbeddedDPoint3dArray_grab();

	mdlMesh_getPolyfaceArrays(ppResultDescr,pIndices,pXYZ,&pNumIndexPerFace,NULL);
	mdlMesh_filterMultiplyDrawnEdgesExt(pIndices,1,TRUE,TRUE);
	mdlMesh_edgeCoordinates(pEdgeXYZArray,pIndices,pXYZ,1,TRUE);

	int			count=jmdlEmbeddedIntArray_getCount(pIndices);
	DPoint3d	*tmpPoint=new DPoint3d[count];
	for(int i=0;i<count;i++)
	{
		jmdlEmbeddedDPoint3dArray_getDPoint3d(pEdgeXYZArray,&tmpPoint[i],i);
	}

	mdlLineString_create(&el,NULL,tmpPoint,count);

利用代码提取的线串除了没有封闭以外,还在多个位置出现交叉,见下图。

请问:

1、出现这种情况的原因是什么,是否与直接利用点建立线串有关系?

2、英文论坛提供了以下解决方案,是否能解决问题?请问第4条如何操作,看意思是将每个边缘建立一直线,再组合成复杂链,但是mdlMesh_edgeCoordinates提取出的pEdgeXYZArray中边缘线的起始点和终点是如何分布的,如何分辨各个边缘线的起始点和终点?

Parents
  • 一个未公开函数可直接求Mesh边界:
    Extract all visible edges from a mesh. Join them into chains and return as elements.
    extern "C" StatusInt mdlMesh_extractVisibleChains (
    MSElementDescr *pMeshDescr, // IN mesh header
    MSElementDescr **ppResultDescr, //OUT chain of polylines and shapes.
    BoolInt bBoundaryOnly //IN If true, the mesh is inspected to determine boundaries.
    // If false, the current visibility markings on the mesh are used.
    );



    Answer Verified By: lihui He 

  • 符工,感谢您的解答。已测试过,该函数可以提取mesh边界。

    1、提取出的为shape形元素,请问输出参数ppResultDescr在什么情况下为chain of polylines?

    2、shape提取出来以后,使用mdlElmdscr_simplifyComplexChainOrShape简化为线串,但是没有成功,如果需要简化为线串的话,是否仅能通过mdlLinear_extract提取数据点再创建线串?

  • 1、Shape元素最多只能保存5000个顶点,当Mesh边界点数大于5000时,将不得不以ComplexChain的形式构成。
    2、mdlElmdscr_simplifyComplexChainOrShape不能将Shape简化为Linestring,它是用来将ComplexShape简化为Shape 或者 将ComplexChain简化为Linestring的。如果要从Shape转换成Linestring就需要用你想到的方案。



    Answer Verified By: lihui He 

Reply Children
No Data