![]() This leads us to the conclusion that a rectangle’s area refers to the region it sweeps or covers. The area of a figure is the area that lies inside the boundaries of that figure. What is the Area of Rectangle?Īre we all familiar with the definition of “area” before delving further into the rectangle’s area? The space swept or covered by any closed figure is referred to as the area. Now that we are well versed with the basics of a rectangle let us find out the area of a rectangle and the formula of the area rectangle. The perimeter of a rectangle: The distance covered by the boundary of a rectangle is known as the perimeter of a rectangle.The diagonal of a rectangle divides it into two triangles of equal area.This means that the opposite sides of a rectangle are equal and parallel to each other, or opposite sides never cross each other. Two adjacent sides are never equal in the case of a rectangle. A rectangle has only opposite sides as equal and parallel.Then do something similar with the lower points.Let us learn some of the mathematical terms and concepts related to a rectangle now: Rotate it -45 (45 - 90) to get the "top right" point. That point would be your "top left" corner. You would start this line at tmx, tmy, and rotate this line 135 degrees (90 + 45). So, say you have a mid line that's 45 degrees. ![]() Other things you can do is "rotate" a line that's half the length of the "top" line to where it's 90 deg of the mid line. Then calculate the rectangles points, in this new normal form, and finally, rotate them back. Look up 2D graphics for the math, it's straight forward. Once you have the orientation, you can "rotate" the line back to the Y axis. (mind, there's some games with quadrants, and signs, and stuff to get this right - but this is the gist of it.) The arctangent(dy / dx) is the angle of the line. The next trick is to take the mid line, and calculate it's rotational offset off the Y axis. Obviously, that's the simplest case and assuming that the line of (tmx, tmy) (bmx, bmy) is solely along the Y axis. X1 = top_middle_x - top/bottom_length / 2 (x1, y2) - (btm_middle_x, btm_middle_y) - (x2, y2)Īnd top/bottom length along with right/left length. If you have the midpoint of the top and bottom, and the sides lengths, the rest is simple. There's a difference between a "quadrilateral" and a "rectangle". When implementing this you can obviously speed it up by only calculating each unique multiplication a single time: (p1x, p1y) = (x1 - u1x * l1 / 2, y1 - u1y * l1 / 2)įrom here we can find the remaining points just by adding the appropriate multiples of our basis vectors. We simply start at our point (x1, y1) and move back along that side by half the side length: Now we have enough information to find the 'top-left' corner. Or take at look at the equations for 2D rotations and substitute in 90 degrees. You can see this just by trying it out on paper. 90 degree rotation turns out to just be swapping the coordinates and negating one of them. The rotated vector will be parallel to the top and bottom lines. Next, we rotate this vector anticlockwise by 90 degrees. ![]() make it length 1) so we can use it later as a basis to find our coordinates. This vector is parallel to the side lines:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |