TriangleNet.Tools.QuadNode.FindIntersectionsWithX C# (CSharp) Method

FindIntersectionsWithX() private method

private FindIntersectionsWithX ( double dx, double dy, Point triangle, int index, int k ) : void
dx double
dy double
triangle Point
index int
k int
return void
        void FindIntersectionsWithX(double dx, double dy, Point[] triangle, int index, int k)
        {
            // find intersection with plane x = m_pivot.dX
            double t = (pivot.X - triangle[k].X) / dx;

            if (t < (1 + EPS) && t > -EPS)
            {
                // we have an intersection
                double yComponent = triangle[k].Y + t * dy;

                if (yComponent < pivot.Y)
                {
                    if (yComponent >= bounds.Ymin)
                    {
                        AddToRegion(index, SW);
                        AddToRegion(index, SE);
                    }
                }
                else if (yComponent <= bounds.Ymax)
                {
                    AddToRegion(index, NW);
                    AddToRegion(index, NE);
                }
            }
            // find intersection with plane x = m_boundingBox[0].dX
            t = (bounds.Xmin - triangle[k].X) / dx;
            if (t < (1 + EPS) && t > -EPS)
            {
                // we have an intersection
                double yComponent = triangle[k].Y + t * dy;

                if (yComponent <= pivot.Y && yComponent >= bounds.Ymin)
                {
                    AddToRegion(index, SW);
                }
                else if (yComponent >= pivot.Y && yComponent <= bounds.Ymax)
                {
                    AddToRegion(index, NW);
                }
            }
            // find intersection with plane x = m_boundingBox[1].dX
            t = (bounds.Xmax - triangle[k].X) / dx;
            if (t < (1 + EPS) && t > -EPS)
            {
                // we have an intersection
                double yComponent = triangle[k].Y + t * dy;

                if (yComponent <= pivot.Y && yComponent >= bounds.Ymin)
                {
                    AddToRegion(index, SE);
                }
                else if (yComponent >= pivot.Y && yComponent <= bounds.Ymax)
                {
                    AddToRegion(index, NE);
                }
            }
        }