Rect t: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
m (revert)  | 
				Thunder4ik (talk | contribs)  m (clean up, added deadend tag)  | 
				||
| (3 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
{{  | {{Dead end|date=January 2024}}  | ||
{{DISPLAYTITLE:Rect_t}}  | |||
A rectangle with a two-int point location (the upper-left-hand corner) and an int width and height.  | |||
  struct Rect_t  |   struct Rect_t  | ||
  {  |   {  | ||
| Line 7: | Line 9: | ||
  };  |   };  | ||
==Example==  | ==Example==  | ||
A rectangle   | A rectangle whose upper-left-hand corner is at (3, 4) and whose bottom-right-hand corner is at (5, 6) would be constructed like this:  | ||
  Rect_t rect = { 3, 4, 5-3, 6-4 };  |   Rect_t rect = { 3, 4, 5-3, 6-4 };  | ||
Similarly, a rectangle starting at (3, 4) with width   | Similarly, a rectangle starting at (3, 4) with width 2 and height 2 would be constructed like this:  | ||
  Rect_t rect = { 3, 4, 2, 2 };  |   Rect_t rect = { 3, 4, 2, 2 };  | ||
[[Category:Helpers]]  | [[Category:Helpers]]  | ||
[[Category:Structures]]  | |||
Latest revision as of 09:09, 21 January 2024
This article has no 
 links to other VDC articles. Please help improve this article by adding links 
 that are relevant to the context within the existing text. 
January 2024
January 2024
A rectangle with a two-int point location (the upper-left-hand corner) and an int width and height.
struct Rect_t
{
	int x, y;
	int width, height;
};
Example
A rectangle whose upper-left-hand corner is at (3, 4) and whose bottom-right-hand corner is at (5, 6) would be constructed like this:
Rect_t rect = { 3, 4, 5-3, 6-4 };
Similarly, a rectangle starting at (3, 4) with width 2 and height 2 would be constructed like this:
Rect_t rect = { 3, 4, 2, 2 };