MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / reflect

Method reflect

src/main/java/field/linalg/Vec2.java:1174–1179  ·  view source on GitHub ↗

Reflect this vector about the given normal vector. @param normal the vector to reflect about @return this

(Vec2 normal)

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 1

dotMethod · 0.95

Tested by

no test coverage detected