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

Method __sub__

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

Source from the content-addressed store, hash-verified

1425 }
1426
1427 @Override
1428 public Object __sub__(Object b) {
1429 Vec2 c = convertToVec2(b);
1430 if (c != null)
1431 return new Vec3(this.x - c.x, this.y - c.y);
1432
1433 if (b instanceof Quat) {
1434 return ((Quat) b).invert(new Quat()).transform(this, new Vec2());
1435 }
1436 if (b instanceof Vec4) {
1437 return this.toVec4().sub((Vec4) b);
1438 }
1439 if (b instanceof OverloadedMath)
1440 return ((OverloadedMath) b).__rsub__(this);
1441
1442 throw new ClassCastException(" can't subtract '" + b + "' by a Vec3 (" + this + ")");
1443
1444 }
1445
1446 @Override
1447 public Object __rsub__(Object b) {

Callers

nothing calls this directly

Calls 6

convertToVec2Method · 0.95
toVec4Method · 0.95
transformMethod · 0.65
__rsub__Method · 0.65
invertMethod · 0.45
subMethod · 0.45

Tested by

no test coverage detected