This library is currently based on the Adobe's one but I'm also taking ideas from other languages (like the mentioned above).
I'd like to make this lib open for everyone to add stuff to it, so if you have any ideas related to geometry that can help lovers out then by all means share it here and I'll add it (if it's usefull )
Functions in the build:
- function newRect(x,y,width,height)
- function moveRect(Rect,x,y)
- function resizeRect(Rect,width,height)
- function reshapeRect(Rect,x,y,width,height)
- function getArea(Rect)
- function getInter(Rect1,Rect2)
- function isInter(Rect1,Rect2,Tolerance)
- function isIn(Rect,x,y)
- function getUnion(Rect1,Rect2)
- function equalsRect(Rect1,Rect2)
- function emptyRect(Rect)
- function isEmpty(Rect)
- function tostringRect(Rect1,'Name')
- Creating a rectangle with just one line of code
- Moving, resizing and reshaping rectangles
- Getting the area (px^2) of a rectangle
- Getting the Intersetion Area of two rectangles
- Checking if two rectangles are intersecting
- Getting the Union data of two rectangles
- Emptying a rectangle and check if rectangles are empty
- Converting a rectangle data into a printable string
Functio to check if a point is within a rectangle
Check if a rectangle is the same as another rectangle
"Growing" a rectangle
Checking if a rectangle is.. a rectangle and not an empty table
Changing the location of a rectangle
Making a rectangle "empty"
Resizing a rectangle
Recreating rectangle.java to löve--Dropped because of legal issues
Union of two rectangles (or more)
Change log:
v2.4:
- Added resizeRect()
- Added moveRect()
- Added equalsRect()
- Added isEmpty()
- Added emptyRect()
- Added getArea()
- Added tostringRect()
- Added tolerance to isInter()
- Optimized isInter()
- Added getUnion
- Optimized getInter(), thanks to jonyzz
- Added newRect
- Added isInter
- Added getInter
(Licence stuff: You can use this file however you want: use it, edit it, include it in a commercial game (free or paid) and distribute it to your friends, you can do all that and it's free of charge)