Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® Integrated Performance Primitives
- ipprIntersectEyeSO_32f fails to find intersection

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

hapatrick

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-15-2011
08:33 AM

52 Views

ipprIntersectEyeSO_32f fails to find intersection

I have a situation where ipprIntersectEyeSO_32f is failing to find an intersection with the surface when it clearly should. In the code sample below, I use a small surface which is a subset of the surface I am actually using. It consists of a 3x3 array of points, triangulated so that each of the 4 rectangles in the grid is divided into 2 triangles.

I create an eye point just above (where "up" is defined as along the positive z axis) the center vertex, 1 unit from the surface in the positive z direction. Then I cast a ray [0, 0, -1] towards the surface. The returned intersection is at the center vertex -- exactly as expected.

However, if I move the eye point so that is it only 0.1 units from the surface along the z axis and callipprIntersectEyeSO_32f again, I get no intersection.

If I'm doing something wrong here, I can't figure it out what it is. I would be happy if someone could tell me that I have a bug in my code and how to fix it, but this appears to be an issue withipprIntersectEyeSO_32f.

int main(int argc, char **argv) { float vertices[] = { 0.28829887509346008, 0.28453636169433594, 0.3096863329410553, 0.28870773315429688, 0.28468862175941467, 0.30966261029243469, 0.2891162633895874, 0.28484302759170532, 0.30963701009750366, 0.2882312536239624, 0.28495293855667114, 0.31031304597854614, 0.28863763809204102, 0.28512048721313477, 0.31027624011039734, 0.28904658555984497, 0.28527212142944336, 0.31025305390357971, 0.28816816210746765, 0.28534162044525146, 0.31096354126930237, 0.28857320547103882, 0.28551733493804932, 0.31091979146003723, 0.28898081183433533, 0.28567728400230408, 0.31088951230049133 }; int indices[] = { 0, 1, 3, 1, 3, 1, 4, 1, 1, 2, 4, 1, 4, 2, 5, 1, 3, 4, 6, 1, 6, 4, 7, 1, 4, 5, 7, 1, 7, 5, 8, 1 }; size_t ntriangles = 8; size_t nvertex = 9; IppBox3D_32f pBound; IppStatus status = ipprSetBoundBox_32f(vertices, nvertex, &pBound); IpprIntersectContext iCtx; iCtx.pBound = &pBound; int pTriAccelSize; ipprTriangleAccelGetSize( &pTriAccelSize); iCtx.pAccel = (IpprTriangleAccel *)ippsMalloc_8u( pTriAccelSize * ntriangles ); status = ipprTriangleAccelInit( iCtx.pAccel, vertices, indices, ntriangles); int KDTreeSize; IpprPSAHBldContext fastKDCont; fastKDCont.Bounds = &pBound; fastKDCont.Alg = ippKDTBuildPureSAH; fastKDCont.AvailMemory = 4000; // In MB fastKDCont.MaxDepth = 28; fastKDCont.QoS = 1.0f; status = ipprKDTreeBuildAlloc( &(iCtx.pRootNode), vertices, indices, nvertex, ntriangles, &KDTreeSize, (void*)&fastKDCont ); // Direction of ray float rx = 0; float ry = 0; float rz = -1; Ipp32f * const ray[3] = {&rx, &ry, &rz}; Ipp32f distance = IPP_MAXABS_32F; Ipp32f hitPointU, hitPointV; Ipp32f *hitPoint[2] = {&hitPointU, &hitPointV}; int hitTriangleIdx; const IppiSize blockSize = {1, 1}; // With this eye point, an intersection is found as expected. IppPoint3D_32f eye = {vertices[12], vertices[13], vertices[14] + 1}; status = ipprIntersectEyeSO_32f( eye, ray, &distance, hitPoint, &hitTriangleIdx, &iCtx, blockSize); if (hitTriangleIdx < 0) cerr << "No intersection!" << endl; else cerr << "Intersection" << endl; // Move eye closer to surface -- no intersection is found eye[2] = vertices[14] + .1; status = ipprIntersectEyeSO_32f( eye, ray, &distance, hitPoint, &hitTriangleIdx, &iCtx, blockSize); if (hitTriangleIdx < 0) cerr << "No intersection!" << endl; else cerr << "Intersection" << endl; return 0; }

Link Copied

0 Replies

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.