예제 #1
0
        public void testSub()
        {
            Tutorial_Point res1 = p1.sub(p2);
            Tutorial_Point res2 = p1.sub(p3);

            Assert.AreEqual(4, res1.x);
            Assert.AreEqual(-21, res1.y);
            Assert.AreEqual(-3, res2.x);
            Assert.AreEqual(12, res2.x);
        }
예제 #2
0
        public void setUp()
        {
            p1 = new Tutorial_Point(2, -3);
            p2 = new Tutorial_Point(3, 7);
            l1 = new Line(p1, p2);

            p3 = new Tutorial_Point(7, 2);
            p4 = new Tutorial_Point(8, 12);
            l2 = new Line(p3, p4);
        }
예제 #3
0
 public Quadrilateral(Tutorial_Point p1, Tutorial_Point p2, Tutorial_Point p3, Tutorial_Point p4)
 {
     this.p1 = p1;
     this.p2 = p2;
     this.p3 = p3;
     this.p4 = p4;
     this.l1 = new Line(p1, p2);
     this.l2 = new Line(p2, p3);
     this.l3 = new Line(p3, p4);
     this.l4 = new Line(p4, p1);
 }
예제 #4
0
 public void setUp()
 {
     p1 = new Tutorial_Point(7, 9);
     p2 = new Tutorial_Point(-3, -30);
     p3 = new Tutorial_Point(-10, 3);
 }
예제 #5
0
 /* Construct Vector2D from two points */
 public Vector2D(Tutorial_Point p1, Tutorial_Point p2)
 {
     this.x = p2.x - p1.x;
     this.y = p2.y - p1.y;
 }
예제 #6
0
 public Tutorial_Point sub(Tutorial_Point p)
 {
     return(new Tutorial_Point(x - p.x, y - p.y));
 }
예제 #7
0
 public Tutorial_Point add(Tutorial_Point p)
 {
     return(new Tutorial_Point(x + p.x, y + p.y));
 }
예제 #8
0
 public Line(Tutorial_Point p1, Tutorial_Point p2)
 {
     this.p1 = p1;
     this.p2 = p2;
 }