1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-05 18:16:23 +03:00

0022762: Bug in Graphic3d_Vector::IsParallel

This commit is contained in:
DLN 2012-02-10 10:04:08 +00:00 committed by bugmaster
parent ef57920a5d
commit ef8ca55b9c
2 changed files with 33 additions and 6 deletions

View File

@ -166,14 +166,15 @@ Standard_Boolean Graphic3d_Vector::IsNormalized () const {
Standard_Boolean Graphic3d_Vector::IsParallel (const Graphic3d_Vector& AV1, const Graphic3d_Vector& AV2) {
Standard_Real Result;
Standard_Real aDif1 = 0, aDif2 = 0, aDif3 = 0;
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);
aDif1 = AV1.X () * AV2.Y () - AV1.Y () * AV2.X ();
aDif2 = AV1.X () * AV2.Z () - AV1.Z () * AV2.X ();
aDif3 = AV1.Y () * AV2.Z () - AV1.Z () * AV2.Y ();
return ( (Abs (aDif1) <= Graphic3d_Vector_MyEpsilon) &&
(Abs (aDif2) <= Graphic3d_Vector_MyEpsilon) &&
(Abs (aDif3) <= Graphic3d_Vector_MyEpsilon) );
}
Standard_Real Graphic3d_Vector::NormeOf (const Standard_Real AX, const Standard_Real AY, const Standard_Real AZ) {

View File

@ -5029,6 +5029,31 @@ static Standard_Integer OCC20627 (Draw_Interpretor& di, Standard_Integer argc, c
return 0;
}
#include <Graphic3d_Vector.hxx>
Standard_Integer OCC22762 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
if (argc!=7)
{
di << "Wrong number of arguments" << "\n";
return -1;
}
Standard_Real X1_Pnt = atof(argv[1]);
Standard_Real Y1_Pnt = atof(argv[2]);
Standard_Real Z1_Pnt = atof(argv[3]);
Standard_Real X2_Pnt = atof(argv[4]);
Standard_Real Y2_Pnt = atof(argv[5]);
Standard_Real Z2_Pnt = atof(argv[6]);
Graphic3d_Vector AV1(X1_Pnt, Y1_Pnt, Z1_Pnt);
Graphic3d_Vector AV2(X2_Pnt, Y2_Pnt, Z2_Pnt);
di << "Result is: " << (Graphic3d_Vector::IsParallel(AV1, AV2) ? "true" : "false") << "\n" ;
return 0;
}
#include <IntCurvesFace_ShapeIntersector.hxx>
#include <gp_Lin.hxx>
Standard_Integer OCC17424 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
@ -5367,5 +5392,6 @@ void QAOCC::Commands(Draw_Interpretor& theCommands) {
theCommands.Add("OCC22736", "OCC22736 X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2", __FILE__, OCC22736, group);
theCommands.Add("OCC22744", "OCC22744", __FILE__, OCC22744, group);
theCommands.Add("bcarray", "bcarray", __FILE__, bcarray, group);
theCommands.Add("OCC22762", "OCC22762 x1 y1 z1 x2 y2 z3", __FILE__, OCC22762, group);
return;
}