0023361: Bug in gp_Trsf::Multiply
[occt.git] / src / QABugs / QABugs_19.cxx
... / ...
CommitLineData
1// Created on: 2002-05-21
2// Created by: QA Admin
3// Copyright (c) 2002-2012 OPEN CASCADE SAS
4//
5// The content of this file is subject to the Open CASCADE Technology Public
6// License Version 6.5 (the "License"). You may not use the content of this file
7// except in compliance with the License. Please obtain a copy of the License
8// at http://www.opencascade.org and read it completely before using this file.
9//
10// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12//
13// The Original Code and all software distributed under the License is
14// distributed on an "AS IS" basis, without warranty of any kind, and the
15// Initial Developer hereby disclaims all such warranties, including without
16// limitation, any warranties of merchantability, fitness for a particular
17// purpose or non-infringement. Please see the License for the specific terms
18// and conditions governing the rights and limitations under the License.
19
20
21
22#include <QABugs.hxx>
23
24#include <Draw_Interpretor.hxx>
25#include <DBRep.hxx>
26#include <DrawTrSurf.hxx>
27#include <AIS_InteractiveContext.hxx>
28#include <ViewerTest.hxx>
29#include <AIS_Shape.hxx>
30#include <TopoDS_Shape.hxx>
31
32#include <gp_Pnt2d.hxx>
33#include <gp_Ax1.hxx>
34#include <GCE2d_MakeSegment.hxx>
35#include <Geom2d_TrimmedCurve.hxx>
36#include <DrawTrSurf.hxx>
37
38#include <Precision.hxx>
39
40#include <PCollection_HAsciiString.hxx>
41
42//static Standard_Integer OCC230 (Draw_Interpretor& /*di*/, Standard_Integer /*argc*/, const char ** /*argv*/)
43static Standard_Integer OCC230 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
44{
45 if ( argc != 4) {
46 di << "ERROR OCC230: Usage : " << argv[0] << " TrimmedCurve Pnt2d Pnt2d" << "\n";
47 return 1;
48 }
49
50 gp_Pnt2d P1, P2;
51 if ( !DrawTrSurf::GetPoint2d(argv[2],P1)) {
52 di << "ERROR OCC230: " << argv[2] << " is not Pnt2d" << "\n";
53 return 1;
54 }
55 if ( !DrawTrSurf::GetPoint2d(argv[3],P2)) {
56 di << "ERROR OCC230: " << argv[3] << " is not Pnt2d" << "\n";
57 return 1;
58 }
59
60 GCE2d_MakeSegment MakeSegment(P1,P2);
61 Handle(Geom2d_TrimmedCurve) TrimmedCurve = MakeSegment.Value();
62 DrawTrSurf::Set(argv[1], TrimmedCurve);
63 return 0;
64}
65
66static Standard_Integer OCC142 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
67{
68 for(Standard_Integer i= 0;i <= 20;i++){
69 Handle(PCollection_HAsciiString) pstr = new PCollection_HAsciiString("TEST");
70 pstr->Clear();
71 }
72 di << "OCC142: OK" << "\n";
73 return 0;
74}
75
76static Standard_Integer OCC23361 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
77{
78 gp_Pnt p(0, 0, 2);
79
80 gp_Trsf t1, t2;
81 t1.SetRotation(gp_Ax1(p, gp_Dir(0, 1, 0)), -0.49328285294022267);
82 t2.SetRotation(gp_Ax1(p, gp_Dir(0, 0, 1)), 0.87538474718473880);
83
84 gp_Trsf tComp = t2 * t1;
85
86 gp_Pnt p1(10, 3, 4);
87 gp_Pnt p2 = p1.Transformed(tComp);
88 gp_Pnt p3 = p1.Transformed(t1);
89 p3.Transform(t2);
90
91 // points must be equal
92 if ( ! p2.IsEqual(p3, Precision::Confusion()) )
93 di << "ERROR OCC23361: equivalent transformations does not produce equal points" << "\n";
94 else
95 di << "OCC23361: OK" << "\n";
96
97 return 0;
98}
99
100void QABugs::Commands_19(Draw_Interpretor& theCommands) {
101 char *group = "QABugs";
102
103 theCommands.Add ("OCC230", "OCC230 TrimmedCurve Pnt2d Pnt2d", __FILE__, OCC230, group);
104 theCommands.Add ("OCC142", "OCC142", __FILE__, OCC142, group);
105 theCommands.Add ("OCC23361", "OCC23361", __FILE__, OCC23361, group);
106
107 return;
108}