Exemplo n.º 1
0
        public static Vertex Create(Vertex v1, Vertex v2, double alpha)
        {
            var v = v2.ToPoint() - v1.ToPoint();
            v = v / v.Length * alpha;

            var p = v1.ToPoint() + v;
            var vertex = new Vertex() { X = p.X, Y = p.Y, IsIntersect = true,Alpha = alpha};
            return vertex;
        }
Exemplo n.º 2
0
        public bool Contains(Vertex point)
        {
            int windNumber = 0;
            Vertex si = this;
            do
            {
                if (si.Y <= point.Y)
                {
                    if (si.Next.Y > point.Y)
                    {
                        if (Triangle.GetSignedArea(si.ToPoint(), si.Next.ToPoint(), point.ToPoint()) > 0)
                            windNumber++;
                    }
                }
                else
                {
                    if (si.Next.Y <= point.Y)
                        if (Triangle.GetSignedArea(si.ToPoint(), si.Next.ToPoint(), point.ToPoint()) < 0)
                            windNumber--;
                }
                si = si.Next;
            } while (si != this);

            return (windNumber & 1) != 0;
        }