Skip to content

Commit

Permalink
linalg: add scalar division for vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
mathstuf committed Mar 25, 2015
1 parent ed1a2c4 commit 0e2587c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions gl3n/linalg.d
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,16 @@ struct Vector(type, int dimension_) {
return ret;
}

Vector opBinary(string op : "/")(vt r) const {
Vector ret;

foreach(index; TupleRange!(0, dimension)) {
ret.vector[index] = vector[index] / r;
}

return ret;
}

Vector opBinary(string op)(Vector r) const if((op == "+") || (op == "-")) {
Vector ret;

Expand Down

0 comments on commit 0e2587c

Please sign in to comment.