Skip to content

Commit

Permalink
+ Fix some tolerance issues
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Nov 13, 2013
1 parent 97a2b51 commit 3ffe593
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/Mod/Part/App/Geometry.cpp
Expand Up @@ -53,6 +53,7 @@
# include <GeomConvert_CompCurveToBSplineCurve.hxx>
# include <GeomLProp_CLProps.hxx>
# include <GeomLProp_SLProps.hxx>
# include <gp.hxx>
# include <gp_Circ.hxx>
# include <gp_Elips.hxx>
# include <gp_Hypr.hxx>
Expand Down Expand Up @@ -1200,7 +1201,8 @@ void GeomLineSegment::setPoints(const Base::Vector3d& Start, const Base::Vector3

try {
// Create line out of two points
if (p1.Distance(p2) < Precision::Confusion()) Standard_Failure::Raise("Both points are equal");
if (p1.Distance(p2) < gp::Resolution())
Standard_Failure::Raise("Both points are equal");
GC_MakeSegment ms(p1, p2);
if (!ms.IsDone()) {
throw Base::Exception(gce_ErrorStatusText(ms.Status()));
Expand Down
10 changes: 7 additions & 3 deletions src/Mod/Part/App/LinePyImp.cpp
Expand Up @@ -108,7 +108,9 @@ int LinePy::PyInit(PyObject* args, PyObject* /*kwd*/)
Base::Vector3d v2 = static_cast<Base::VectorPy*>(pV2)->value();
try {
// Create line out of two points
if (v1 == v2) Standard_Failure::Raise("Both points are equal");
double distance = Base::Distance(v1, v2);
if (distance < gp::Resolution())
Standard_Failure::Raise("Both points are equal");
GC_MakeSegment ms(gp_Pnt(v1.x,v1.y,v1.z),
gp_Pnt(v2.x,v2.y,v2.z));
if (!ms.IsDone()) {
Expand Down Expand Up @@ -203,7 +205,8 @@ void LinePy::setStartPoint(Py::Object arg)

try {
// Create line out of two points
if (p1.Distance(p2) < Precision::Confusion()) Standard_Failure::Raise("Both points are equal");
if (p1.Distance(p2) < gp::Resolution())
Standard_Failure::Raise("Both points are equal");
GC_MakeSegment ms(p1, p2);
if (!ms.IsDone()) {
throw Py::Exception(gce_ErrorStatusText(ms.Status()));
Expand Down Expand Up @@ -259,7 +262,8 @@ void LinePy::setEndPoint(Py::Object arg)

try {
// Create line out of two points
if (p1.Distance(p2) < Precision::Confusion()) Standard_Failure::Raise("Both points are equal");
if (p1.Distance(p2) < gp::Resolution())
Standard_Failure::Raise("Both points are equal");
GC_MakeSegment ms(p1, p2);
if (!ms.IsDone()) {
throw Py::Exception(gce_ErrorStatusText(ms.Status()));
Expand Down

0 comments on commit 3ffe593

Please sign in to comment.