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

Method __div__

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

Source from the content-addressed store, hash-verified

1542
1543 }
1544 @Override
1545 public Object __div__(Object b) {
1546 if (b instanceof Number)
1547 return new Vec2(this).mul(1.0/((Number) b).doubleValue());
1548
1549 Vec2 c = convertToVec2(b);
1550 if (c != null)
1551 return new Vec2(this.x / c.x, this.y / c.y);
1552
1553 if (b instanceof Quat) {
1554 return ((Quat) b).transform(this, new Vec2());
1555 }
1556
1557 if (b instanceof Vec4) {
1558 return ((Vec4)b).div(this.toVec4());
1559 }
1560
1561 if (b instanceof OverloadedMath)
1562 return ((OverloadedMath) b).__rdiv__(this);
1563
1564 throw new ClassCastException(" can't divide'" + b + "' and a Vec2 (" + this + ")");
1565 }
1566
1567 @Override
1568 public Object __rdiv__(Object b) {

Callers

nothing calls this directly

Calls 6

convertToVec2Method · 0.95
toVec4Method · 0.95
transformMethod · 0.65
__rdiv__Method · 0.65
mulMethod · 0.45
divMethod · 0.45

Tested by

no test coverage detected