Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Bug in Utilities.DistToLineSegment ? (Read 1140 times)
Rennie
Full Member
***
Offline


I Love MindFusion!

Posts: 108
Location: Copenhagen, Denmark
Joined: Jul 17th, 2012
Bug in Utilities.DistToLineSegment ?
Mar 30th, 2013 at 9:31am
Print Post  
Try this:

Code
Select All
         PointF p1 = new PointF(262, 47);
         PointF p2 = new PointF(262, 254);
         List<float> distances = new List<float>();
         for (float x = 250; x < 270; x++)
            distances.Add(Utilities.DistToLineSegment(new PointF(x, 121), p1, p2));
 



As x approaches the line the distance gets smaller, and when x has passed the line the distance gets larger. But when x is right on the line the distance is 74 instead of 0!

I think I've spent something like three hours trying to find out why the mouse selection of a custom-drawn node was unreliable. The problem is if I click exactly in the middle of the node then it didn't work, but it took quite a while before I figured that out, and then a long time tracking down why it was like that.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Bug in Utilities.DistToLineSegment ?
Reply #1 - Apr 1st, 2013 at 10:02am
Print Post  
Hi,

Use the InternalUtils.DistToLineSegment method instead the Utilities one. Apparently this is a known issue but we don't like to update the common.dll that often, so the fixed version is in the diagramming.dll's InternalUtils class.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint