I need to know if two polygon shapes touch each other.
You showed me how to use RPolygonClipper with union mode (RS.Union) :
Code: Select all
var clipper = new RPolygonClipper();
// add subject paths (islands: ccw, holes: cw):
clipper.addSubjectPath([new RVector(0,0), new RVector(100,0), new RVector(100,100), new RVector(0,100)]);
clipper.addSubjectPath([new RVector(50,50), new RVector(150,50), new RVector(150,150), new RVector(50,150)]);
// union:
clipper.execute(RS.Union, RS.NonZero);
// print result:
for (var c=0; c<clipper.getSolutionPathCount(); c++) {
var vertices = clipper.getSolutionPath(c);
qDebug("polygon:", vertices);
}
And I can check if results points are on the same line.
could you show me if it exists how ?
Thanks !