Am I doing something wrong here?
mdlMesh_intersectDPlane3dPolyfaceMesh is not returning anything..
Thanks ahead of time!
std::vector<DPoint3d> Get_MeshSegments(MSElementDescrP MeshHdr, DPlane3d Plane){ EmbeddedIntArray *pIndices = jmdlEmbeddedIntArray_grab (); EmbeddedDPoint3dArray *pXYZ = jmdlEmbeddedDPoint3dArray_grab (); EmbeddedDPoint3dArray *pIntersectionXYZ = jmdlEmbeddedDPoint3dArray_grab (); int blockSize = 0; std::vector<DPoint3d> Results; if ( NULL != pIndices && NULL != pXYZ && SUCCESS == mdlMesh_getPolyfaceArrays (MeshHdr, pIndices, NULL, &blockSize, NULL)){ mdlMesh_intersectDPlane3dPolyfaceMesh(pIntersectionXYZ, NULL, NULL, &Plane, pXYZ, pIndices, blockSize); printf("%d\n", blockSize); int ArrSize = jmdlEmbeddedDPoint3dArray_getCount(pIntersectionXYZ); printf("Count: %d\n", ArrSize); for(int i = 0; i < ArrSize; i++){ DPoint3d p; jmdlEmbeddedDPoint3dArray_getDPoint3d(pIntersectionXYZ, &p, i); Results.push_back(UOR_To_Point(p)); } } jmdlEmbeddedDPoint3dArray_drop (pXYZ); jmdlEmbeddedIntArray_drop (pIndices); jmdlEmbeddedDPoint3dArray_drop (pIntersectionXYZ); return Results; }
iifuzz said:if ( ... SUCCESS == mdlMesh_getPolyfaceArrays (MeshHdr, pIndices, NULL, &blockSize, NULL)){ mdlMesh_intersectDPlane3dPolyfaceMesh(pIntersectionXYZ, NULL, NULL, &Plane, pXYZ, pIndices, blockSize);
You're not filling the mesh array (pXYZ) with data. Try this...
SUCCESS == mdlMesh_getPolyfaceArrays (MeshHdr, pIndices, pXYZ, &blockSize, NULL)
Regards, Jon Summers LA Solutions
Answer Verified By: iifuzz
> Am I doing something wrong here?
It seems so on the first eyesight:
You never get any points from Mesh in mdlMesh_getPolyfaceArrays so mdlMesh_intersectDPlane3dPolyfaceMesh has no idea what to do with indices.
That is the sufficient reason (assuming the rest of data is valid).
On the side note, testing NULL != pIndices and NULL != pXYZ just after grab seems like overkilling to me.
Cheers,
/Chris Z.
Thanks guys.. that was the problem. I didnt catch that :P