Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Navigating in a rotated grid?
Replies: 3   Last Post: Nov 17, 2010 7:03 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
JS

Posts: 49
Registered: 8/4/08
Re: Navigating in a rotated grid?
Posted: Nov 16, 2010 8:20 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Nov 15, 9:08 pm, JS <joe778...@gmail.com> wrote:
> Hi NG,
>
> I have now struggled with a problem for a while so I finally resort to
> asking here in the hope somebody can help me, or at least give a few
> pointers. The problem is very simple, so I hope there is a simple
> solution also, that I just haven't seen. Here goes:
>
> I have a list of coordinates (X,Y,Z) which I know form a rectangular
> grid with all datapoints within that rectangle existing in the list.
> However, the grid isrotatedand translated, relative to a "normal"
> coordinate system. That is, if I do scatter(X,Y), I see the rectangle
> as a diamond shape (i.e.,rotated) and shifted away from the origin
> (i.e., translated). The points are equally spaced.
>
> What I would like is a matrix with the surface formed by the
> coordinates (X,Y,Z) so that row 1 in the matrix corresponds to all the
> Z values found along the lower edge of the rectangle, row 2
> corresponds to the next row up, etc. In effect, I am thereby defining
> my own coordinate system like this, with axes parallel to the sides of
> the rectangle. Simple as that. Had the data not beenrotated, this
> would of course be trivial, but since it is, I can't "travel" along,
> e.g., a row in therotatedgrid and copy the Z values over to the
> right spot in a matrix, since a row is not a row in the "straight"
> coordinate system.
>
> I of course know the angle and offset so I have tried to simply shift
> all points so that the lower left corner has (0,0) and then rotate the
> points with:
>
> xCoordsRot = (xCoords.*cosd(rotAngle))-(yCoords.*sind(rotAngle));
> yCoordsRot = (xCoords.*sind(rotAngle))+(yCoords.*cosd(rotAngle));
>
> This works, however, this is not a very "nice" result, in that there
> are rounding issues causing the point spacing that I know to be an
> even number (500) no longer to be so. This, in turn makes is difficult
> to find the correct coordinates in my matrix for a given Z value.
>
> So, how can I move around along a row in arotatedgrid in a simple,
> efficient manner? Any suggestions?
>
> Thanks very much in advance!
>
> /JS


No-one? I should think it would be relevant to some image-analysis
applications with a rotated raster image needs to be manipulated?

/JS




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.