algorithm - merging two SKShapeNode polygons into one -


i have multiple polygons (skshapenodes) on sprite kit layer. of them non-selfintersecting polygons. know:

1) if introduce new one, intersect of previous ones:

does sknode's: "func intersectsnode(_ node: sknode) -> bool" provide means this? how can iterate on node tree check against existing skshapenodes?

2) area of intersection:

if new polygon intersects , existing one, need calculate area of intersection (e.g. area in red in picture below). propose simple algirithm this?

3) merge both of polygons new skshapenode polygon , remove 2 prior polygons sknode tree.

so after introducing new polygon intersects existing polygon b, remove both of existing polygons , b sprite kit's node tree , introduce new polygon c path merge paths of polygon , b (in orange in picture below)

i'm relatively new sprite kit , graphics programming , not comfertable euclidean geometrics either. suggestions on approaches how proceed in these tasks appreciated!!!

enter image description here


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -