Re: Bounding Rectangle [and data type Rect]
Re: Bounding Rectangle [and data type Rect]
- Subject: Re: Bounding Rectangle [and data type Rect]
- From: Doug McNutt <email@hidden>
- Date: Mon, 29 Jul 2002 09:36:45 -0600
At 20:21 -0700 7/28/02, Paul Berkowitz wrote:
>
Except it's given in AppleScript as {X1, Y1, X2, Y2}, yes?
There is yet another type - a point - which is two integers, X and Y which locate a pixel. X is measured positive to the right and Y is measured positive down which may seem unreasonable to one trained in mathematics and physics but it makes sense to a typist who starts at the top left of an English page.
The horizontal/vertical order is also reversed from the conventions of mathematics for no apparent reason. Note how the vertical - Y - value comes first in types.h:
struct Point {
short v;
short h;
};
The rect type consists of two points. TopLeft and BottomRight of a rectangle in sequence.
struct Rect {
short top;
short left;
short bottom;
short right;
};
In some strange way the ordering makes sense. If you rotate the CRT screen counterclockwise so that the top becomes the left side and pretend that Apple's "v" coordinate is the mathematical X and the "h" is similarly Y the CRT looks like the graph paper you used in school. But top and bottom get hopelessly confused.
Different coordinates are used in OpenGL, a non-Apple open-source architecture that has come to dominate the hardware of video cards. It defines a point as (w, h) - width and height - which are the X and Y coordinates of mathematics. A rectangle is defined by two points, bottom left and top right. The height coordinate increases upward and a third coordinate is actually available for 3D work.
And then there is Adobe Postscript. . . . And AutoDesk's DXF. . .
Then comes AppleScript as above and I'm not even sure that the Y in Paul's reply increases downward or upward. AppleScript seems to be using OpenGL conventions but, as usual, it's all guesswork to a scripter. Where is the types.h file applicable to AppleScript? We have found errors.h How about some more Chris?
--
--> If you are presented a number as a percentage, and you do not clearly understand the numerator and the denominator involved, you are surely being lied to. <--
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.