You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let me first tell you how great and useful your library is. I'm currently developing a geometry project in C# and have encountered floating point issues in it. So I'm very thankful about your solution.
I've downloaded it and have run the unit tests. One test is failing: the Mesh_CreateTetrahedron throws an assertion failure.
I will try your library out and will give you a feedback in the next days.
I have a very basic question: Are the arithmetic operations like diff or sum not intended to be used
by clients? Because the ExactArithmetic class has just internal scope. Can I only use the geometric
predicates?
I think I just was just being conservative about what parts to make public.
You have to be quite careful in using the arithmetic operations in other contexts - I'd suggest you refer to the Shewchuck paper too. How do you intend to use the arithmetic operations otherwise?
Let's say I have two vectors with the same origin. I know that both vectors are collinear. Now I want to know if they are pointing in the same direction or in the oppsite. I think I can't solve that just by means of the two Shewchuk predicates.
Example code (more pseudo than C#):
Vector Origin = (0, 0);
Vector a = (4, 0);
Vector b = (-4, 0);
Vector2D t = a - Origin;
Vector2D t2 = c - Origin;
if (Math.Sign(t.X) != Math.Sign(t2.X) || Math.Sign(t.Y) != Math.Sign(t2.Y))
result = OPPOSITE_DIRECTION;
else
return = SAME_DIRECTION;
So I just simply check the sign of the X and Y and if they are not equal than I know that these vectors are pointing in the opposite direction.
I wanted to use TwoDiff(double a, double b,double x,double y) in place of the minus operators to avoid rounding errors that could creep in. But I don't know how to use this method.
That's a good question.
I don't know enough to say whether TwoDiff would give you a reliable check, or whether you need to dig in a bit more carefully. What about adding this check as a geometric primitive, thus keeping the implementation internal, maybe with a few tests?
Otherwise, you are of course free to take and use the code any way you want.
Activity
govert commentedon Dec 7, 2014
I think I just was just being conservative about what parts to make public.
You have to be quite careful in using the arithmetic operations in other contexts - I'd suggest you refer to the Shewchuck paper too. How do you intend to use the arithmetic operations otherwise?
NMO13 commentedon Dec 11, 2014
Let's say I have two vectors with the same origin. I know that both vectors are collinear. Now I want to know if they are pointing in the same direction or in the oppsite. I think I can't solve that just by means of the two Shewchuk predicates.
Example code (more pseudo than C#):
Vector Origin = (0, 0);
Vector a = (4, 0);
Vector b = (-4, 0);
Vector2D t = a - Origin;
Vector2D t2 = c - Origin;
if (Math.Sign(t.X) != Math.Sign(t2.X) || Math.Sign(t.Y) != Math.Sign(t2.Y))
result = OPPOSITE_DIRECTION;
else
return = SAME_DIRECTION;
So I just simply check the sign of the X and Y and if they are not equal than I know that these vectors are pointing in the opposite direction.
I wanted to use TwoDiff(double a, double b,double x,double y) in place of the minus operators to avoid rounding errors that could creep in. But I don't know how to use this method.
govert commentedon Dec 14, 2014
That's a good question.
I don't know enough to say whether TwoDiff would give you a reliable check, or whether you need to dig in a bit more carefully. What about adding this check as a geometric primitive, thus keeping the implementation internal, maybe with a few tests?
Otherwise, you are of course free to take and use the code any way you want.
NMO13 commentedon Dec 24, 2014
Ok thanks!