Esempio n. 1
0
        public double Distance(Vertex2D vert)
        {
            double l = this.Length();

            double dx0 = V2.X - V1.X;
            double dy0 = V2.Y - V1.Y;

            double dx = vert.X - V1.X;
            double dy = vert.Y - V1.Y;

            double p = dx * dx0 + dy * dy0;

            p /= l;

            if (p < 0.0)
            {
                return(Math.Sqrt(dx * dx + dy * dy));
            }

            if (p > l)
            {
                double dx1 = vert.X - V2.X;
                double dy1 = vert.Y - V2.Y;
                return(Math.Sqrt(dx1 * dx1 + dy1 * dy1));
            }

            double L = Math.Sqrt(dx * dx + dy * dy);

            return(Math.Sqrt(L * L - p * p));
        }
Esempio n. 2
0
        public override object Clone()
        {
            Vertex2D v = new Vertex2D();

            v.X = X;
            v.Y = Y;

            v.extID = extID;

            return(v);
        }
Esempio n. 3
0
        public override object Clone()
        {
            Vertex2D v1 = (Vertex2D)V1.Clone();
            Vertex2D v2 = (Vertex2D)V2.Clone();

            Edge2D e = new Edge2D(v1, v2);

            e.extID = extID;

            return(e);
        }
Esempio n. 4
0
        public Vertex2D Verteces2LinCut(double t)
        {
            double x = V1.X + t * (V2.X - V1.X);
            double y = V1.Y + t * (V2.Y - V1.Y);

            Vertex2D v = new Vertex2D();

            v.X = x;
            v.Y = y;

            return(v);
        }
Esempio n. 5
0
        public override object Clone()
        {
            Vertex2D v1 = (Vertex2D)V1.Clone();
            Vertex2D v2 = (Vertex2D)V2.Clone();
            Vertex2D v3 = (Vertex2D)V3.Clone();

            Triangle2D tr = new Triangle2D(v1, v2, v3);

            tr.extID = extID;

            tr.E1 = (Edge2D)E1.Clone();
            tr.E2 = (Edge2D)E2.Clone();
            tr.E3 = (Edge2D)E3.Clone();

            return(tr);
        }
Esempio n. 6
0
 public Edge2D(Vertex2D v1, Vertex2D v2) : base(v1, v2)
 {
 }
Esempio n. 7
0
 public Triangle2D(Vertex2D v1, Vertex2D v2, Vertex2D v3)
     : base(v1, v2, v3)
 {
 }