Reflect this vector about the given normal vector. @param normal the vector to reflect about @return this
(Vec3 normal)
| 1307 | * @return this |
| 1308 | */ |
| 1309 | public Vec3 reflect(Vec3 normal) { |
| 1310 | double dot = this.dot(normal); |
| 1311 | x = x - 2.0 * dot * normal.x; |
| 1312 | y = y - 2.0 * dot * normal.y; |
| 1313 | z = z - 2.0 * dot * normal.z; |
| 1314 | return this; |
| 1315 | } |
| 1316 | |
| 1317 | /** |
| 1318 | * Reflect this vector about the given normal vector. |