Data update

This commit is contained in:
Ingy döt Net 2023-12-16 21:33:55 -08:00
parent 35bcdeebf8
commit 74c69a0df6
2427 changed files with 31826 additions and 3468 deletions

View file

@ -0,0 +1,8 @@
struct Vector {
var x: Decimal;
var y: Decimal;
func magnitude(this): Decimal {
return Math.sqrt(this.x * this.x + this.y * this.y);
}
}

View file

@ -0,0 +1,10 @@
class UnitVector {
val x: Decimal;
val y: Decimal;
init(direction: Vector) {
require direction.x != 0.0 || direction.y != 0.0;
val magnitude = direction.magnitude();
this { x: direction.x / magnitude, y: direction.y / magnitude };
}
}