Files
XCEngine/docs/api/math/vector2/operator-sub-assign.md

541 B

Vector2::operator-=

Vector2& operator-=(const Vector2& other)

向量减法赋值,将 other 的分量从当前向量减去。

参数:

  • other - 要减的向量

返回: Vector2& - 引用到修改后的当前向量

线程安全:

复杂度: O(1)

示例:

Vector2 v(5.0f, 8.0f);
v -= Vector2(2.0f, 3.0f);  // v = (3.0f, 5.0f)

相关文档