Back to home page

EIC code displayed by LXR

 
 

    


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