How to redefine an AnyVec3.

Just a simple question.
I want to do something like this:

AnyVec3 Vec[3] = -1*Vec[3];

But I don’t know how the AnyBody syntax is in this case.

A Matlab equivalent would be:

Vec(3,:) = -1*Vec(3,:);

Thanks for your help!

Patrick

Hi,

This particular trick you can do by doing:

    AnyVec3 a={1,2,3};
    AnyMat33 A = {{1,0,0},{0,1,0},{0,0,-1}};
    AnyVec3 b=a*A;

OR
    AnyVec3 a={1,2,3};
    AnyVec3 b={a[0],a[1],-1*a[2]};


But please note that you cannot redefine the variable because AnyScript language is declarative. Each change would need an operation that lets the system know that something has changed.

Please check our tutorials ‘Advanced Script Features: Mathematical Expressions’ for more information.

Regards,
Pavel

Thank you for your answer, problem solved.