b311480e |
1 | // Copyright (c) 1995-1999 Matra Datavision |
973c2be1 |
2 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
3 | // |
973c2be1 |
4 | // This file is part of Open CASCADE Technology software library. |
b311480e |
5 | // |
d5f74e42 |
6 | // This library is free software; you can redistribute it and/or modify it under |
7 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
8 | // by the Free Software Foundation, with special exception defined in the file |
9 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
10 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
11 | // |
973c2be1 |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
b311480e |
14 | |
9bd59d1c |
15 | #include<BRepGProp_Sinert.ixx> |
16 | #include<BRepGProp_Gauss.hxx> |
17 | |
18 | //======================================================================= |
19 | //function : BRepGProp_Sinert |
20 | //purpose : Constructor |
21 | //======================================================================= |
22 | BRepGProp_Sinert::BRepGProp_Sinert() |
c63628e8 |
23 | { |
c63628e8 |
24 | } |
25 | |
9bd59d1c |
26 | //======================================================================= |
27 | //function : BRepGProp_Sinert |
28 | //purpose : Constructor |
29 | //======================================================================= |
30 | BRepGProp_Sinert::BRepGProp_Sinert (const BRepGProp_Face& theSurface, |
31 | const gp_Pnt& theLocation) |
c63628e8 |
32 | { |
9bd59d1c |
33 | SetLocation(theLocation); |
34 | Perform(theSurface); |
c63628e8 |
35 | } |
36 | |
9bd59d1c |
37 | //======================================================================= |
38 | //function : BRepGProp_Sinert |
39 | //purpose : Constructor |
40 | //======================================================================= |
41 | BRepGProp_Sinert::BRepGProp_Sinert(BRepGProp_Face& theSurface, |
42 | BRepGProp_Domain& theDomain, |
43 | const gp_Pnt& theLocation) |
c63628e8 |
44 | { |
9bd59d1c |
45 | SetLocation(theLocation); |
46 | Perform(theSurface, theDomain); |
c63628e8 |
47 | } |
48 | |
9bd59d1c |
49 | //======================================================================= |
50 | //function : BRepGProp_Sinert |
51 | //purpose : Constructor |
52 | //======================================================================= |
53 | BRepGProp_Sinert::BRepGProp_Sinert(BRepGProp_Face& theSurface, |
54 | const gp_Pnt& theLocation, |
55 | const Standard_Real theEps) |
7fd59977 |
56 | { |
9bd59d1c |
57 | SetLocation(theLocation); |
58 | Perform(theSurface, theEps); |
59 | } |
60 | |
61 | //======================================================================= |
62 | //function : BRepGProp_Sinert |
63 | //purpose : Constructor |
64 | //======================================================================= |
65 | BRepGProp_Sinert::BRepGProp_Sinert(BRepGProp_Face& theSurface, |
66 | BRepGProp_Domain& theDomain, |
67 | const gp_Pnt& theLocation, |
68 | const Standard_Real theEps) |
7fd59977 |
69 | { |
9bd59d1c |
70 | SetLocation(theLocation); |
71 | Perform(theSurface, theDomain, theEps); |
7fd59977 |
72 | } |
73 | |
9bd59d1c |
74 | //======================================================================= |
75 | //function : SetLocation |
76 | //purpose : |
77 | //======================================================================= |
78 | void BRepGProp_Sinert::SetLocation(const gp_Pnt& theLocation) |
7fd59977 |
79 | { |
9bd59d1c |
80 | loc = theLocation; |
7fd59977 |
81 | } |
82 | |
9bd59d1c |
83 | //======================================================================= |
84 | //function : Perform |
85 | //purpose : |
86 | //======================================================================= |
87 | void BRepGProp_Sinert::Perform(const BRepGProp_Face& theSurface) |
7fd59977 |
88 | { |
9bd59d1c |
89 | myEpsilon = 1.0; |
7fd59977 |
90 | |
9bd59d1c |
91 | BRepGProp_Gauss aGauss(BRepGProp_Gauss::Sinert); |
92 | aGauss.Compute(theSurface, loc, dim, g, inertia); |
7fd59977 |
93 | } |
94 | |
9bd59d1c |
95 | //======================================================================= |
96 | //function : Perform |
97 | //purpose : |
98 | //======================================================================= |
99 | void BRepGProp_Sinert::Perform(BRepGProp_Face& theSurface, |
100 | BRepGProp_Domain& theDomain) |
c63628e8 |
101 | { |
9bd59d1c |
102 | myEpsilon = 1.0; |
c63628e8 |
103 | |
9bd59d1c |
104 | BRepGProp_Gauss aGauss(BRepGProp_Gauss::Sinert); |
105 | aGauss.Compute(theSurface, theDomain, loc, dim, g, inertia); |
7fd59977 |
106 | } |
107 | |
9bd59d1c |
108 | //======================================================================= |
109 | //function : Perform |
110 | //purpose : |
111 | //======================================================================= |
112 | Standard_Real BRepGProp_Sinert::Perform(BRepGProp_Face& theSurface, |
113 | const Standard_Real theEps) |
c63628e8 |
114 | { |
9bd59d1c |
115 | BRepGProp_Domain anEmptyDomian; |
116 | return Perform(theSurface, anEmptyDomian, theEps); |
7fd59977 |
117 | } |
118 | |
9bd59d1c |
119 | //======================================================================= |
120 | //function : Perform |
121 | //purpose : |
122 | //======================================================================= |
123 | Standard_Real BRepGProp_Sinert::Perform(BRepGProp_Face& theSurface, |
124 | BRepGProp_Domain& theDomain, |
125 | const Standard_Real theEps) |
7fd59977 |
126 | { |
9bd59d1c |
127 | BRepGProp_Gauss aGauss(BRepGProp_Gauss::Sinert); |
128 | return myEpsilon = aGauss.Compute(theSurface, theDomain, loc, theEps, dim, g, inertia); |
7fd59977 |
129 | } |
130 | |
9bd59d1c |
131 | //======================================================================= |
132 | //function : GetEpsilon |
133 | //purpose : |
134 | //======================================================================= |
135 | Standard_Real BRepGProp_Sinert::GetEpsilon() |
7fd59977 |
136 | { |
7fd59977 |
137 | return myEpsilon; |
138 | } |