any alternatives to Translate function ?

edited October 2015 in How To...

after a previous question which was answered, translate is cumulative.

i have reached that point again in open processing that i reached years ago, translate is designed wrong.

if i use translate (4,0,0) in a loop it will increment x by 4 8 12 etc. this is fine to translate(-4,0,0) to undo how this function works.

but if i use a complex equation such as

translate(0,0,20*cos(radians(posx)*mod)*sin(radians(posy)*mod) );

this could be impossible to undo the translate.

so my real question is, why the hell is translate cumulative, this really is a stupid way to design a function ?

Answers

  • translate is designed wrong.

    no its not

    why the hell is translate cumulative,

    because it makes good sense

    this really is a stupid way to design a function ?

    no it isn't

    If you translate with

    translate(x, y, z);

    you can reverse it with

    translate(-x, -y, -z);

  • The translate, rotate, and scale transformations are cumulative so you can combine them to create complex transformations which would be difficult to do in one operation.

  • edited October 2015

    so how do i reverse a complex equation if the equation cannot be reversed.

    example: this equation can be reversed but if i use more complex equation its impossible to reverse without a matrixreset or pop. also using matrixreset or pop in multiple calls to other sketches adds to the confusion.

    translate(0, 0, 20 * cos(radians(posx) * mod) * sin(radians(posy) * mod));
    

    this example should have times in it but it deletes the times when posting. [fixed]

    this is why translate is designed wrong, you cant undo all equations?

    another example try reversing this one then ?

    translate(posk * tan(mod) * 3, posj * sin(posk), 200 * cos(radians(posk / 2) * mod) * sin(radians(posj) * mod));
    

    as for complexity of other functions scale, rotate etc its not exactly difficult to do a +1 loop with maths sin etc. but its difficult to undo these functions.

  • edited October 2015

    If you translate with

    translate(x, y, z);
    

    you can reverse it with

    translate(-x, -y, -z);
    

    In that case, your x is posk * tan(mod) * 3, your y is posj * sin(posk), and your z is... well, you get the idea.

  • edited October 2015

    So what about if i use a random how can i undo a random or what about an external device changing values ?

    Unless i store all the random outputs of an equation to undo translate then i cant undo translate?

    I cant reset or pop a matrix back to a random point without saving the random output, a matrix has no definition or label so, if i popmatrix back to XYZ random from different sketches then the problems start ?

    Tracking multiple objects in 3 dimensions isnt exactly easy to undo ?

    This is why i stopped using processing a couple of years ago, was hoping a solution or alternative was available?

    Im no expert on this but online it says open gl 3.0 has depricated push pop matrix, android supports open gl 3.0!!!

    Translate without matrix ????

  • i think you need to show us what you are trying to do and why translate isn't working for you.

    (because at the moment it just sounds like you are complaining about addition and having to use local variables.)

  • this example should have times in it but it deletes the times when posting.

    you should post code as code, otherwise it takes two *s as the delimiters for a italic section. i've fixed a couple of the problem sentences above.

Sign In or Register to comment.