These are C++ templates for vectors. Use free of charge for any purposes, including commercial use.

The main header you should include into your projects is MyVectors.h. Other headers should be just lying near it because it includes them internally. Feel free to modify the headers as you like and use them for any purpose whatsoever.

float2, and double2 are 2-dimensional vectors with float and double components respectively. float3, and double3 are 3-dimensional vectors with float and double components respectively. You can declare vectors of any dimension in the same way (templates allow that). If you don't know dimensions of your vectors at compile time, declare them as VectorF or VectorD. Then assign them dimensionality at run time using setNDims() function. Any two vectors can be added, subtracted, or multiplied as long as they have the same dimensionality.

  1. MyVectors.h
  2. VectorGuts.h
  3. MyMisc.h