Rotating a rectangle using the matrix

About Monkey 2 Forums Monkey 2 Code Library Rotating a rectangle using the matrix

This topic contains 3 replies, has 3 voices, and was last updated by  nerobot 1 year, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #11832

    PhatPeter
    Participant

    The following example shows how to rotate a rectangle without any trigonometry.

    It uses only matrix hardware commands (translate & rotate) and can be used to rotate sprites drawn using DrawRect, which has no inbuilt rotation parameter.

    [/crayon]
    #11842

    nerobot
    Participant

    The same result via canvas extension:

    and adapted buildable example:

    #12026

    AdamStrange
    Participant

    mmmm.
    The first example, nice simple readable code
    The second ‘extension’ code is really (sorry to say it) horrible. much more complex, going into the ‘information hiding’ territory.

    I would have thought that code should be simple (for those) to understand?

    #12027

    nerobot
    Participant

    I just shown another point of view. I don’t use such code in my projects. 🙂

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.