-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestCollision.cpp
More file actions
95 lines (74 loc) · 2.09 KB
/
testCollision.cpp
File metadata and controls
95 lines (74 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include "src/Shape.h"
#include "src/graphics.h"
using namespace std;
class A {
public:
virtual void Print(A *obj) = 0;
};
//@class B;
//@class C;
class B:public A {
public:
void Print(A *obj);
};
class C:public A {
public:
void Print(A *obj)
{
if ( dynamic_cast<B*>(obj) != NULL )
cout<<"Print called(B,C)"<<endl;
else if ( dynamic_cast<C*>(obj) != NULL )
cout<<"Print called(C,C)"<<endl;
}
};
void B::Print(A *obj)
{
if ( dynamic_cast<B*>(obj) != NULL )
cout<<"Print called(B,B)"<<endl;
else if ( dynamic_cast<class C*>(obj) != NULL )
cout<<"Print called(B,C)"<<endl;
}
int main(int argc,char *argv[])
{
/*
srand(time(NULL));
B objb;
C objc;
A *b = &objb,*c = &objc;
c->Print(c);*/
/*
vector<Cube> World;
vector<Cube> Cubes;
Cube C1( Point3D(500,500,0),200,200,200 ),
C2( Point3D(500,720,0),200,200,200 );
World.push_back(C1);
C2.Rotate(0,0,7);
Cube c1,c2;
C1.getAbsolutes(c1);C2.getAbsolutes(c2);
*/
Rect R1( Point3D(500,300,0),Point3D(400,200,0),Point3D(400,600,0),
Point3D(600,600,0),Point3D(600,200,0));
//~ Rect R2( Point3D(500,500,0),Point3D(500,350,0),Point3D(650,500,0),
//~ Point3D(500,650,0),Point3D(350,500,0));
ofstream out("test.svg");
out<<"<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"1000\" width=\"1000\">\n";
Point3D orig(atof(argv[1]),atof(argv[2]),atof(argv[3]));
float degx = atoi(argv[4]);
float degy = atoi(argv[5]);
float degz = atoi(argv[6]);
R1.Translate(orig);
R1.Project(Point3D(400,200,100));
R1.Write(out);
/*
R2.write(out);
c1.Faces[1].write(out);
c2.Faces[1].write(out);
C1.write(out);
C2.write(out);*/
out<<"</svg>\n";
out.close();
return 0;
}