public static CheckContains ( float pVertices, int pVerticesLength, float pX, float pY ) : bool | ||
pVertices | float | |
pVerticesLength | int | |
pX | float | |
pY | float | |
리턴 | bool |
public static bool CheckCollision(/* final */ int pVerticesALength, /* final */ int pVerticesBLength, /* final */ float[] pVerticesA, /* final */ float[] pVerticesB) { /* Check all the lines of A ... */ for (int a = pVerticesALength - 4; a >= 0; a -= 2) { /* ... against all lines in B. */ if (CheckCollisionSub(a, a + 2, pVerticesA, pVerticesB, pVerticesBLength)) { return(true); } } /* Also check the 'around the corner of the array' line of A against all lines in B. */ if (CheckCollisionSub(pVerticesALength - 2, 0, pVerticesA, pVerticesB, pVerticesBLength)) { return(true); } else { /* At last check if one polygon 'contains' the other one by checking * if one vertex of the one vertices is contained by all of the other vertices. */ if (ShapeCollisionChecker.CheckContains(pVerticesA, pVerticesALength, pVerticesB[Constants.VERTEX_INDEX_X], pVerticesB[Constants.VERTEX_INDEX_Y])) { return(true); } else if (ShapeCollisionChecker.CheckContains(pVerticesB, pVerticesBLength, pVerticesA[Constants.VERTEX_INDEX_X], pVerticesA[Constants.VERTEX_INDEX_Y])) { return(true); } else { return(false); } } }
// =========================================================== // Fields // =========================================================== // =========================================================== // Constructors // =========================================================== // =========================================================== // Getter & Setter // =========================================================== // =========================================================== // Methods for/from SuperClass/Interfaces // =========================================================== // =========================================================== // Methods // =========================================================== public static bool CheckContains(/* final */ RectangularShape pRectangularShape, /* final */ float pX, /* final */ float pY) { RectangularShapeCollisionChecker.FillVertices(pRectangularShape, VERTICES_CONTAINS_TMP); return(ShapeCollisionChecker.CheckContains(VERTICES_CONTAINS_TMP, 2 * RECTANGULARSHAPE_VERTEX_COUNT, pX, pY)); }