-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCalculateResult.cpp
55 lines (45 loc) · 1.45 KB
/
CalculateResult.cpp
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
#include"CalculateResult.h"
#include <math.h>
void IlluminatedSpace::calculateIlluminatedSpacePoints(double &baseEdge, double &Height, double &blendSize, double &rotationAngle)
{
point A, B, C, D;
A.z = B.z = C.z = D.z = Height;
Formulas formula;
double heightOfPrysm = formula.FindHeight(baseEdge);
double alpha = fabs(rotationAngle) - formula.FindAngleBetweenHeightAndAsymptote(blendSize, heightOfPrysm);
double beta = fabs(rotationAngle) + formula.FindAngleBetweenHeightAndAsymptote(blendSize, heightOfPrysm);
//Х coordinates of the small base
double x_smaller = formula.FindX(blendSize, alpha, Height, heightOfPrysm);
A.x = -x_smaller;
B.x = x_smaller;
//Х coordinates of the big base
double x_bigger = formula.FindX(blendSize, beta, Height, heightOfPrysm);
C.x = -x_bigger;
D.x = x_bigger;
//У coordinates of the small base
double y_smaller = formula.FindY(alpha, Height);
//Y coordinates of the big base
double y_bigger = formula.FindY(beta, Height);
if(rotationAngle<0)
{
A.y = B.y = -y_smaller;
C.y = D.y = -y_bigger;
}
else
{
A.y = B.y = y_smaller;
C.y = D.y = y_bigger;
}
//output
this->A = A;
this->B = B;
this->C = C;
this->D = D;
}
void IlluminatedSpace::printSpace()
{
A.printPoint();
B.printPoint();
C.printPoint();
D.printPoint();
}