// // HGeometryUtils.h // SteveMaggieCpp // // Created by Katarzyna Kalinowska-Górska on 20.05.2017. // // #ifndef HGeometryUtils_h #define HGeometryUtils_h #include "cocos2d.h" class HGeometryUtils { public: struct ThickSegment { cocos2d::Point point1; cocos2d::Point point2; float thickness; ThickSegment(){ point1 = cocos2d::Point(0,0); point2 = cocos2d::Point(0,0); thickness = 0; } ThickSegment(cocos2d::Point p1, cocos2d::Point p2, float pThickness){ point1 = p1; point2 = p2; thickness = pThickness; } }; static cocos2d::Rect getBoundingBoxToWorld(cocos2d::Node* node, bool ignoreTransformations = false); static cocos2d::Rect getRectIntersection(cocos2d::Rect rect1, cocos2d::Rect rect2); static bool segmentIntersectsRect(cocos2d::Rect rect, cocos2d::Point lineP1, cocos2d::Point lineP2); static cocos2d::Point addPoints(std::vector points); static void getLineABCFromPoints(cocos2d::Point pointA, cocos2d::Point pointB, float (&line)[3]); static bool segmentCrossesLine(cocos2d::Point sPointA, cocos2d::Point sPointB, float lineA, float lineB, float lineC); static float calculateIntersectionPercentage(cocos2d::Rect rect1, cocos2d::Rect rect2, int percentageOfWhichRect = 0); }; #endif /* HGeometryUtils_h */