bool isAlmostZero2(Vector2f v) { float e = 0.002f; return abs(v.x) < e && abs(v.y) < e; } vec2 v = vec2(1, 0); Matrix3f tm = translationMatrix2D(vec2(2, 3)); vec2 vt = affineTransform2D(v, tm); assert(isAlmostZero2(vt - vec2(3, 3))); Matrix3f rm = rotationMatrix2D(cast(float)PI); vt = affineTransform2D(v, rm); assert(isAlmostZero2(vt - vec2(-1, 0))); Matrix3f sm = scaleMatrix2D(vec2(2, 2)); vt = affineTransform2D(v, sm); assert(isAlmostZero2(vt - vec2(2, 0)));