MCPcopy Create free account
hub / github.com/RenderKit/embree / intersect_triangle_triangle

Function intersect_triangle_triangle

tutorials/collide/collide.cpp:39–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37 bool pause = false;
38
39 bool intersect_triangle_triangle (unsigned geomID0, unsigned primID0, unsigned geomID1, unsigned primID1)
40{
41 //CSTAT(bvh_collide_prim_intersections1++);
42
43 /* special culling for scene intersection with itself */
44 if (geomID0 == geomID1 && primID0 == primID1) {
45 return false;
46 }
47 //CSTAT(bvh_collide_prim_intersections2++);
48
49 auto mesh0 = meshes[geomID0].get ();
50 auto mesh1 = meshes[geomID1].get ();
51 auto const & tri0 = (Triangle&) mesh0->tris_[primID0];
52 auto const & tri1 = (Triangle&) mesh1->tris_[primID1];
53
54 if (geomID0 == geomID1)
55 {
56 /* ignore intersection with topological neighbors */
57 const vint4 t0(tri0.v0,tri0.v1,tri0.v2,tri0.v2);
58 if (any(vint4(tri1.v0) == t0)) return false;
59 if (any(vint4(tri1.v1) == t0)) return false;
60 if (any(vint4(tri1.v2) == t0)) return false;
61 }
62 //CSTAT(bvh_collide_prim_intersections3++);
63
64 const Vec3fa a0 = mesh0->x_[tri0.v0];
65 const Vec3fa a1 = mesh0->x_[tri0.v1];
66 const Vec3fa a2 = mesh0->x_[tri0.v2];
67 const Vec3fa b0 = mesh1->x_[tri1.v0];
68 const Vec3fa b1 = mesh1->x_[tri1.v1];
69 const Vec3fa b2 = mesh1->x_[tri1.v2];
70
71 return isa::TriangleTriangleIntersector::intersect_triangle_triangle(a0,a1,a2,b0,b1,b2);
72}
73
74void CollideFunc (void* userPtr, RTCCollision* collisions, unsigned int num_collisions)
75{

Callers 1

CollideFuncFunction · 0.70

Calls 2

anyFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected