示例#1
0
        private bool EmitRays(Triangle triangle2, List <Triangle> candidateTriangles1, TriangleMesh mesh1, Axis axis, bool positiveDirection)
        {
            var positiveOffset = settings.Direction.PositiveOffset;

            foreach (var samplePoint in triangle2.SamplingPoints)
            {
                var direction = positiveDirection ? AxisDirection.Positive : AxisDirection.Negative;
                var ray       = new Ray(samplePoint, axis, direction);

                var doesIntersect = false;
                foreach (var candidateTriangle in candidateTriangles1)
                {
                    var outerTri = mesh1.CreateOuterTriangle(candidateTriangle, positiveOffset);
                    doesIntersect = rayTriangleIntersector.TestStrict(ray, outerTri);
                    if (doesIntersect)
                    {
                        break;
                    }
                }

                if (!doesIntersect)
                {
                    return(false);
                }
            }
            return(true);
        }
示例#2
0
        private bool IntersectionCount(TriangleMesh meshA, Box aBTriBoxExtendedPositive, Ray rayPositive)
        {
            var aTree = meshA.RTreeRoot;
            var triCandidatesFromA = aTree.FindOverlap(aBTriBoxExtendedPositive);

            var intersectionCount = 0;

            foreach (var candidateTriangle in triCandidatesFromA)
            {
                if (rayTriangleIntersector.TestStrict(rayPositive, candidateTriangle))
                {
                    intersectionCount++;
                }
            }

            return(intersectionCount % 2 != 0);
        }