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

538 B

Vector2::operator+=

Vector2& operator+=(const Vector2& other)

向量加法赋值,将 other 的分量加到当前向量。

参数:

  • other - 要加的向量

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

线程安全:

复杂度: O(1)

示例:

Vector2 v(1.0f, 2.0f);
v += Vector2(3.0f, 4.0f);  // v = (4.0f, 6.0f)

相关文档