// original post to the D newsgroup: // https://www.digitalmars.com/d/archives/10510.html#N10554 // Test to manipulate 3D vectors, in D! // by Sean L Palmer (seanpalmer@directvinternet.com) // This code is released without any warranty. Use at your own risk. import core.stdc.stdio; import core.math : sqrt; template VecTemplate(tfloat, int dim:3) { struct Vector { tfloat[dim] d; version(none) { // sets the vector to the value of the given array void set(tfloat[dim] r) { d[] = r[]; } // comparison (a == b, a != b) bool opEquals(Vector b) { for (int i=0; i