Skip to content

* operator on C4Vector now works with the scalar on the left hand side #584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 20, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions C4/Core/C4Vector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,19 @@ public func * (lhs: C4Vector, rhs: Double) -> C4Vector {
return C4Vector(x: lhs.x * rhs, y: lhs.y * rhs, z: lhs.z * rhs)
}


/// Returns a new vector whose coordinates are the multiplication of the right-hand vector coordinates by the left-hand scalar
///
/// ````
/// var v1 = C4Vector(x: 1, y: 1)
/// var v2 = 2.0 * v2
/// v2 //-> {2,2,0}
///
public func * (lhs: Double, rhs: C4Vector) -> C4Vector {
return C4Vector(x: rhs.x * lhs, y: rhs.y * lhs, z: rhs.z * lhs)
}


/// Returns a new vector whose coordinates are the negative values of the receiver
///
/// ````
Expand Down