Image Rotation

images php coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Sun Oct 31, 2010 5:38 pm

Image Rotation

Postby ozchasers » Sun Oct 31, 2010 5:51 pm

Hi All,

I have possibly a unique problem that I have been trying to work out. I will do my best to explain it.

If you could imagine a blank image, that is 512x512 in size, and in the center of this image is a weather radar. This weather radar picks up rainfall reflectivity for each degree of rotation (0 to 359 degrees), with each degree of rotation containing up to 256 pixels in a straight line originating from the center of the image. Each pixel can be one of 16 colours.

The data is supplied as a comma seperated list of each pixel, originating at the center and working its way out toward the end of the image. An example of this is shown below:

Code: Select all


Each number is a 'level' corresponding to a specific RGB value. 0 means do not paint a pixel, and 1 is a white pixel all the way up to 15 which is a dark red pixel.

My problem is that I can draw the 0 degree line easily, but drawing the 1 through to 89, 91 through to 179 etc is proving difficult. I thought about just rotating the image 1 degree for each line but this obviously doesnt work because the image gets larger each time its rotated.

Is there some method that I can use to acheive what I need?

Thanks in Advance for your help.

User avatar
php-forum GURU
php-forum GURU
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: Image Rotation

Postby egami » Mon Nov 01, 2010 5:24 am

Something that will make you think.

I failed math, so.. I wont be much help.
But you'll have to find the middle spot which would be

256 down, 256 over.

Then 0 degrees as your starting point to 359, x's 256. But there's going to be more to it.. because some of the pixels closer to the middle are going to share the same properties.

I think that's like an (xi,yi) math equation or even (x-a)^2 + (y-b)^2 = r ^ 2

Sorry I'm not much help.

Good luck, sorry I am not much help.

Return to “PHP coding => Images”

Who is online

Users browsing this forum: No registered users and 1 guest