1 // Created on: 1994-12-09
2 // Created by: Jacques GOUSSARD
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and / or modify it
9 // under the terms of the GNU Lesser General Public version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <BRepBuilderAPI_Transform.ixx>
19 #include <BRepTools_TrsfModification.hxx>
23 //=======================================================================
24 //function : BRepBuilderAPI_Transform
26 //=======================================================================
28 BRepBuilderAPI_Transform::BRepBuilderAPI_Transform (const gp_Trsf& T) :
31 myModification = new BRepTools_TrsfModification(T);
35 //=======================================================================
36 //function : BRepBuilderAPI_Transform
38 //=======================================================================
40 BRepBuilderAPI_Transform::BRepBuilderAPI_Transform (const TopoDS_Shape& S,
42 const Standard_Boolean Copy) :
45 myModification = new BRepTools_TrsfModification(T);
51 //=======================================================================
54 //=======================================================================
56 void BRepBuilderAPI_Transform::Perform(const TopoDS_Shape& S,
57 const Standard_Boolean Copy)
59 // myUseModif = Copy || myTrsf.IsNegative(); bug gp_Trsf.
61 myTrsf.ScaleFactor()*myTrsf.HVectorialPart().Determinant() < 0. ||
62 Abs(Abs(myTrsf.ScaleFactor()) - 1) > gp::Resolution();
64 Handle(BRepTools_TrsfModification) theModif =
65 Handle(BRepTools_TrsfModification)::DownCast(myModification);
66 theModif->Trsf() = myTrsf;
67 DoModif(S,myModification);
71 myShape = S.Moved(myLocation);
77 //=======================================================================
78 //function : ModifiedShape
80 //=======================================================================
82 const TopoDS_Shape& BRepBuilderAPI_Transform::ModifiedShape
83 (const TopoDS_Shape& S) const
86 return myModifier.ModifiedShape(S);
88 static TopoDS_Shape SM;
89 SM = S.Moved (myLocation);
94 //=======================================================================
97 //=======================================================================
99 const TopTools_ListOfShape& BRepBuilderAPI_Transform::Modified
100 (const TopoDS_Shape& F)
104 myGenerated.Append(F.Moved(myLocation));
107 return BRepBuilderAPI_ModifyShape::Modified(F);