Warning, /include/opencascade/IntTools_EdgeEdge.lxx is written in an unsupported language. File is not indexed.
0001 // Created by: Eugeny MALTCHIKOV
0002 // Copyright (c) 2013-2014 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014
0015 #include <Precision.hxx>
0016 #include <BRep_Tool.hxx>
0017
0018 //=================================================================================================
0019
0020 inline IntTools_EdgeEdge::IntTools_EdgeEdge()
0021 : myTol1(0.),
0022 myTol2(0.),
0023 myTol(0.),
0024 myFuzzyValue(Precision::Confusion()),
0025 myRes1(0.),
0026 myRes2(0.),
0027 myResCoeff1(0.),
0028 myResCoeff2(0.),
0029 myPTol1(0.),
0030 myPTol2(0.),
0031 myRange1(0., 0.),
0032 myRange2(0., 0.),
0033 mySwap(false),
0034 myErrorStatus(0),
0035 myQuickCoincidenceCheck(false)
0036 {
0037 }
0038
0039 //=================================================================================================
0040
0041 inline IntTools_EdgeEdge::IntTools_EdgeEdge(const TopoDS_Edge& theEdge1,
0042 const TopoDS_Edge& theEdge2)
0043 : myEdge1(theEdge1),
0044 myEdge2(theEdge2),
0045 myTol1(0.),
0046 myTol2(0.),
0047 myTol(0.),
0048 myFuzzyValue(Precision::Confusion()),
0049 myRes1(0.),
0050 myRes2(0.),
0051 myResCoeff1(0.),
0052 myResCoeff2(0.),
0053 myPTol1(0.),
0054 myPTol2(0.),
0055 myRange1(0., 0.),
0056 myRange2(0., 0.),
0057 mySwap(false),
0058 myErrorStatus(0),
0059 myQuickCoincidenceCheck(false)
0060 {
0061 }
0062
0063 //=================================================================================================
0064
0065 inline IntTools_EdgeEdge::IntTools_EdgeEdge(const TopoDS_Edge& theEdge1,
0066 const double aT11,
0067 const double aT12,
0068 const TopoDS_Edge& theEdge2,
0069 const double aT21,
0070 const double aT22)
0071 : myEdge1(theEdge1),
0072 myEdge2(theEdge2),
0073 myTol1(0.),
0074 myTol2(0.),
0075 myTol(0.),
0076 myFuzzyValue(Precision::Confusion()),
0077 myRes1(0.),
0078 myRes2(0.),
0079 myResCoeff1(0.),
0080 myResCoeff2(0.),
0081 myPTol1(0.),
0082 myPTol2(0.),
0083 myRange1(aT11, aT12),
0084 myRange2(aT21, aT22),
0085 mySwap(false),
0086 myErrorStatus(0),
0087 myQuickCoincidenceCheck(false)
0088 {
0089 }
0090
0091 //=================================================================================================
0092
0093 inline IntTools_EdgeEdge::~IntTools_EdgeEdge() = default;
0094
0095 //=================================================================================================
0096
0097 inline void IntTools_EdgeEdge::SetEdge1(const TopoDS_Edge& theEdge)
0098 {
0099 myEdge1 = theEdge;
0100 }
0101
0102 //=================================================================================================
0103
0104 inline void IntTools_EdgeEdge::SetRange1(const IntTools_Range& theRange)
0105 {
0106 myRange1 = theRange;
0107 }
0108
0109 //=================================================================================================
0110
0111 inline void IntTools_EdgeEdge::SetRange1(const double aT1, const double aT2)
0112 {
0113 myRange1.SetFirst(aT1);
0114 myRange1.SetLast(aT2);
0115 }
0116
0117 //=================================================================================================
0118
0119 inline void IntTools_EdgeEdge::SetEdge1(const TopoDS_Edge& theEdge,
0120 const double aT1,
0121 const double aT2)
0122 {
0123 SetEdge1(theEdge);
0124 SetRange1(aT1, aT2);
0125 }
0126
0127 //=================================================================================================
0128
0129 inline void IntTools_EdgeEdge::SetEdge2(const TopoDS_Edge& theEdge)
0130 {
0131 myEdge2 = theEdge;
0132 }
0133
0134 //=================================================================================================
0135
0136 inline void IntTools_EdgeEdge::SetRange2(const IntTools_Range& theRange)
0137 {
0138 myRange2 = theRange;
0139 }
0140
0141 //=================================================================================================
0142
0143 inline void IntTools_EdgeEdge::SetRange2(const double aT1, const double aT2)
0144 {
0145 myRange2.SetFirst(aT1);
0146 myRange2.SetLast(aT2);
0147 }
0148
0149 //=================================================================================================
0150
0151 inline void IntTools_EdgeEdge::SetEdge2(const TopoDS_Edge& theEdge,
0152 const double aT1,
0153 const double aT2)
0154 {
0155 SetEdge2(theEdge);
0156 SetRange2(aT1, aT2);
0157 }
0158
0159 //=================================================================================================
0160
0161 inline void IntTools_EdgeEdge::SetFuzzyValue(const double theFuzz)
0162 {
0163 myFuzzyValue = std::max(theFuzz, Precision::Confusion());
0164 }
0165
0166 //=================================================================================================
0167
0168 inline double IntTools_EdgeEdge::FuzzyValue() const
0169 {
0170 return myFuzzyValue;
0171 }
0172
0173 //=================================================================================================
0174
0175 inline const NCollection_Sequence<IntTools_CommonPrt>& IntTools_EdgeEdge::CommonParts() const
0176 {
0177 return myCommonParts;
0178 }
0179
0180 //=================================================================================================
0181
0182 inline bool IntTools_EdgeEdge::IsDone() const
0183 {
0184 return (myErrorStatus == 0);
0185 }
0186
0187 //=================================================================================================
0188
0189 inline void IntTools_EdgeEdge::CheckData()
0190 {
0191 if (myEdge1.IsNull() || myEdge2.IsNull())
0192 {
0193 myErrorStatus = 1;
0194 return;
0195 }
0196 //
0197 if (BRep_Tool::Degenerated(myEdge1) || BRep_Tool::Degenerated(myEdge2))
0198 {
0199 myErrorStatus = 2;
0200 return;
0201 }
0202 //
0203 if (!BRep_Tool::IsGeometric(myEdge1) || !BRep_Tool::IsGeometric(myEdge2))
0204 {
0205 myErrorStatus = 3;
0206 return;
0207 }
0208 }