intersect function with concave or rounded graphics
Posted: Thu Jan 07, 2010 12:29 am
I'd like to know if an object intersects another one, yes
but say these objects are ovals or concave polygons ...
the intersect function returns true if their rects intersect
even if their shapes does not intersect and if they are not inside each other !!!
a new feature like this one could be useful :
intersect (object, object)
if the object is an oval or rounded rect, its actual shape is considered
if it is another grc (polygon ...), its shape is "the points"
for any other object, its rect is considered
------------
And what about the difference between inside and border
an object can be within another one (say inside) but their borders (I say their shapes) does not intersect !!! it could be useful for some games (labytinth...) and other
for compatibility issues, we could keep "is within" (or not) for objects and points
as usual
but introduce a variant in the within function :
within (object1, object2 | point)
that returns true, when second param is an object,
if and only if object2 is entirely inside object1, considering their shapes / borders
and we could have the following 'intersect' syntax, with an optional third param :
intersect (object, object [, border])
that consider only objects borders if the third param is true
interesting for detection of "contact" / "touch" between objects borders
and consider objects rect insides if this third param is false or absent,
as usual
your feeling ... ?
Eric
FRANCE
but say these objects are ovals or concave polygons ...
the intersect function returns true if their rects intersect
even if their shapes does not intersect and if they are not inside each other !!!
a new feature like this one could be useful :
intersect (object, object)
if the object is an oval or rounded rect, its actual shape is considered
if it is another grc (polygon ...), its shape is "the points"
for any other object, its rect is considered
------------
And what about the difference between inside and border
an object can be within another one (say inside) but their borders (I say their shapes) does not intersect !!! it could be useful for some games (labytinth...) and other
for compatibility issues, we could keep "is within" (or not) for objects and points
as usual
but introduce a variant in the within function :
within (object1, object2 | point)
that returns true, when second param is an object,
if and only if object2 is entirely inside object1, considering their shapes / borders
and we could have the following 'intersect' syntax, with an optional third param :
intersect (object, object [, border])
that consider only objects borders if the third param is true
interesting for detection of "contact" / "touch" between objects borders
and consider objects rect insides if this third param is false or absent,
as usual
your feeling ... ?
Eric
FRANCE