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

Method __add__

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

Source from the content-addressed store, hash-verified

1770 }
1771
1772 @Override
1773 public Object __add__(Object b) {
1774 Vec3 c = convertToVec3(b);
1775 if (c != null)
1776 return new Vec3(this.x + c.x, this.y + c.y, this.z + c.z);
1777
1778 if (b instanceof Quat) {
1779 return ((Quat) b).transform(this, new Vec3());
1780 }
1781 if (b instanceof Vec4) {
1782 return this.toVec4().add((Vec4) b);
1783 }
1784
1785 if (b instanceof OverloadedMath)
1786 return ((OverloadedMath) b).__radd__(this);
1787
1788 throw new ClassCastException(" can't add '" + b + "' by a Vec3 (" + this + ")");
1789
1790 }
1791
1792 @Override
1793 public Object __radd__(Object b) {

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected