/// <summary> /// This function returns a classification to see if this polyline /// contains wholly the 'test' polyline, /// is contained by the 'test' polyline, /// crosses the 'test' polyline, /// or does not intersect the contained polyline /// </summary> /// <param name="test"></param> /// <returns></returns> public eCLASSIFICATION Classify(PolyLine3d test) { // as a first pass, we're going to simply check bounding boxes //CalcBBox(); //test.CalcBBox(); bool p1, p2, p3, p4; bool t1, t2, t3, t4; t1 = BBOXContains(test.minx, test.miny); t2 = BBOXContains(test.minx, test.maxy); t3 = BBOXContains(test.maxx, test.miny); t4 = BBOXContains(test.maxx, test.maxy); //check to see if this contains all 4 points of test OR if (t1 && t2 && t3 && t4) { return(eCLASSIFICATION.eContaining); } // check to see if test contains all points of this p1 = test.BBOXContains(minx, miny); p2 = test.BBOXContains(minx, maxy); p3 = test.BBOXContains(maxx, miny); p4 = test.BBOXContains(maxx, maxy); if (p1 && p2 && p3 && p4) { return(eCLASSIFICATION.eIsContained); } //no overlap between any points - disjoint if ((t1 == false && t2 == false && t3 == false && t4 == false) && (p1 == false && p2 == false && p3 == false && p4 == false)) { return(eCLASSIFICATION.eNone); } //otherwise, we must be crossing somehow. return(eCLASSIFICATION.eCrosses); }