mirror of
https://github.com/jneug/zeichenmaschine.git
synced 2026-04-14 14:43:33 +02:00
Vector wirft nun eine Exception, wenn durch 0 geteilt wird
This commit is contained in:
@@ -361,6 +361,9 @@ public class Vector extends Point2D.Double {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Vector div( double scalar ) {
|
public Vector div( double scalar ) {
|
||||||
|
if( scalar == 0.0 ) {
|
||||||
|
throw new IllegalArgumentException("Can't divide by zero.");
|
||||||
|
}
|
||||||
x /= scalar;
|
x /= scalar;
|
||||||
y /= scalar;
|
y /= scalar;
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
Reference in New Issue
Block a user