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

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

2 | -- Created by: Isabelle GRIGNON | |

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

973c2be1 | 4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |

b311480e | 5 | -- |

973c2be1 | 6 | -- This file is part of Open CASCADE Technology software library. |

b311480e | 7 | -- |

d5f74e42 | 8 | -- This library is free software; you can redistribute it and/or modify it under |

9 | -- the terms of the GNU Lesser General Public License version 2.1 as published | |

973c2be1 | 10 | -- by the Free Software Foundation, with special exception defined in the file |

11 | -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT | |

12 | -- distribution for complete text of the license and disclaimer of any warranty. | |

b311480e | 13 | -- |

973c2be1 | 14 | -- Alternatively, this file may be used under the terms of Open CASCADE |

15 | -- commercial license or contractual agreement. | |

7fd59977 | 16 | |

17 | package BRepBndLib | |

18 | ||

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

20 | -- and surfaces from BRepAdaptor. | |

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

22 | uses BRepAdaptor, | |

23 | Bnd, | |

24 | TopoDS, | |

25 | Geom, | |

26 | GeomAbs, | |

27 | TColgp, | |

28 | gp | |

29 | ||

30 | is | |

31 | ||

32 | -- | |

33 | -- Package methods for shapes | |

34 | -- | |

35 | ||

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

52 | -- Warning | |

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

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

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

56 | ||

57 | ||

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

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

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

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

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

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

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

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

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

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

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

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

70 | ||

71 | ||

72 | end BRepBndLib; | |

73 | ||

74 | ||

75 | ||

76 |