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

Method __add__

src/main/java/field/linalg/Vec2.java:1463–1481  ·  view source on GitHub ↗
(Object b)

Source from the content-addressed store, hash-verified

1461 }
1462
1463 @Override
1464 public Object __add__(Object b) {
1465 Vec2 c = convertToVec2(b);
1466 if (c != null)
1467 return new Vec2(this.x + c.x, this.y + c.y);
1468
1469 if (b instanceof Quat) {
1470 return ((Quat) b).transform(this, new Vec2());
1471 }
1472 if (b instanceof Vec4) {
1473 return this.toVec4().add((Vec4) b);
1474 }
1475
1476 if (b instanceof OverloadedMath)
1477 return ((OverloadedMath) b).__radd__(this);
1478
1479 throw new ClassCastException(" can't add '" + b + "' by a Vec3 (" + this + ")");
1480
1481 }
1482
1483 @Override
1484 public Object __radd__(Object b) {

Callers

nothing calls this directly

Calls 5

convertToVec2Method · 0.95
toVec4Method · 0.95
transformMethod · 0.65
__radd__Method · 0.65
addMethod · 0.45

Tested by

no test coverage detected