Skip to content

Commit

Permalink
Added ability to access axes of point directly.
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanILevi committed Jul 12, 2020
1 parent a8f8186 commit 31590a8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/math/linear/point.d
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,19 @@ import math.linear.vector: Vec;

// TODO: Add tests to ensure T is a compotable type (number or vector, etc...).
struct Point(T) {
union {
T vector;
struct {
static if (T.data.length>=1)
T x;
static if (T.data.length>=2)
T y;
static if (T.data.length>=3)
T z;
static if (T.data.length>=4)
T w;
}
}
alias v = vector;

const
Expand Down

0 comments on commit 31590a8

Please sign in to comment.