Commit | Line | Data |
---|---|---|

b311480e | 1 | -- Created on: 1992-11-05 |

2 | -- Created by: Remi LEQUETTE | |

3 | -- Copyright (c) 1992-1999 Matra Datavision | |

4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS | |

5 | -- | |

6 | -- The content of this file is subject to the Open CASCADE Technology Public | |

7 | -- License Version 6.5 (the "License"). You may not use the content of this file | |

8 | -- except in compliance with the License. Please obtain a copy of the License | |

9 | -- at http://www.opencascade.org and read it completely before using this file. | |

10 | -- | |

11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its | |

12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. | |

13 | -- | |

14 | -- The Original Code and all software distributed under the License is | |

15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the | |

16 | -- Initial Developer hereby disclaims all such warranties, including without | |

17 | -- limitation, any warranties of merchantability, fitness for a particular | |

18 | -- purpose or non-infringement. Please see the License for the specific terms | |

19 | -- and conditions governing the rights and limitations under the License. | |

20 | ||

7fd59977 | 21 | |

22 | ||

23 | class Cone from BRepPrim inherits Revolution from BRepPrim | |

24 | ||

25 | ---Purpose: Implement the cone primitive. | |

26 | ||

27 | uses | |

28 | Face from TopoDS, | |

29 | ||

30 | Pnt from gp, | |

31 | Ax2 from gp | |

32 | ||

33 | raises | |

34 | DomainError | |

35 | ||

36 | is | |

37 | ||

38 | Create(Angle : Real; Position : Ax2 from gp; Height : Real; | |

39 | Radius : Real = 0) | |

40 | returns Cone from BRepPrim | |

41 | ---Purpose: the STEP definition | |

42 | -- Angle = semi-angle of the cone | |

43 | -- Position : the coordinate system | |

44 | -- Height : height of the cone. | |

45 | -- Radius : radius of truncated face at z = 0 | |

46 | -- | |

47 | -- The apex is on z < 0 | |

48 | -- | |

49 | -- Errors : Height < Resolution | |

50 | -- Angle < Resolution / Height | |

51 | -- Angle > PI/2 - Resolution / Height | |

52 | raises DomainError; | |

53 | ||

54 | Create(Angle : Real) | |

55 | returns Cone from BRepPrim | |

56 | ---Purpose: infinite cone at origin on Z negative | |

57 | raises DomainError; | |

58 | ||

59 | Create(Angle : Real; Apex : Pnt from gp) | |

60 | returns Cone from BRepPrim | |

61 | ---Purpose: infinite cone at Apex on Z negative | |

62 | raises DomainError; | |

63 | ||

64 | Create(Angle : Real; Axes : Ax2 from gp) | |

65 | returns Cone from BRepPrim | |

66 | ---Purpose: infinite cone with Axes | |

67 | raises DomainError; | |

68 | ||

69 | Create(R1,R2,H : Real) | |

70 | returns Cone from BRepPrim | |

71 | ---Purpose: create a Cone at origin on Z axis, of height H, | |

72 | -- radius R1 at Z = 0, R2 at Z = H, X is the origin | |

73 | -- of angles. If R1 or R2 is 0 there is an apex. | |

74 | -- Otherwise, it is a truncated cone. | |

75 | -- | |

76 | -- Error : R1 and R2 < Resolution | |

77 | -- R1 or R2 negative | |

78 | -- Abs(R1-R2) < Resolution | |

79 | -- H < Resolution | |

80 | -- H negative | |

81 | raises DomainError; | |

82 | ||

83 | Create(Center : Pnt from gp; R1,R2,H : Real) | |

84 | returns Cone from BRepPrim | |

85 | ---Purpose: same as above but at a given point | |

86 | raises DomainError; | |

87 | ||

88 | Create(Axes : Ax2 from gp; R1,R2,H : Real) | |

89 | returns Cone from BRepPrim | |

90 | ---Purpose: same as above with given axes system. | |

91 | raises DomainError; | |

92 | ||

93 | MakeEmptyLateralFace(me) returns Face from TopoDS | |

94 | ---Purpose: The surface normal should be directed towards the | |

95 | -- outside. | |

96 | is redefined; | |

97 | ||

98 | SetMeridian(me : in out) | |

99 | is static private; | |

100 | ||

101 | SetParameters(me : in out; R1, R2, H : Real) | |

102 | is static private; | |

103 | ||

104 | fields | |

105 | myHalfAngle : Real; | |

106 | myRadius : Real; | |

107 | ||

108 | end Cone; |