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

Method __sub__

src/main/java/field/linalg/Vec3.java:1736–1753  ·  view source on GitHub ↗
(Object b)

Source from the content-addressed store, hash-verified

1734 // todo: matrix?
1735
1736 @Override
1737 public Object __sub__(Object b) {
1738 Vec3 c = convertToVec3(b);
1739 if (c != null)
1740 return new Vec3(this.x - c.x, this.y - c.y, this.z - c.z);
1741
1742 if (b instanceof Quat) {
1743 return ((Quat) b).invert(new Quat()).transform(this, new Vec3());
1744 }
1745 if (b instanceof Vec4) {
1746 return this.toVec4().sub((Vec4) b);
1747 }
1748 if (b instanceof OverloadedMath)
1749 return ((OverloadedMath) b).__rsub__(this);
1750
1751 throw new ClassCastException(" can't subtract '" + b + "' by a Vec3 (" + this + ")");
1752
1753 }
1754
1755 @Override
1756 public Object __rsub__(Object b) {

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected