Example #1
0
        /**
         * Main program (used for testing).
         */
        public static void main(String[] args)
        {
            Pnt p = new Pnt(1, 2, 3);

            Console.WriteLine("Pnt created: " + p);
            Pnt[] matrix1 = { new Pnt(1, 2), new Pnt(3, 4) };
            Pnt[] matrix2 = { new Pnt(7, 0, 5), new Pnt(2, 4, 6), new Pnt(3, 8, 1) };
            Console.WriteLine("Results should be -2 and -288: ");
            Console.WriteLine(determinant(matrix1) + " " + determinant(matrix2));
            Pnt p1 = new Pnt(1, 1); Pnt p2 = new Pnt(-1, 1);

            Console.WriteLine("Angle between " + p1 + " and " + p2 + ": " + p1.angle(p2));
            Console.WriteLine(p1 + " subtract " + p2 + ": " + p1.subtract(p2));
            Pnt v0 = new Pnt(0, 0), v1 = new Pnt(1, 1), v2 = new Pnt(2, 2);

            Pnt[] vs = { v0, new Pnt(0, 1), new Pnt(1, 0) };
            Pnt   vp = new Pnt(.1, .1);

            Console.WriteLine(vp + " isInside " + toString(vs) + ": " + vp.isInside(vs));
            Console.WriteLine(v1 + " isInside " + toString(vs) + ": " + v1.isInside(vs));
            Console.WriteLine(vp + " vsCircumcircle " + toString(vs) + ": " +
                              vp.vsCircumcircle(vs));
            Console.WriteLine(v1 + " vsCircumcircle " + toString(vs) + ": " +
                              v1.vsCircumcircle(vs));
            Console.WriteLine(v2 + " vsCircumcircle " + toString(vs) + ": " +
                              v2.vsCircumcircle(vs));
            Console.WriteLine("Circumcenter of " + toString(vs) + " is " + circumcenter(vs));
        }
Example #2
0
		/**
		 * Main program (used for testing).
		 */
		public static void main(String[] args)
		{
			Pnt p = new Pnt(1, 2, 3);
			Console.WriteLine("Pnt created: " + p);
			Pnt[] matrix1 = { new Pnt(1, 2), new Pnt(3, 4) };
			Pnt[] matrix2 = { new Pnt(7, 0, 5), new Pnt(2, 4, 6), new Pnt(3, 8, 1) };
			Console.WriteLine("Results should be -2 and -288: ");
			Console.WriteLine(determinant(matrix1) + " " + determinant(matrix2));
			Pnt p1 = new Pnt(1, 1); Pnt p2 = new Pnt(-1, 1);
			Console.WriteLine("Angle between " + p1 + " and " + p2 + ": " + p1.angle(p2));
			Console.WriteLine(p1 + " subtract " + p2 + ": " + p1.subtract(p2));
			Pnt v0 = new Pnt(0, 0), v1 = new Pnt(1, 1), v2 = new Pnt(2, 2);
			Pnt[] vs = { v0, new Pnt(0, 1), new Pnt(1, 0) };
			Pnt vp = new Pnt(.1, .1);
			Console.WriteLine(vp + " isInside " + toString(vs) + ": " + vp.isInside(vs));
			Console.WriteLine(v1 + " isInside " + toString(vs) + ": " + v1.isInside(vs));
			Console.WriteLine(vp + " vsCircumcircle " + toString(vs) + ": " +
							   vp.vsCircumcircle(vs));
			Console.WriteLine(v1 + " vsCircumcircle " + toString(vs) + ": " +
							   v1.vsCircumcircle(vs));
			Console.WriteLine(v2 + " vsCircumcircle " + toString(vs) + ": " +
							   v2.vsCircumcircle(vs));
			Console.WriteLine("Circumcenter of " + toString(vs) + " is " + circumcenter(vs));
		}