- Joined
- Aug 7, 2013
- Messages
- 1,338
Hi,
I'm doing some calculations with rects, but I have no idea how their representation works.
In the WE GUI, you can make a rect by specifying four values: left, right, bottom, top.
But when you make a rect in JASS, you do it like this:
Rect(left, bottom, right, top).
I am guessing rects are really just wrappers around 2 locations/points:
Point 1: (left, bottom)
Point 2: (right, top)
Now these coordinates are sometimes (for me) obscenely high values or negative (but I guess the cartesian map is quite big).
It looks like given these two points, you just draw a straight line horizontally and vertically from each one until they meet/make a vertex, at which point you have some kind of square or rectangle.
But how does one:
1) Calculate the area of a given rect (given its coordinates?)
2) calculate the length of each side of a given rect
3) tell whether a point is inside a rect
4) tell whether a point lies exactly on the edge/border of the rect
5) highlight the exterior/border of a rect in a game (imagine seeing the square/rectangle outlined by footman or something).
I'm doing some calculations with rects, but I have no idea how their representation works.
In the WE GUI, you can make a rect by specifying four values: left, right, bottom, top.
But when you make a rect in JASS, you do it like this:
Rect(left, bottom, right, top).
I am guessing rects are really just wrappers around 2 locations/points:
Point 1: (left, bottom)
Point 2: (right, top)
Now these coordinates are sometimes (for me) obscenely high values or negative (but I guess the cartesian map is quite big).
It looks like given these two points, you just draw a straight line horizontally and vertically from each one until they meet/make a vertex, at which point you have some kind of square or rectangle.
But how does one:
1) Calculate the area of a given rect (given its coordinates?)
2) calculate the length of each side of a given rect
3) tell whether a point is inside a rect
4) tell whether a point lies exactly on the edge/border of the rect
5) highlight the exterior/border of a rect in a game (imagine seeing the square/rectangle outlined by footman or something).