Tuesday 15 January 2013

graphics - Should I implement matrix transformations over changing object coordinates? -


I have a set of objects that can be scaled and translated. Let's assume that the user selects an object and draws it in some position. I was thinking of implementing it in two different ways: either changing the coordinates of the object while changing the position of the mouse, or the change matrix is ​​changing. Is one of these implementations better than the other? My main issues are:

  • Display
  • Code organization
  • Scalability

    Objects have some coordinates, and the way you see the objects, there is a fixed frame in context. I think it's not better to mess with your coordinates, and instead of just changing the matrix that "I'm moving the object" from "Object is here" here. It is very clean, according to the execution, you have to apply for each object conversion, so that you can do it once only once. To It is better to keep things "related to something physical" in the code organization's perspective; And from a scalability perspective, whenever a user turns into a visual, all the objects are not necessarily curious to implement the change - you do convert the objects when you present them, so if you have a Can not leave the move; If you have not saved some of your items during each stage, then you will be in trouble soon. Finally, applying several changes in the same object accumulates errors.

    Conscience, but obvious preference, I think!

No comments:

Post a Comment