@@ -17,7 +17,7 @@ const int bytesPerPixel = 3; /// red, green, blue
17
17
const int fileHeaderSize = 14 ;
18
18
const int infoHeaderSize = 40 ;
19
19
20
-
20
+ // Entscheidet ob der berechnete Skalar Vektor tatsächlich nach rechts von der Kamera ViewDirection geht
21
21
static Vector3 findRightSkalar (Vector3 vec, Vector3 right) {
22
22
Vector3 left = right * -1 ;
23
23
@@ -31,6 +31,7 @@ static Vector3 findRightSkalar(Vector3 vec, Vector3 right) {
31
31
return right;
32
32
}
33
33
34
+ // Findet den entsprechenden Vektor um die Vektoren nach Rechts und oben finden zu können
34
35
static Vector3 findSkalarVectorWithYZero (Vector3 vector) {
35
36
double x = 1 ;
36
37
double y = 0 ;
@@ -39,6 +40,7 @@ static Vector3 findSkalarVectorWithYZero(Vector3 vector) {
39
40
return findRightSkalar (vector, Vector3 (x, y, z));
40
41
}
41
42
43
+ // Berechnet den Vektor der für die Kamera nach oben zeigt
42
44
static Vector3 findUpVector (Vector3 first, Vector3 second) {
43
45
Vector3 up = Vector3 (first.y * second.z - first.z * second.y ,
44
46
first.z * second.x - first.x * second.z ,
@@ -48,6 +50,7 @@ static Vector3 findUpVector(Vector3 first, Vector3 second) {
48
50
return up*-1 ;
49
51
}
50
52
53
+ // Konvertiert SphParticle zu DebugObject
51
54
static std::vector<DebugObject> convertSphParticles (std::vector<SphParticle> &particles) {
52
55
std::vector<DebugObject> output;
53
56
for (unsigned int i = 0 ; i < particles.size (); i++) {
@@ -57,6 +60,7 @@ static std::vector<DebugObject> convertSphParticles(std::vector<SphParticle> &pa
57
60
return output;
58
61
}
59
62
63
+ // Konvertiert SphParticle zu ParticleObject
60
64
static std::vector<ParticleObject> convertFluidParticles (std::vector<SphParticle> &particles) {
61
65
std::vector<ParticleObject> output;
62
66
for (unsigned int i = 0 ; i < particles.size (); i++) {
@@ -66,6 +70,7 @@ static std::vector<ParticleObject> convertFluidParticles(std::vector<SphParticle
66
70
return output;
67
71
}
68
72
73
+ // Schreibt einen Frame als bmp
69
74
static void writeFrameToBitmap (Frame f, const char * fileName, unsigned int w, unsigned int h) {
70
75
FILE *file;
71
76
unsigned char *img = NULL ;
@@ -122,6 +127,7 @@ static void writeFrameToBitmap(Frame f, const char* fileName, unsigned int w, un
122
127
fclose (file);
123
128
}
124
129
130
+ // String Operationen welche nicht in std enthalten sind; Heutige Ausgabe: Split
125
131
static vector<string> split (const string &s, const char &c)
126
132
{
127
133
string buff{ " " };
@@ -137,6 +143,7 @@ static vector<string> split(const string &s, const char &c)
137
143
return v;
138
144
}
139
145
146
+ // String Operationen welche nicht in std enthalten sind; Heutige Ausgabe: StartsWith
140
147
static bool startsWith (const string &s, const string &sequence) {
141
148
if (s.size () < sequence.size ()) return false ;
142
149
@@ -147,6 +154,7 @@ static bool startsWith(const string &s, const string &sequence) {
147
154
return true ;
148
155
}
149
156
157
+ // Berechnet Schnittpunkt zwischen Ray und Face
150
158
static bool intersectsWithFace (Ray &ray, const Face& face, double &distance) {
151
159
Vector3 vertex0 = face.a ;
152
160
Vector3 vertex1 = face.b ;
@@ -168,13 +176,12 @@ static bool intersectsWithFace(Ray &ray, const Face& face, double &distance) {
168
176
v = f * ray.direction .dot (q);
169
177
if (v < 0.0 || u + v > 1.0 )
170
178
return false ;
171
- // At this stage we can compute t to find out where the intersection point is on the line.
172
179
float t = f * edge2.dot (q);
173
- if (t > EPSILON) // ray intersection
180
+ if (t > EPSILON)
174
181
{
175
182
distance = t;
176
183
return true ;
177
184
}
178
- else // This means that there is a line intersection but not a ray intersection.
185
+ else
179
186
return false ;
180
187
}
0 commit comments