Computer Science Canada Pic.Rotate cut off pics |
Author: | riveryu [ Wed May 14, 2008 6:36 pm ] |
Post subject: | Pic.Rotate cut off pics |
How do I avoid cutting off parts of a picture when rotating a picture at a certain point? |
Author: | Sean [ Wed May 14, 2008 6:43 pm ] |
Post subject: | Re: Pic.Rotate cut off pics |
Can you give us the code that had this error in it, so we can see what is wrong. Hard to tell when we don't see exactly what you see. |
Author: | isaiahk9 [ Wed May 14, 2008 6:48 pm ] |
Post subject: | RE:Pic.Rotate cut off pics |
an inefficient way (but easy) would to just add more white around the edges of the picture, so that only white is cut off and we don't see it |
Author: | riveryu [ Wed May 14, 2008 6:50 pm ] | ||
Post subject: | Re: Pic.Rotate cut off pics | ||
Here is an example of the situation, maybe im using Pic.Rotate wrongly...
|
Author: | riveryu [ Wed May 14, 2008 7:21 pm ] |
Post subject: | RE:Pic.Rotate cut off pics |
Thanks isaiahk9, that solved the problem. Aside from that,is there an actual "efficient" way? Anyone? |
Author: | Tony [ Wed May 14, 2008 7:45 pm ] |
Post subject: | RE:Pic.Rotate cut off pics |
Writing your own function would be the way to go for this one. Rotate just the non-white pixels for optimization. You could make it super fast if you pre-calculate some transformation matrices. Keeping equations more abstract requires more calculations run-time, but allows for greater flexibility. This is how most of 2D graphics are handled -- rotation, scaling, shearing, reflections, projection |
Author: | Saad [ Wed May 14, 2008 7:53 pm ] | ||
Post subject: | Re: RE:Pic.Rotate cut off pics | ||
riveryu @ Wed May 14, 2008 7:21 pm wrote: Thanks isaiahk9, that solved the problem.
Aside from that,is there an actual "efficient" way? Anyone? A much better way would be to use 2D rotation. The 2D rotation formula is the following (TeX tags for the win) This however works only for the origin, and as a result you want to tranlate it to the origin. Some code that you might want to look at
Now apply the rotation too all the points on the square |
Author: | riveryu [ Wed May 14, 2008 8:07 pm ] |
Post subject: | RE:Pic.Rotate cut off pics |
Thanks a lot! Tony, Saad. When did you guys learn about transformation matrices? I wish I'll learn it in grade 10...Do you learn this in math courses? I dont like using something I dont understand... I wish there is a list of topics for people to learn about from beginner to advanced just from programming theories(concepts thats feasible no matter the language). Does such a list already exist? I would gladly make one for ppl if I know enough. |
Author: | syntax_error [ Wed May 14, 2008 11:56 pm ] |
Post subject: | RE:Pic.Rotate cut off pics |
you dont need a math course per se, to learn them, if you have an interest: library. enough said. |
Author: | CodeMonkey2000 [ Thu May 15, 2008 2:59 pm ] |
Post subject: | RE:Pic.Rotate cut off pics |
Better yet, internet. Don't limit your education to just what you do in school. |