Beispiel #1
0
        /// <summary>
        /// Assumes the two lines u1-v1 and u2-v2 are not parallel.
        /// </summary>
        public static VecRat2 LineIntersection(VecRat2 a1, VecRat2 b1, VecRat2 a2, VecRat2 b2)
        {
            Rational s1det = MathAid.Det2(a1, b1);
            Rational s2det = MathAid.Det2(a2, b2);
            VecRat2  diff1 = a1 - b1;
            VecRat2  diff2 = a2 - b2;

            return((s1det * diff2 - s2det * diff1) / MathAid.Det2(diff1, diff2));
        }
Beispiel #2
0
 public static Rational TriangleTwiceSignedArea(VecRat2 a, VecRat2 b, VecRat2 c)
 {
     return(MathAid.Det2(b - a, c - a));
 }