Ejemplo n.º 1
0
        /// <summary>
        /// Returns true if the circumcircle of theTri contains theCoordRec
        /// </summary>
        /// <param name="theTri"></param>
        /// <param name="theCoord"></param>
        /// <returns></returns>
        protected bool Influenced(Triangle theTri, TriVertex theCoord)
        {
            var result = false;

            double cotan = TinningUtils.Cotangent(theTri.Vertices[2], theTri.Vertices[0], theTri.Vertices[1]);

            if (cotan > -1E20)
            {
                double cNorth = ((theTri.Vertices[1].Y + theTri.Vertices[0].Y) / 2) -
                                ((theTri.Vertices[1].X - theTri.Vertices[0].X) / 2) *
                                cotan;
                double cEast = ((theTri.Vertices[1].X + theTri.Vertices[0].X) / 2) +
                               ((theTri.Vertices[1].Y - theTri.Vertices[0].Y) / 2) *
                               cotan;
                double radSq = Math.Pow(cNorth - theTri.Vertices[0].Y, 2) + Math.Pow(cEast - theTri.Vertices[0].X, 2);

                result = Math.Pow(theCoord.X - cEast, 2) + Math.Pow(theCoord.Y - cNorth, 2) < radSq;
            }

            return(result);
        }