cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

11-Garnet

## How to rotate image without using "rotate" keyword in mathcad?

Example: A=(0,1,2) now by using rotate keyword Result = rotate(A,180); Result = (2,1,0). But how to do this without keyword ?

11 REPLIES 11
24-Ruby IV

11-Garnet
(To:ValeryOchkov)

yes i'm aware of that but how to do for random degrees for ex:  rotate(A,41) or rotate(A,33)?

24-Ruby V

"rotate" is used to rotate a picture(matrix) by a given angle in degree with some sort of antialiasing.

Why would you like to program that function yourself and not use the built-in one?

11-Garnet
(To:Werner_E)

Yes i'm aware of that keyword but how to do without keyword ? or is it possible to see how that "rotate" function program has written in mathcad ?

24-Ruby V

Yes i'm aware of that keyword but how to do without keyword ?

You haven't answered my question which simply was: WHY?

or is it possible to see how that "rotate" function program has written in mathcad ?

No, not that I would be aware of. The algorithms used in Mathcad are not a secret but are hard coded and so can't not be inspected unless you have access to the source code of the program.

As far as I am aware many algorithms implemented in Mathcad followed the "Numerical Recipes" and the four volumes of "Knuth - The Art of Computer Programming" but I am not sure if this also applies to the algorithms for manipulating bitmaps.

But if you study Books about computer graphics you sure will find various ways and algorithms how to rotate a bitmap picture and implement anti-aliasing.

Searching the net will reveal a lot of possible implementations, too. Some less, some more elaborate.

As one example you may ave a look at https://www.codeproject.com/Articles/12230/Anti-Aliased-Image-Rotation

11-Garnet
(To:Werner_E)

1. yes got that as you said  it's complicated (code)

2. "Yes i'm aware of that keyword but how to do without keyword ?" because it's my task which i have to complete i found it's bit difficult but i refer this post "https://community.ptc.com/t5/PTC-Mathcad/How-to-rotate-matrix-around-specific-index/td-p/29535" but still i could not make it!

24-Ruby V

The part which rotates the image/matrix is not complicated at all as you can see in my little program "Rotate" in the thread you have linked to. basically its simply a multiplication with a standard 2 x 2 rotation matrix. The routine was written to fit the data structure provided by the original poster and does not work (unchanged) on a picture matrix as the built-in "rotate" command. Furthermore no anti aliasing was implemented which could be the harder part if this is what you are looking for.

11-Garnet
(To:Werner_E)

ok understand! is it possible to do without "anti aliasing" just can we rotate the image?

24-Ruby V

ok understand! is it possible to do without "anti aliasing" just can we rotate the image?

Sure. I showed in the thread you linked to how this could be done.

3-Visitor

krogerfeedback

Example: A=(0,1,2) now by using rotate keyword Result = rotate(A,180); Result = (2,1,0). But how to do this without keyword ?

I didn't exactly understand this? Am I missing something?

23-Emerald III
(To:Reign623)

The OP didn't want to know the result of rotating, but wanted insight in the algorithm of how to do it.

Luc

Announcements
Top Tags