blob: 3b55c4cf10486a3ca7980369de46f184b90e33dc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
// File: BRepBuilderAPI_Transform.cxx
// Created: Fri Dec 9 09:14:55 1994
// Author: Jacques GOUSSARD
// <jag@topsn2>
#include <BRepBuilderAPI_Transform.ixx>
#include <BRepTools_TrsfModification.hxx>
#include <gp.hxx>
//=======================================================================
//function : BRepBuilderAPI_Transform
//purpose :
//=======================================================================
BRepBuilderAPI_Transform::BRepBuilderAPI_Transform (const gp_Trsf& T) :
myTrsf(T)
{
myModification = new BRepTools_TrsfModification(T);
}
//=======================================================================
//function : BRepBuilderAPI_Transform
//purpose :
//=======================================================================
BRepBuilderAPI_Transform::BRepBuilderAPI_Transform (const TopoDS_Shape& S,
const gp_Trsf& T,
const Standard_Boolean Copy) :
myTrsf(T)
{
myModification = new BRepTools_TrsfModification(T);
Perform(S,Copy);
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void BRepBuilderAPI_Transform::Perform(const TopoDS_Shape& S,
const Standard_Boolean Copy)
{
// myUseModif = Copy || myTrsf.IsNegative(); bug gp_Trsf.
myUseModif = Copy ||
myTrsf.ScaleFactor()*myTrsf.HVectorialPart().Determinant() < 0. ||
Abs(Abs(myTrsf.ScaleFactor()) - 1) > gp::Resolution();
if (myUseModif) {
Handle(BRepTools_TrsfModification) theModif =
Handle(BRepTools_TrsfModification)::DownCast(myModification);
theModif->Trsf() = myTrsf;
DoModif(S,myModification);
}
else {
myLocation = myTrsf;
myShape = S.Moved(myLocation);
Done();
}
}
//=======================================================================
//function : ModifiedShape
//purpose :
//=======================================================================
const TopoDS_Shape& BRepBuilderAPI_Transform::ModifiedShape
(const TopoDS_Shape& S) const
{
if (myUseModif) {
return myModifier.ModifiedShape(S);
}
static TopoDS_Shape SM;
SM = S.Moved (myLocation);
return SM;
}
//=======================================================================
//function : Modified
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepBuilderAPI_Transform::Modified
(const TopoDS_Shape& F)
{
if (!myUseModif) {
myGenerated.Clear();
myGenerated.Append(F.Moved(myLocation));
return myGenerated;
}
return BRepBuilderAPI_ModifyShape::Modified(F);
}
|