Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Geometry.Tolerance

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
StormyC
665 Views, 4 Replies

Geometry.Tolerance

Can anyone help with explaining how Geometry.Tolerance works...

 

If i compare 2 points p1 = 28,5 and p2 = 101.4,120.2 and have a tolerance object that is 0,100 the result of the comparison is true.....

 

Tolerance tol = new Tolerance (0,100);

Point2d pt1 = new Point2d(28,5);

Point2d pt2 = new Point2d(101.4,120.2);

 

bool result = pt1.IsEqualTo(pt2,tol);

 

result will be true but I dont understand why.... the distance between the points is 136.6 and x coordinate differance is 115.2, both out of tolerance.  So, what's the 'tolerance' doing?

 

Many thanks.

 

EDIT: It was a coding error - seems I had mixed up coordinates.....

 

4 REPLIES 4
Message 2 of 5
StormyC
in reply to: StormyC

Wonder if anyone out there can enlighten me:

 

I now understand that Tolerance tol = new Tolerance (0,100); gives a distance tolerance of 100.  However, I do not understand what the 0 is.  Any figure in there doesnt change the outcome.  Its called "equalVector" and its type is "double".  Can anyone show me an example of how that would work?

 

Many thanks.

Message 3 of 5
FRFR1426
in reply to: StormyC

The first argument of the tolerance constructor is used to compare vectors (default: 1e-12), the second is to compare points (default: 1e-10). Vectors are used to store directions, so there are compared with a higher tolerance than points (a small difference between angles has a bigger impact than the same difference between distances).

Maxence DELANNOY
Manager
Add-ins development for Autodesk software products
http://wiip.fr
Message 4 of 5
StormyC
in reply to: FRFR1426

Thanks for the reply.

 

So if im comparing points, the vector part will have no effect and vis versa if im comparing vectors?

Message 5 of 5
FRFR1426
in reply to: StormyC

Yes. Point2d and Point3d.IsEqualTo use EqualPoint, Vector2d and Vector3d.IsEqualTo use EqualVector.

Maxence DELANNOY
Manager
Add-ins development for Autodesk software products
http://wiip.fr

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report