-
Notifications
You must be signed in to change notification settings - Fork 2
/
viewportTransform.m
82 lines (62 loc) · 1.49 KB
/
viewportTransform.m
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
% erster bekannter Punkt: (x1,y1), (x1', y1')
x1 = 0;
y1 = 0;
xMsp1 = 0;
yMsp1 = 0;
% Maximum y Wert t-SNE
maxTsne=max(mappedX(:,2));
% zweiter bekannter Punkt(x2,y2)
x2 = 0;
y2 = maxTsne + 10;
xMsp2 = 0;
yMsp2 = 1;
u = [];
u(1 ,1) = xMsp1;
u(2, 1) = yMsp1;
u(3 ,1) = xMsp2;
u(4, 1) = yMsp2;
m= [];
m(1,1) = x1;
m(2,1) = -y1;
m(3,1) = x2;
m(4,1) = -y2;
m(1,2) = y1;
m(2,2) = x1;
m(3,2) = y2;
m(4,2) = x2;
m(1,3) = 1;
m(2,3) = 0;
m(3,3) = 1;
m(4,3) = 0;
m(1,4) = 0 ;
m(2,4) = 1 ;
m(3,4) = 0 ;
m(4,4) = 1;
mKehrwert = inv(m);
resultMatrix = mKehrwert*u;
a= resultMatrix(1,1);
b= resultMatrix(2,1);
c= resultMatrix(3,1);
d= resultMatrix(4,1);
mappedXtransformed = [];
for i = 1 : size(mappedX,1)
xCurrent= mappedX(i,1);
yCurrent= mappedX(i,2);
xMsp = a*xCurrent + b*yCurrent+c;
yMsp = b*xCurrent - a*yCurrent+d;
mappedXtransformed(i,1)= xMsp;
mappedXtransformed(i,2)= yMsp;
end
% fileID = fopen('pointData.txt','w');
fileIDDesktop = fopen('C:\Users\Julius Gruber\Desktop\pointData.txt','w');
formatSpec = '%f %f %s %s\n';
for i = 1 : size(mappedXtransformed,1)
xFile= mappedXtransformed(i,1);
yFile= mappedXtransformed(i,2);
pathOfFile = fileInformationArray{i,1};
nameOfFile = fileInformationArray{i,2};
% fprintf(fileID,formatSpec,xFile, yFile, pathOfFile, nameOfFile);
fprintf(fileIDDesktop,formatSpec,xFile, yFile, pathOfFile, nameOfFile);
end
% fclose(fileID);
fclose(fileIDDesktop);