Note: this was my mistake: the dis_from_seg and dis_from_line functions work correctly (see next post)
Hi,
In the scenario I outline below it appears that dis_from_seg is returning an incorrect distance:
Pnt1.x = 28416, Pnt1.y = 10240
Pnt2.x = 24576, Pnt2.y = 11392
TstPnt.x = 25600, TestPnt.y = 11136
(values are in DataCADs 1/32" units, z value of all points is zero)
dis_from_seg (Pnt1, Pnt2, TstPnt) is returning a value of 2404.99 (about 6' 3 5/8"). I have tried the dis_from_line function and it also returns this same result.
My own calculations give a result that the point is 49.0407058 (DataCad units ... about 1 17/32") from the line.
Using Measures/PointToPoint function in DataCAD (and clicking on the perpendicular point on the line as near as I can) shows the test point is 1 17/32" from the line (which agrees with my calculations).
Attached below is a screen shot from my debugging of this problem in Delphi. The DisFromPolyvert function on line 1238 is my own function, but it simply calls dis_from_seg for straight sides. I have checked this as you can see from the Evaluate/Modify window whereI have evaluated dis_from_seg with the same result. Values are shown in the Watch List window.
I can't see anything wrong with my logic, and it appears to me that dis_from_seg is returning an incorrect value. Perhaps I am missing something, so if anybody has any comments or suggestions I would be grateful of your input!
Hi,
In the scenario I outline below it appears that dis_from_seg is returning an incorrect distance:
Pnt1.x = 28416, Pnt1.y = 10240
Pnt2.x = 24576, Pnt2.y = 11392
TstPnt.x = 25600, TestPnt.y = 11136
(values are in DataCADs 1/32" units, z value of all points is zero)
dis_from_seg (Pnt1, Pnt2, TstPnt) is returning a value of 2404.99 (about 6' 3 5/8"). I have tried the dis_from_line function and it also returns this same result.
My own calculations give a result that the point is 49.0407058 (DataCad units ... about 1 17/32") from the line.
Using Measures/PointToPoint function in DataCAD (and clicking on the perpendicular point on the line as near as I can) shows the test point is 1 17/32" from the line (which agrees with my calculations).
Attached below is a screen shot from my debugging of this problem in Delphi. The DisFromPolyvert function on line 1238 is my own function, but it simply calls dis_from_seg for straight sides. I have checked this as you can see from the Evaluate/Modify window whereI have evaluated dis_from_seg with the same result. Values are shown in the Watch List window.
I can't see anything wrong with my logic, and it appears to me that dis_from_seg is returning an incorrect value. Perhaps I am missing something, so if anybody has any comments or suggestions I would be grateful of your input!
Attachments
Last edited by dhs on Sat Sep 14, 2019 2:26 pm, edited 1 time in total.
David Henderson
dhSoftware - Add-on Macros for DataCAD
dhSoftware - Add-on Macros for DataCAD