File indexing completed on 2026-09-28 09:20:07
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef GeomBndLib_Line_HeaderFile
0015 #define GeomBndLib_Line_HeaderFile
0016
0017 #include <Bnd_Box.hxx>
0018 #include <GeomBndLib_InfiniteHelpers.pxx>
0019 #include <ElCLib.hxx>
0020 #include <Geom_Line.hxx>
0021 #include <gp_Lin.hxx>
0022 #include <Standard_DefineAlloc.hxx>
0023 #include <Standard_Failure.hxx>
0024
0025
0026
0027
0028
0029
0030 class GeomBndLib_Line
0031 {
0032 public:
0033 DEFINE_STANDARD_ALLOC
0034
0035 GeomBndLib_Line(const occ::handle<Geom_Line>& theLine)
0036 : myGeom(theLine)
0037 {
0038 }
0039
0040 GeomBndLib_Line(const GeomBndLib_Line&) = delete;
0041 GeomBndLib_Line& operator=(const GeomBndLib_Line&) = delete;
0042 GeomBndLib_Line(GeomBndLib_Line&&) = delete;
0043 GeomBndLib_Line& operator=(GeomBndLib_Line&&) = delete;
0044
0045 const occ::handle<Geom_Line>& Geometry() const { return myGeom; }
0046
0047
0048 [[nodiscard]] Bnd_Box Box(double theU1, double theU2, double theTol) const
0049 {
0050 return Box(myGeom->Lin(), theU1, theU2, theTol);
0051 }
0052
0053
0054 [[nodiscard]] Bnd_Box Box(double theTol) const
0055 {
0056 return Box(myGeom->FirstParameter(), myGeom->LastParameter(), theTol);
0057 }
0058
0059
0060 [[nodiscard]] Bnd_Box BoxOptimal(double theU1, double theU2, double theTol) const
0061 {
0062 return Box(theU1, theU2, theTol);
0063 }
0064
0065
0066 [[nodiscard]] static Bnd_Box Box(const gp_Lin& theLin, double theU1, double theU2, double theTol)
0067 {
0068 Bnd_Box aBox;
0069 if (Precision::IsNegativeInfinite(theU1))
0070 {
0071 if (Precision::IsNegativeInfinite(theU2))
0072 {
0073 throw Standard_Failure("GeomBndLib_Line::Box - bad parameter");
0074 }
0075 else if (Precision::IsPositiveInfinite(theU2))
0076 {
0077 GeomBndLib_InfiniteHelpers::OpenMinMax(theLin.Direction(), aBox);
0078 aBox.Add(ElCLib::Value(0., theLin));
0079 }
0080 else
0081 {
0082 GeomBndLib_InfiniteHelpers::OpenMin(theLin.Direction(), aBox);
0083 aBox.Add(ElCLib::Value(theU2, theLin));
0084 }
0085 }
0086 else if (Precision::IsPositiveInfinite(theU1))
0087 {
0088 if (Precision::IsNegativeInfinite(theU2))
0089 {
0090 GeomBndLib_InfiniteHelpers::OpenMinMax(theLin.Direction(), aBox);
0091 aBox.Add(ElCLib::Value(0., theLin));
0092 }
0093 else if (Precision::IsPositiveInfinite(theU2))
0094 {
0095 throw Standard_Failure("GeomBndLib_Line::Box - bad parameter");
0096 }
0097 else
0098 {
0099 GeomBndLib_InfiniteHelpers::OpenMax(theLin.Direction(), aBox);
0100 aBox.Add(ElCLib::Value(theU2, theLin));
0101 }
0102 }
0103 else
0104 {
0105 aBox.Add(ElCLib::Value(theU1, theLin));
0106 if (Precision::IsNegativeInfinite(theU2))
0107 {
0108 GeomBndLib_InfiniteHelpers::OpenMin(theLin.Direction(), aBox);
0109 }
0110 else if (Precision::IsPositiveInfinite(theU2))
0111 {
0112 GeomBndLib_InfiniteHelpers::OpenMax(theLin.Direction(), aBox);
0113 }
0114 else
0115 {
0116 aBox.Add(ElCLib::Value(theU2, theLin));
0117 }
0118 }
0119 aBox.Enlarge(theTol);
0120 return aBox;
0121 }
0122
0123 private:
0124 occ::handle<Geom_Line> myGeom;
0125 };
0126
0127 #endif