50 return ((a - o).dotProduct((b - o).crossProduct(c - o))) / 6.0;
57 Vector3 normal = (b - a).crossProduct(c - a);
58 float surf = normal.length();
61 normal = normal / surf;
71 Vector3 ctd = (a + b + c + ap + bp + cp) / 6.0;
82 Vector3 drg = Vector3::ZERO;
88 Vector3 tc = (a + b + c) / 3.0;
90 float vell = vel.length();
93 float cosaoa = fabs(normal.dotProduct(vel / vell));
95 drg = (-500.0 * surf * vell * vell * cosaoa) * normal;
96 if (normal.dotProduct(vel / vell) < 0)
100 float fxl = vell * cosaoa * surf;
103 Vector3 fxdir = fxl * normal;
122 return vol * normal + drg;
130 if (a.y > wha && b.y > wha && c.y > wha)
131 return Vector3::ZERO;
133 if (a.y > wha || b.y > wha || c.y > wha)
137 if (a.y < wha && b.y > wha && c.y > wha)
139 return computePressureForceSub(a, a + (wha - a.y) / (b.y - a.y) * (b - a), a + (wha - a.y) / (c.y - a.y) * (c - a), vel, type);
141 if (b.y < wha && c.y > wha && a.y > wha)
143 return computePressureForceSub(b, b + (wha - b.y) / (c.y - b.y) * (c - b), b + (wha - b.y) / (a.y - b.y) * (a - b), vel, type);
145 if (c.y < wha && a.y > wha && b.y > wha)
147 return computePressureForceSub(c, c + (wha - c.y) / (a.y - c.y) * (a - c), c + (wha - c.y) / (b.y - c.y) * (b - c), vel, type);
150 if (a.y > wha && b.y < wha && c.y < wha)
152 Vector3 tb = a + (wha - a.y) / (b.y - a.y) * (b - a);
153 Vector3 tc = a + (wha - a.y) / (c.y - a.y) * (c - a);
157 if (b.y > wha && c.y < wha && a.y < wha)
159 Vector3 tc = b + (wha - b.y) / (c.y - b.y) * (c - b);
160 Vector3 ta = b + (wha - b.y) / (a.y - b.y) * (a - b);
164 if (c.y > wha && a.y < wha && b.y < wha)
166 Vector3 ta = c + (wha - c.y) / (a.y - c.y) * (a - c);
167 Vector3 tb = c + (wha - c.y) / (b.y - c.y) * (b - c);
171 return Vector3::ZERO;
194 Vector3 tmp = b->Position - a->Position;
195 Vector3 mab = (tmp.dotProduct(m-a->Position) / tmp.squaredLength()) * tmp;
196 tmp = c->Position - b->Position;
197 Vector3 mbc = (tmp.dotProduct(m-b->Position) / tmp.squaredLength()) * tmp;
198 tmp = a->Position - c->Position;
199 Vector3 mca = (tmp.dotProduct(m-c->Position) / tmp.squaredLength()) * tmp;