pmc/rectangle.cc
changeset 45 7197576fedcf
parent 43 cf8c1b5127b2
child 46 4b9e1ac40246
equal deleted inserted replaced
44:bb6586b1c547 45:7197576fedcf
     4  */
     4  */
     5 
     5 
     6 #include <rectangle.h>
     6 #include <rectangle.h>
     7 #include <cstdio>
     7 #include <cstdio>
     8 
     8 
       
     9 using namespace algebra;
       
    10 
     9 Rectangle::Rectangle (Surface * s)
    11 Rectangle::Rectangle (Surface * s)
    10 {
    12 {
       
    13     surface = s;
       
    14     name = "Rectangle";
       
    15 
       
    16     anker = Vector (0, 0);
       
    17 
    11     P[0] = new Vector (0, 0);
    18     P[0] = new Vector (0, 0);
    12     P[1] = new Vector (0, 100);
    19     P[1] = new Vector (0, 100);
    13     P[2] = new Vector (100, 100);
    20     P[2] = new Vector (100, 100);
    14     P[3] = new Vector (0, 100);
    21     P[3] = new Vector (0, 100);
       
    22 }
       
    23 
       
    24 Rectangle::Rectangle (Surface * s, Vector & p1, Vector & p2, Vector & p3, Vector & p4)
       
    25 {
       
    26     surface = s;
       
    27     name = "Rectangle";
    15 
    28 
    16     anker = Vector (0, 0);
    29     anker = Vector (0, 0);
    17 
    30 
    18     surface = s;
       
    19 }
       
    20 
       
    21 Rectangle::Rectangle (Surface * s, Vector& p1, Vector& p2, Vector& p3, Vector& p4)
       
    22 {
       
    23     P[0] = new Vector (p1);
    31     P[0] = new Vector (p1);
    24     P[1] = new Vector (p2);
    32     P[1] = new Vector (p2);
    25     P[2] = new Vector (p3);
    33     P[2] = new Vector (p3);
    26     P[3] = new Vector (p4);
    34     P[3] = new Vector (p4);
       
    35 }
       
    36 
       
    37 Rectangle::Rectangle (Surface * s, Vector p[4])
       
    38 {
       
    39     surface = s;
       
    40     name = "Rectangle";
    27 
    41 
    28     anker = Vector (0, 0);
    42     anker = Vector (0, 0);
    29 
    43 
    30     surface = s;
    44     for (int i = 0; i < 4; i++) {
       
    45         P[i] = new Vector (p[i]);
       
    46     }
    31 }
    47 }
    32 
    48 
    33 Rectangle::~Rectangle ()
    49 Rectangle::~Rectangle ()
    34 {
    50 {
    35     for (int i = 0; i < 4; i++) {
    51     for (int i = 0; i < 4; i++) {