mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 15:42:35 +00:00
Fixed a silly notion with Vector, airthmitic functions won't set Vector's data unless its setting arithmitic now. (vector+other won't set vector but will return a new vector, while
vector+=other WILL set vector's data)
This commit is contained in:
@@ -14,6 +14,15 @@ class IMICFPS
|
||||
end
|
||||
|
||||
def +(other)
|
||||
Vector.new(
|
||||
@x + other.x,
|
||||
@y + other.y
|
||||
@z + other.z
|
||||
@weight + other.weight
|
||||
)
|
||||
end
|
||||
|
||||
def +=(other)
|
||||
@x += other.x
|
||||
@y += other.y
|
||||
@z += other.z
|
||||
@@ -21,6 +30,15 @@ class IMICFPS
|
||||
end
|
||||
|
||||
def -(other)
|
||||
Vector.new(
|
||||
@x - other.x,
|
||||
@y - other.y
|
||||
@z - other.z
|
||||
@weight - other.weight
|
||||
)
|
||||
end
|
||||
|
||||
def -=(other)
|
||||
@x -= other.x
|
||||
@y -= other.y
|
||||
@z -= other.z
|
||||
@@ -28,6 +46,15 @@ class IMICFPS
|
||||
end
|
||||
|
||||
def *(other)
|
||||
Vector.new(
|
||||
@x * other.x,
|
||||
@y * other.y
|
||||
@z * other.z
|
||||
@weight * other.weight
|
||||
)
|
||||
end
|
||||
|
||||
def *=(other)
|
||||
@x *= other.x
|
||||
@y *= other.y
|
||||
@z *= other.z
|
||||
@@ -35,6 +62,15 @@ class IMICFPS
|
||||
end
|
||||
|
||||
def /(other)
|
||||
Vector.new(
|
||||
@x / other.x,
|
||||
@y / other.y
|
||||
@z / other.z
|
||||
@weight / other.weight
|
||||
)
|
||||
end
|
||||
|
||||
def /=(other)
|
||||
@x /= other.x
|
||||
@y /= other.y
|
||||
@z /= other.z
|
||||
|
||||
Reference in New Issue
Block a user