Skip to main content
Vectors are a useful multidimensional data structure. Dairy supports DoubleVector2D and DistanceVector2D. We’ll look at DistanceVector2D, but DoubleVector2D is super similar, outside of a couple of Distance specific utility methods.
Thats the basics! In Kotlin, we also get that cool destructuring to x and y. Vectors also have all expected mathematical operations defined on them: plus, minus, unaryPlus, unaryMinus, times by other vector, times by scalar, div by other vector, div by scalar. Take a look back at Distances in the Unit section to review this. The only operation not defined here is mod or rem. Vectors also get these vector specific methods:
DistanceVector2Ds also have utilties for working with the DistanceUnits of the Distances it stores.