Jump to content

BUG in AcGeLineSeg3d::intersectWith


Recommended Posts

Posted

Hi,

 

I have been using Autocad for a few days, but I have just discovered a bug into.

 

It is about the function intersectWith.

 

If I get 2 segments, which have a point in common, this function returns sometimes true, sometimes false.

 

Here is an example. I get the first segment to be [ 300.0 0.0 0.0] [100.0 0.0 0.0], and the other segment to be [0.0 gap 0.0 ] [100.0 0.0 0.0]. When I make a while with the gap varying in the interval [0 1], with the ratio 1/10^10, res is sometimes true (intersection), sometimes false (not intersected).

 

 

 

AcGePoint3d pt1Adl(0.00000000 ,0.00000000+gap,0.00000000);

AcGePoint3d pt1Bdl(100.0000000 ,0.00000000,0.00000000);

AcGePoint3d pt2Adl(300.00000000 ,0.00000000 ,0.00000000);

AcGePoint3d pt2Bdl(100.00000000 ,0.00000000 ,0.00000000);

AcGeLineSeg3d lSeg1dl(pt1Adl,pt1Bdl);

AcGeLineSeg3d lSeg2dl(pt2Adl,pt2Bdl);

 

res = lSeg1dl.intersectWith(lSeg2dl,ptInsd1,tol);

 

 

This is strange. I used a tolerance of tol=0.1, sometimes .01.

 

Can somebody (a mathematician) help me understand what it is happenning ?

 

 

Thanks in advance for any help

Posted

I was tempted to say this was a binary to decimal precision problem, but your tolerance setting should have accounted for that. Still, working that close to the margin

with the ratio 1/10^10

 

on double precision floating point operations will be risky.

 

There aren’t that many ARX programmers on this forum. You may be able to get more responses at http://www.theswamp.org/

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...