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 | |
42cf5bc1 |
15 | |
16 | #include <BRepGProp_Domain.hxx> |
17 | #include <BRepGProp_Face.hxx> |
18 | #include <BRepGProp_Gauss.hxx> |
19 | #include <BRepGProp_Sinert.hxx> |
20 | #include <gp_Pnt.hxx> |
9bd59d1c |
21 | |
22 | //======================================================================= |
23 | //function : BRepGProp_Sinert |
24 | //purpose : Constructor |
25 | //======================================================================= |
26 | BRepGProp_Sinert::BRepGProp_Sinert() |
c63628e8 |
27 | { |
c63628e8 |
28 | } |
29 | |
9bd59d1c |
30 | //======================================================================= |
31 | //function : BRepGProp_Sinert |
32 | //purpose : Constructor |
33 | //======================================================================= |
34 | BRepGProp_Sinert::BRepGProp_Sinert (const BRepGProp_Face& theSurface, |
35 | const gp_Pnt& theLocation) |
c63628e8 |
36 | { |
9bd59d1c |
37 | SetLocation(theLocation); |
38 | Perform(theSurface); |
c63628e8 |
39 | } |
40 | |
9bd59d1c |
41 | //======================================================================= |
42 | //function : BRepGProp_Sinert |
43 | //purpose : Constructor |
44 | //======================================================================= |
45 | BRepGProp_Sinert::BRepGProp_Sinert(BRepGProp_Face& theSurface, |
46 | BRepGProp_Domain& theDomain, |
47 | const gp_Pnt& theLocation) |
c63628e8 |
48 | { |
9bd59d1c |
49 | SetLocation(theLocation); |
50 | Perform(theSurface, theDomain); |
c63628e8 |
51 | } |
52 | |
9bd59d1c |
53 | //======================================================================= |
54 | //function : BRepGProp_Sinert |
55 | //purpose : Constructor |
56 | //======================================================================= |
57 | BRepGProp_Sinert::BRepGProp_Sinert(BRepGProp_Face& theSurface, |
58 | const gp_Pnt& theLocation, |
59 | const Standard_Real theEps) |
7fd59977 |
60 | { |
9bd59d1c |
61 | SetLocation(theLocation); |
62 | Perform(theSurface, theEps); |
63 | } |
64 | |
65 | //======================================================================= |
66 | //function : BRepGProp_Sinert |
67 | //purpose : Constructor |
68 | //======================================================================= |
69 | BRepGProp_Sinert::BRepGProp_Sinert(BRepGProp_Face& theSurface, |
70 | BRepGProp_Domain& theDomain, |
71 | const gp_Pnt& theLocation, |
72 | const Standard_Real theEps) |
7fd59977 |
73 | { |
9bd59d1c |
74 | SetLocation(theLocation); |
75 | Perform(theSurface, theDomain, theEps); |
7fd59977 |
76 | } |
77 | |
9bd59d1c |
78 | //======================================================================= |
79 | //function : SetLocation |
80 | //purpose : |
81 | //======================================================================= |
82 | void BRepGProp_Sinert::SetLocation(const gp_Pnt& theLocation) |
7fd59977 |
83 | { |
9bd59d1c |
84 | loc = theLocation; |
7fd59977 |
85 | } |
86 | |
9bd59d1c |
87 | //======================================================================= |
88 | //function : Perform |
89 | //purpose : |
90 | //======================================================================= |
91 | void BRepGProp_Sinert::Perform(const BRepGProp_Face& theSurface) |
7fd59977 |
92 | { |
9bd59d1c |
93 | myEpsilon = 1.0; |
7fd59977 |
94 | |
9bd59d1c |
95 | BRepGProp_Gauss aGauss(BRepGProp_Gauss::Sinert); |
96 | aGauss.Compute(theSurface, loc, dim, g, inertia); |
7fd59977 |
97 | } |
98 | |
9bd59d1c |
99 | //======================================================================= |
100 | //function : Perform |
101 | //purpose : |
102 | //======================================================================= |
103 | void BRepGProp_Sinert::Perform(BRepGProp_Face& theSurface, |
104 | BRepGProp_Domain& theDomain) |
c63628e8 |
105 | { |
9bd59d1c |
106 | myEpsilon = 1.0; |
c63628e8 |
107 | |
9bd59d1c |
108 | BRepGProp_Gauss aGauss(BRepGProp_Gauss::Sinert); |
109 | aGauss.Compute(theSurface, theDomain, loc, dim, g, inertia); |
7fd59977 |
110 | } |
111 | |
9bd59d1c |
112 | //======================================================================= |
113 | //function : Perform |
114 | //purpose : |
115 | //======================================================================= |
116 | Standard_Real BRepGProp_Sinert::Perform(BRepGProp_Face& theSurface, |
117 | const Standard_Real theEps) |
c63628e8 |
118 | { |
9bd59d1c |
119 | BRepGProp_Domain anEmptyDomian; |
120 | return Perform(theSurface, anEmptyDomian, theEps); |
7fd59977 |
121 | } |
122 | |
9bd59d1c |
123 | //======================================================================= |
124 | //function : Perform |
125 | //purpose : |
126 | //======================================================================= |
127 | Standard_Real BRepGProp_Sinert::Perform(BRepGProp_Face& theSurface, |
128 | BRepGProp_Domain& theDomain, |
129 | const Standard_Real theEps) |
7fd59977 |
130 | { |
9bd59d1c |
131 | BRepGProp_Gauss aGauss(BRepGProp_Gauss::Sinert); |
132 | return myEpsilon = aGauss.Compute(theSurface, theDomain, loc, theEps, dim, g, inertia); |
7fd59977 |
133 | } |
134 | |
9bd59d1c |
135 | //======================================================================= |
136 | //function : GetEpsilon |
137 | //purpose : |
138 | //======================================================================= |
139 | Standard_Real BRepGProp_Sinert::GetEpsilon() |
7fd59977 |
140 | { |
7fd59977 |
141 | return myEpsilon; |
142 | } |