Commit Graph

20 Commits

Author SHA1 Message Date
Pavel Krajcevski
31c799a02a Add equality operators 2014-03-21 01:15:35 -04:00
Pavel Krajcevski
cc566471e9 Disambiguate the sqrts we're using 2014-03-12 12:12:20 -04:00
Pavel Krajcevski
e96cecc13a Add some typename specifiers 2014-03-12 03:01:28 -04:00
Pavel Krajcevski
479ba8e76d Fix a bunch of MSVC compiler warnings and errors.
Most notably, we need to actually fix a bug in MSVC that doesn't know how to properly instantiate
enums in partial template specialization. There are more details outlined here:

http://stackoverflow.com/questions/15466594/why-does-msvc-fail-to-compile-this-template-function

The fix in this commit closes #10

Also in this commit is a hacky way to allow GL defines. Apparently "LoadImage" is defined as a
macro even with WIN32_LEAN_AND_MEAN. This means that we have to #undef the code that includes
it, meaning that we also need to make sure not to actually mix GLDefines.h with any file that needs
to use the functions from Windows.h
2014-03-12 02:43:09 -04:00
Pavel Krajcevski
ce99d79bab Add some static casts 2014-03-12 02:41:23 -04:00
Pavel Krajcevski
05eeb09f36 Constify 2014-02-21 16:11:49 -05:00
Pavel Krajcevski
7ed5c13405 Allow additional indexable types
Instead of using operator() to index into the second operand of the
VectorAddition function, use operator[]. This way we can add to pointers
and std::vector types as well.
2014-02-20 15:36:59 -05:00
Pavel Krajcevski
62cce58c2f Fix some of the vector multiplication and divide routines.
In general, we want the scalar division of vectors and matrices to
have the matrix come first and the scalar come second. It doesn't make
sense to divide a scalar by a vector or to divide a matrix by a vector,
so these should now produce errors at compile time.

Also, make sure to add additional types that can be multiplied together
using the * operator. If we multiply two vectors together, that's a dot
product. The size restrictions should be enforced at compile time by the
template parameters for VectorBase<T, N>::Dot

In this way, we can support vector/matrix multiplication by retaining the
* operator as well.
2014-02-20 14:49:35 -05:00
Pavel Krajcevski
2d7ee21fb7 Let the compiler choose what precision we want to do the vector-scalar multiplication/division in. 2014-02-19 19:36:28 -05:00
Pavel Krajcevski
4fc75f22dc Fix vector operators to avoid needing overloads 2014-02-17 13:02:43 -05:00
Pavel Krajcevski
0875ee0ddb Constify 2014-02-16 18:29:08 -05:00
Pavel Krajcevski
45b739a44a Add some tests for VectorBase 2014-02-16 17:17:25 -05:00
Pavel Krajcevski
543185fe2a Add normalization function to vectors 2014-02-16 12:30:37 -05:00
Pavel Krajcevski
e20d84b1ee Fix gross bug in VectorBase 2014-02-16 12:30:09 -05:00
Pavel Krajcevski
bcf7c5c389 Some more compiler error and warning fixes. 2013-10-15 10:32:38 -04:00
Pavel Krajcevski
89110be602 Get rid of a bunch of MSVC compiler warnings. 2013-10-15 00:31:33 -04:00
Pavel Krajcevski
47074c1224 Abstract away a bit more logic in order to allow us to easily override the core vector operations if need be. 2013-10-08 20:29:56 -04:00
Pavel Krajcevski
01a38dc76b Add more generic structures for performing scalar multiplication with vectors (i.e. ones that actually compile) 2013-10-08 18:39:32 -04:00
Pavel Krajcevski
473a1c1869 Move the operators out of the class definition so that we can derive from Vectors. 2013-10-08 15:06:20 -04:00
Pavel Krajcevski
cb348c3598 Reappropriate vexlib math headers into FasTC. 2013-10-03 17:19:28 -04:00