Reflect this vector about the given normal vector. @param normal the vector to reflect about @return this
(Vec2 normal)
| 1172 | * @return this |
| 1173 | */ |
| 1174 | public Vec2 reflect(Vec2 normal) { |
| 1175 | double dot = this.dot(normal); |
| 1176 | x = x - 2.0 * dot * normal.x; |
| 1177 | y = y - 2.0 * dot * normal.y; |
| 1178 | return this; |
| 1179 | } |
| 1180 | |
| 1181 | /** |
| 1182 | * Reflect this vector about the given normal vector. |