-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrectyz.cpp
More file actions
71 lines (59 loc) · 1.6 KB
/
Copy pathrectyz.cpp
File metadata and controls
71 lines (59 loc) · 1.6 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
#include "stdio.h"
#include "rectyz.h"
#include "math.h"
#include <opencv2/opencv.hpp>
using namespace cv; //neu
rectyz::rectyz(int mx1, int my1, int mz1,
int ylength1, int zlength1, int fa01, int faf1, float alb_r1, float alb_g1, float alb_b1, float roughness1)
:
formen(mx1, my1, mz1, fa01, faf1, alb_r1, alb_g1, alb_b1, roughness1),
ylength(ylength1), zlength(zlength1)
{
}
rectyz::~rectyz()
{
}
bool rectyz::isobjectonthisray_n(int *bla, ray *ray2) {
int q, r, u;
ray2->get_sp(&sx,&sy,&sz,&px,&py,&pz);
int a = px - sx;
if (a) { *bla = (10000*(mx - sx) / (a)); }
else { return false; };
if (
(*bla>0)&&
(sy + ((*bla*(py - sy)/10000)) < (ylength + my)) &&
(sy + ((*bla*(py - sy)/10000)) > my) &&
(sz + ((*bla*(pz - sz)/10000)) < (zlength + mz)) &&
(sz + ((*bla*(pz - sz)/10000)) > mz)
)
{
//*fa = (int)(2 * mx);
if((px-sx)>0){
ray2->set_ni(-1,0,0,mx,sy + int((*bla*(py - sy)/10000)),sz + int((*bla*(pz - sz)/10000)));
} else {
ray2->set_ni(1,0,0,mx,sy + int((*bla*(py - sy)/10000)),sz + int((*bla*(pz - sz)/10000)));
}
return true;
}
else { return false; };
}
bool rectyz::isobjectonthisray_s(int *bla, ray *ray2) {
int q, r, u;
ray2->get_sp(&sx,&sy,&sz,&px,&py,&pz);
int a = px - sx;
if (a) { *bla = (10000*(mx - sx) / (a)); }
else { return false; };
if (
(*bla>0)&&
(sy + ((*bla*(py - sy)/10000)) < (ylength + my)) &&
(sy + ((*bla*(py - sy)/10000)) > my) &&
(sz + ((*bla*(pz - sz)/10000)) < (zlength + mz)) &&
(sz + ((*bla*(pz - sz)/10000)) > mz)
)
{
return true;
}
else { return false; };
}
void rectyz::refract(ray *rayin, ray *rayrefract){
}