🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.graphics.algorithms
Article #46

Re: 2D image rotation problem

#46
From: Kap Shiwram
Date: Tue, 16 Jan 1996 21:31
34 lines
2284 bytes
xiaoyi@bmecg.bme.ohio-state.edu (Xiaoyi Wu) wrote:
>Just thought I might make things a bit more clear
>here:
>
>The FAQ talked about doing a reverse rotation to
>avoid holes in the rotated image, which I followed.
>The question is: even if you do it the reverse way,
>you still end up with some pixels that fall out
>of the range of the source image. How do you deal
>with this - for now, I just arbitrarily assign them
>the same value as the boundary pixels. Is there a
>better way?

Hmm, to keep it in the range of the source image, couldn't you use AND 
with your index?  Um, this is how I use to do it - the rotation failed 
but it was never out of the range of the source file. :)  Um, this is 
assuming you're using powers of 2 for the dimensions of your image of 
course; if you're not then you might have to suffer a divide (eeek) i.e. 
use the MOD of your index into the image and the dimensions multiplied.

Um, assuming your image dimensions are 32x32, 

   ; calculate the index [si] first
   and si, (32*32)-1
   lea si, [image+si]
   movsb

I'm curious though.. could you explain how you did the reverse rotation? 
I was thinking about this and doing landscapes or flags.  It always had 
holes in it since I was calculating the X and Y values to plot on screen 
but if I had just done a loop over the X and Y values then this would not 
have happened - instead, I would have just calculated the index into the 
image array and covered the entire area.  The problem is, I don't know 
how to get the reverse function.  Is it just the inverse?
Technical Details
Message-ID: <DLAMGr.LEM@wave.scar.utoronto.ca>
Path: arc1-ca.pugleaf.net!wave.scar!usenet
References: <4de7gt$j0i@charm.magnus.acs.ohio-state.edu> <4dec11$jg5@charm.magnus.acs.ohio-state.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.graphics.algorithms,comp.lang.c,sci.image.processing
Path: arc1-ca.pugleaf.net!wave.scar!usenet
From: Kap Shiwram <95shiwra@wave.scar.utoronto.ca>
Subject: Re: 2D image rotation problem
X-Nntp-Posting-Host: pc207.scar3.utoronto.ca
Content-Type: text/plain; charset=us-ascii
Message-ID: <DLAMGr.LEM@wave.scar.utoronto.ca>
To: xiaoyi@mozart.bme.ohio-state.edu
Sender: usenet@wave.scar.utoronto.ca (news owner)
Content-Transfer-Encoding: 7bit
Organization: Scarborough College, U of T
References: <4de7gt$j0i@charm.magnus.acs.ohio-state.edu> <4dec11$jg5@charm.magnus.acs.ohio-state.edu>
Mime-Version: 1.0
Date: Tue, 16 Jan 1996 21:31:38 GMT
X-Mailer: Mozilla 1.2N (Windows; I; 16bit)