javaandroidgraphicspathandroid-gesture

Path intersection in android


I have 2 path objects in my android code.I have tried all the way to check whether these paths are intersected or not, but not able to do it. How can I check whether the paths are intersected or not. Appreciate any good response, Thanks !


Solution

  • have a look at Region.op

    I haven't tried it but I would suggest to use:

    Region.setPath(Path path, Region clip);
    

    to get a region from both of your paths and afterwards you can use:

    if (region1.op(region2,Region.Op.INTERSECT)) {
      // intersection
    }
    

    to check for intersection...