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

b311480e | 1 | -- Created on: 1993-07-22 |

2 | -- Created by: Isabelle GRIGNON | |

3 | -- Copyright (c) 1993-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 | package BRepBndLib | |

24 | ||

25 | ---Purpose: This package provides the bounding boxes for curves | |

26 | -- and surfaces from BRepAdaptor. | |

27 | -- Functions to add a topological shape to a bounding box | |

28 | uses BRepAdaptor, | |

29 | Bnd, | |

30 | TopoDS, | |

31 | Geom, | |

32 | GeomAbs, | |

33 | TColgp, | |

34 | gp | |

35 | ||

36 | is | |

37 | ||

38 | -- | |

39 | -- Package methods for shapes | |

40 | -- | |

41 | ||

3c34883c O |
42 | Add(S : Shape from TopoDS; |

43 | B : in out Box from Bnd; | |

44 | useTriangulation: Boolean from Standard = Standard_True); | |

7fd59977 | 45 | ---Purpose:Adds the shape S to the bounding box B. |

46 | -- More precisely are successively added to B: | |

47 | -- - each face of S; the triangulation of the face is used if it exists, | |

48 | -- - then each edge of S which does not belong to a face, | |

49 | -- the polygon of the edge is used if it exists | |

50 | -- - and last each vertex of S which does not belong to an edge. | |

51 | -- After each elementary operation, the bounding box B is | |

52 | -- enlarged by the tolerance value of the relative sub-shape. | |

53 | -- When working with the triangulation of a face this value of | |

54 | -- enlargement is the sum of the triangulation deflection and | |

55 | -- the face tolerance. When working with the | |

56 | -- polygon of an edge this value of enlargement is | |

57 | -- the sum of the polygon deflection and the edge tolerance. | |

58 | -- Warning | |

59 | -- - This algorithm is time consuming if triangulation has not | |

60 | -- been inserted inside the data structure of the shape S. | |

61 | -- - The resulting bounding box may be somewhat larger than the object. | |

62 | ||

63 | ||

64 | AddClose(S : Shape from TopoDS; B : in out Box from Bnd); | |

65 | ---Purpose: Adds the shape S to the bounding box B. | |

66 | -- This is a quick algorithm but only works if the shape S is | |

67 | -- composed of polygonal planar faces, as is the case if S is | |

68 | -- an approached polyhedral representation of an exact | |

69 | -- shape. Pay particular attention to this because this | |

70 | -- condition is not checked and, if it not respected, an error | |

71 | -- may occur in the algorithm for which the bounding box is built. | |

72 | -- Note that the resulting bounding box is not enlarged by the | |

73 | -- tolerance value of the sub-shapes as is the case with the | |

74 | -- Add function. So the added part of the resulting bounding | |

75 | -- box is closer to the shape S. | |

76 | ||

77 | ||

78 | end BRepBndLib; | |

79 | ||

80 | ||

81 | ||

82 |