- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I have a problem when I use this function with 2 lines intersecting each other in the case where they are parallel. See code below.
XYZ pt1 = new XYZ();
XYZ pt2 = new XYZ(1, 0, 0);
XYZ pt3 = new XYZ(-1, 0, 0);
SetComparisonResult scr = Line.CreateBound(pt1, pt2).Intersect(Line.CreateBound(pt1, pt3), out IntersectionResultArray ira);
if (scr == SetComparisonResult.Overlap)
monMessage += "\n Case 1 overlap" + DonneXYZ(ira.get_Item(0).XYZPoint);
if (scr == SetComparisonResult.Disjoint)
monMessage += "\n Case 1 disjoint";
if (scr != SetComparisonResult.Overlap && scr != SetComparisonResult.Disjoint)
monMessage += "\n Case 1 problem";
This returns the Case 1 problem (not overlap, not disjoint).
If the 2 lines are not parallel to each other the result is overlap (correct)
XYZ pt4 = new XYZ(0, 1, 0);
SetComparisonResult scr2 = Line.CreateBound(pt1, pt2).Intersect(Line.CreateBound(pt1, pt4), out IntersectionResultArray ira2);
if (scr2 == SetComparisonResult.Overlap)
monMessage += "\n Case 2 overlap" + DonneXYZ(ira2.get_Item(0).XYZPoint);
if (scr2 == SetComparisonResult.Disjoint)
monMessage += "\n Case 2 disjoint";
if (scr2 != SetComparisonResult.Overlap && scr != SetComparisonResult.Disjoint)
monMessage += "\n Case 2 problem";
I also tried to get a curve with tangent parallel with the other curve :
Arc myArc = Arc.Create(new XYZ(0, 1, 0), 1.0, -0.5 * Math.PI, 0.0, XYZ.BasisX, XYZ.BasisY);
SetComparisonResult scr3 = myArc.Intersect(Line.CreateBound(pt1, pt3), out IntersectionResultArray ira3);
if (scr3 == SetComparisonResult.Overlap)
monMessage += "\n Case 2 overlap "+DonneXYZ(ira3.get_Item(0).XYZPoint);
if (scr3 == SetComparisonResult.Disjoint)
monMessage += "\n Case 2 disjoint";
if (scr3 != SetComparisonResult.Overlap && scr != SetComparisonResult.Disjoint)
monMessage += "\n Case 2 problem";
And the result is correct (overlap).
So it appears that the only incorrect result is when you have 2 parallel lines.
But it is a mess in my code (unexpected errors that I have to deal with) so if this could be fixed if would be great!
Benoit
Solved! Go to Solution.