Vector.opUnary

TODO : This does not work Negate the vector

struct Vector(type, int dim)
nothrow @nogc pure nothrow @nogc pure nothrow @nogc @safe const
opUnary
(
string op : "-"
)
()
if (
(dim >= 2) &&
(dim <= 4)
)

Examples

Unittest OpUnary Negate

assert( vec2(  1.0f, 1.0f ) == -vec2( -1.0f, -1.0f ));
assert( vec2( -1.0f, 1.0f ) == -vec2(  1.0f, -1.0f ));

assert( - vec3(  1.0f, 1.0f,  1.0f ) == vec3( -1.0f, -1.0f, -1.0f ));
assert( - vec3( -1.0f, 1.0f, -1.0f ) == vec3(  1.0f, -1.0f,  1.0f ));

assert( vec4(  1.0f, 1.0f,  1.0f, 1.0f ) == -vec4( -1.0f, -1.0f, -1.0f, -1.0f ));
assert( vec4( -1.0f, 1.0f, -1.0f, 1.0f ) == -vec4(  1.0f, -1.0f,  1.0f, -1.0f ));

Meta