コード例 #1
0
    void CalculateLocal(ShapeObject shapeA, ShapeObject shapeB, ShapeMatchType type)
    {
        Vector2   pointInWorld;
        Vector2D  pointInWorld2D = Vector2D.Zero();
        Polygon2D polyInWorld;

        foreach (Vector2D point in shapeA.pointsIn)
        {
            pointInWorld = point.ToVector2();

            pointInWorld2D.x = pointInWorld.x;
            pointInWorld2D.y = pointInWorld.y;

            polyInWorld = shapeB.GetPolygon();

            if (polyInWorld.PointInPoly(pointInWorld2D))
            {
                pointsIn++;
            }
        }

        foreach (Vector2D point in shapeB.pointsIn)
        {
            pointInWorld = point.ToVector2();

            pointInWorld2D.x = pointInWorld.x;
            pointInWorld2D.y = pointInWorld.y;

            polyInWorld = shapeA.GetPolygon();

            if (polyInWorld.PointInPoly(pointInWorld2D))
            {
                pointsIn++;
            }
        }
    }