Warning, /include/opencascade/IntPatch_PrmPrmIntersection.lxx is written in an unsupported language. File is not indexed.
0001 // Copyright (c) 1995-1999 Matra Datavision
0002 // Copyright (c) 1999-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 <StdFail_NotDone.hxx>
0016 #include <IntPatch_Line.hxx>
0017
0018
0019
0020 #define _DECAL 7
0021 #define _DECAL2 14
0022 #define _BASE 128
0023 #define _BASEM1 127
0024
0025
0026 //======================================================================
0027 inline Standard_Integer IntPatch_PrmPrmIntersection::NbLines() const {
0028 if(!done)
0029 throw StdFail_NotDone(" IntPatch_PrmPrmIntersection ");
0030 return(SLin.Length());
0031 }
0032
0033 //======================================================================
0034 inline const Handle(IntPatch_Line)& IntPatch_PrmPrmIntersection::Line
0035 (const Standard_Integer n) const {
0036 if(!done)
0037 throw StdFail_NotDone(" IntPatch_PrmPrmIntersection ");
0038 return(SLin.Value(n));
0039 }
0040
0041 //======================================================================
0042 inline Standard_Boolean IntPatch_PrmPrmIntersection::IsEmpty() const {
0043 if(!done)
0044 throw StdFail_NotDone(" IntPatch_PrmPrmIntersection ");
0045 return(empt);
0046 }
0047
0048 //======================================================================
0049 inline Standard_Boolean IntPatch_PrmPrmIntersection::IsDone() const {
0050 return(done);
0051 }
0052
0053 inline Standard_Integer IntPatch_PrmPrmIntersection::GrilleInteger(const Standard_Integer ix,
0054 const Standard_Integer iy,
0055 const Standard_Integer iz) const
0056 {
0057 Standard_Integer tz = iz<<_DECAL2;
0058 Standard_Integer ty = iy<<_DECAL;
0059 Standard_Integer t = ix;
0060 t|=ty;
0061 t|=tz;
0062 return(t);
0063 }
0064
0065 inline void IntPatch_PrmPrmIntersection::IntegerGrille(const Standard_Integer tt,
0066 Standard_Integer &ix,
0067 Standard_Integer &iy,
0068 Standard_Integer &iz) const
0069 {
0070 Standard_Integer t = tt;
0071 ix = t & _BASEM1;
0072 t>>=_DECAL;
0073 iy = t & _BASEM1;
0074 t>>=_DECAL;
0075 iz = t;
0076 }
0077
0078 inline Standard_Integer IntPatch_PrmPrmIntersection::DansGrille(const Standard_Integer t) const
0079 {
0080 if(t>=0) {
0081 if(t<_BASE){
0082 return(1);
0083 }
0084 }
0085 return(0);
0086 }
0087
0088 inline Standard_Integer IntPatch_PrmPrmIntersection::NbPointsGrille() const
0089 { return(_BASE); }
0090
0091
0092 inline Standard_Integer IntPatch_PrmPrmIntersection::CodeReject(const Standard_Real x0,
0093 const Standard_Real y0,
0094 const Standard_Real z0,
0095 const Standard_Real x1,
0096 const Standard_Real y1,
0097 const Standard_Real z1,
0098 const Standard_Real x,
0099 const Standard_Real y,
0100 const Standard_Real z) const
0101 {
0102 int code = 0;
0103 if(x<x0) code =1;
0104 if(y<y0) code|=2;
0105 if(z<z0) code|=4;
0106 if(x>x1) code|=8;
0107 if(y>y1) code|=16;
0108 if(z>z1) code|=32;
0109 return(code);
0110 }