Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

allow Nx1 and 1xN matrices #30

  • Loading branch information...
commit 718f2648ae84ac8bb06dbb2b2c82c7150d64c03c 1 parent 718da0b
@Dav1dde authored
Showing with 8 additions and 4 deletions.
  1. +8 −4 gl3n/linalg.d
View
12 gl3n/linalg.d
@@ -47,6 +47,8 @@ version(NoReciprocalMul) {
/// alias Vector!(real, 2) vec2r;
/// ---
struct Vector(type, int dimension_) {
+ static assert(dimension > 0, "0 dimensional vectors don't exist.");
+
alias type vt; /// Holds the internal type of the vector.
static const int dimension = dimension_; ///Holds the dimension of the vector.
@@ -68,13 +70,15 @@ struct Vector(type, int dimension_) {
}
alias get_!'x' x; /// static properties to access the values.
- alias get_!'y' y; /// ditto
alias x u; /// ditto
- alias y v; /// ditto
alias x s; /// ditto
- alias y t; /// ditto
alias x r; /// ditto
- alias y g; /// ditto
+ static if(dimension >= 2) {
+ alias get_!'y' y; /// ditto
+ alias y v; /// ditto
+ alias y t; /// ditto
+ alias y g; /// ditto
+ }
static if(dimension >= 3) {
alias get_!'z' z; /// ditto
alias z b; /// ditto
Please sign in to comment.
Something went wrong with that request. Please try again.