MantisBT
Mantis Bug Tracker Workflow

View Revisions: Issue #22762 All Revisions ] Back to Issue ]
Summary 0022762: Bug in Graphic3d_Vector::IsParallel
Revision 2011-12-01 11:51 by szy
Description Contribution from a customer.
" In 6.3.1 I found a bug in Graphic3d_Vector::IsParallel (which is exists in 6.5.2, too ) and I can provide a patch.

Your version:
   Standard_Real Result;
    Result = (AV1.Y () * AV2.Z () - AV1.Z () * AV2.Y ())
        - (AV1.X () * AV2.Z () - AV1.Z () * AV2.X ())
        - (AV1.X () * AV2.Y () - AV1.Y () * AV2.X ());

    return (Abs (Result) <= Graphic3d_Vector_MyEpsilon);

This returns the wrong result "true" for this example
                 AV1 = 0.57735026, 0.57735026, 0.57735026
                 AV2 = -0.40824828, -0.40824828, 0.81649655

My version is:
    Standard_Real d1 = AV1.Y () * AV2.Z () - AV1.Z () * AV2.Y ();
    Standard_Real d2 = AV1.Z () * AV2.X () - AV1.X () * AV2.Z ();
    Standard_Real d3 = AV1.X () * AV2.Y () - AV1.Y () * AV2.X ();

    Standard_Boolean res = (Abs (d1) <= Graphic3d_Vector_MyEpsilon) && (Abs (d2) <= Graphic3d_Vector_MyEpsilon) && (Abs (d3) <= Graphic3d_Vector_MyEpsilon);
    return res; "

Revision 2011-11-25 14:48 by szy
Description Contribution from BREDEX GmbH.
" In 6.3.1 I found a bug in Graphic3d_Vector::IsParallel (which is exists in 6.5.2, too ) and I can provide a patch.

Your version:
   Standard_Real Result;
    Result = (AV1.Y () * AV2.Z () - AV1.Z () * AV2.Y ())
        - (AV1.X () * AV2.Z () - AV1.Z () * AV2.X ())
        - (AV1.X () * AV2.Y () - AV1.Y () * AV2.X ());

    return (Abs (Result) <= Graphic3d_Vector_MyEpsilon);

This returns the wrong result "true" for this example
                 AV1 = 0.57735026, 0.57735026, 0.57735026
                 AV2 = -0.40824828, -0.40824828, 0.81649655

My version is:
    Standard_Real d1 = AV1.Y () * AV2.Z () - AV1.Z () * AV2.Y ();
    Standard_Real d2 = AV1.Z () * AV2.X () - AV1.X () * AV2.Z ();
    Standard_Real d3 = AV1.X () * AV2.Y () - AV1.Y () * AV2.X ();

    Standard_Boolean res = (Abs (d1) <= Graphic3d_Vector_MyEpsilon) && (Abs (d2) <= Graphic3d_Vector_MyEpsilon) && (Abs (d3) <= Graphic3d_Vector_MyEpsilon);
    return res; "



Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker