b311480e |
1 | // Created by: CKY / Contract Toubro-Larsen |
2 | // Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
3 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
7fd59977 |
6 | // |
d5f74e42 |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
7fd59977 |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
b311480e |
15 | |
16 | //-------------------------------------------------------------------- |
7fd59977 |
17 | //-------------------------------------------------------------------- |
18 | |
42cf5bc1 |
19 | #include <gp_Dir.hxx> |
7fd59977 |
20 | #include <gp_GTrsf.hxx> |
42cf5bc1 |
21 | #include <gp_Pnt.hxx> |
22 | #include <gp_XYZ.hxx> |
23 | #include <IGESData_IGESEntity.hxx> |
24 | #include <IGESSolid_SolidOfRevolution.hxx> |
25 | #include <Standard_Type.hxx> |
7fd59977 |
26 | |
92efcf78 |
27 | IMPLEMENT_STANDARD_RTTIEXT(IGESSolid_SolidOfRevolution,IGESData_IGESEntity) |
28 | |
b311480e |
29 | IGESSolid_SolidOfRevolution::IGESSolid_SolidOfRevolution () { } |
7fd59977 |
30 | |
31 | |
32 | void IGESSolid_SolidOfRevolution::Init |
33 | (const Handle(IGESData_IGESEntity)& aCurve, const Standard_Real Fract, |
34 | const gp_XYZ& AxisPnt, const gp_XYZ& Direction) |
35 | { |
36 | theCurve = aCurve; |
37 | theFraction = Fract; // default 1.0 |
38 | theAxisPoint = AxisPnt; // default (0,0,0) |
39 | theAxis = Direction; // default (0,0,1) |
40 | InitTypeAndForm(162,FormNumber()); |
41 | // Form 0 : Curve closed to Axis; Form 1 : Curve closed to itself |
42 | } |
43 | |
44 | void IGESSolid_SolidOfRevolution::SetClosedToAxis (const Standard_Boolean F) |
45 | { |
46 | InitTypeAndForm(162, (F ? 0 : 1)); |
47 | } |
48 | |
49 | Standard_Boolean IGESSolid_SolidOfRevolution::IsClosedToAxis () const |
50 | { |
51 | return (FormNumber() == 0); |
52 | } |
53 | |
54 | |
55 | Handle(IGESData_IGESEntity) IGESSolid_SolidOfRevolution::Curve () const |
56 | { |
57 | return theCurve; |
58 | } |
59 | |
60 | Standard_Real IGESSolid_SolidOfRevolution::Fraction () const |
61 | { |
62 | return theFraction; |
63 | } |
64 | |
65 | gp_Pnt IGESSolid_SolidOfRevolution::AxisPoint () const |
66 | { |
67 | return gp_Pnt(theAxisPoint); |
68 | } |
69 | |
70 | gp_Pnt IGESSolid_SolidOfRevolution::TransformedAxisPoint () const |
71 | { |
72 | if (!HasTransf()) return gp_Pnt(theAxisPoint); |
73 | else |
74 | { |
75 | gp_XYZ tmp = theAxisPoint; |
76 | Location().Transforms(tmp); |
77 | return gp_Pnt(tmp); |
78 | } |
79 | } |
80 | |
81 | gp_Dir IGESSolid_SolidOfRevolution::Axis () const |
82 | { |
83 | return gp_Dir(theAxis); |
84 | } |
85 | |
86 | gp_Dir IGESSolid_SolidOfRevolution::TransformedAxis () const |
87 | { |
88 | if (!HasTransf()) return gp_Dir(theAxis); |
89 | else |
90 | { |
91 | gp_XYZ tmp = theAxis; |
92 | gp_GTrsf loc = Location(); |
93 | loc.SetTranslationPart(gp_XYZ(0.,0.,0.)); |
94 | loc.Transforms(tmp); |
95 | return gp_Dir(tmp); |
96 | } |
97 | } |