Vector.opUnary

TODO : This does not work Negate the vector

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

Examples

Unittest OpUnary Negate

1 assert( vec2(  1.0f, 1.0f ) == -vec2( -1.0f, -1.0f ));
2 assert( vec2( -1.0f, 1.0f ) == -vec2(  1.0f, -1.0f ));
3 
4 assert( - vec3(  1.0f, 1.0f,  1.0f ) == vec3( -1.0f, -1.0f, -1.0f ));
5 assert( - vec3( -1.0f, 1.0f, -1.0f ) == vec3(  1.0f, -1.0f,  1.0f ));
6 
7 assert( vec4(  1.0f, 1.0f,  1.0f, 1.0f ) == -vec4( -1.0f, -1.0f, -1.0f, -1.0f ));
8 assert( vec4( -1.0f, 1.0f, -1.0f, 1.0f ) == -vec4(  1.0f, -1.0f,  1.0f, -1.0f ));

Meta