Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:38

0001 // Created on: 2007-11-24
0002 // Created by: Alexander GRIGORIEV
0003 // Copyright (c) 2007-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef Poly_CoherentTriangle_HeaderFile
0017 #define Poly_CoherentTriangle_HeaderFile
0018 
0019 #include <Standard_TypeDef.hxx>
0020 
0021 class Poly_CoherentLink;
0022 
0023 /**
0024  * Data class used in Poly_CoherentTriangultion.
0025  * Implements a triangle with references to its neighbours.
0026  */
0027 
0028 class Poly_CoherentTriangle 
0029 {
0030  public:
0031   // ---------- PUBLIC METHODS ----------
0032 
0033   /**
0034    * Empty constructor.
0035    */
0036   Standard_EXPORT Poly_CoherentTriangle    ();
0037 
0038   /**
0039    * Constructor.
0040    */
0041   Standard_EXPORT Poly_CoherentTriangle    (const Standard_Integer iNode0,
0042                                             const Standard_Integer iNode1,
0043                                             const Standard_Integer iNode2);
0044 
0045   /**
0046    * Query the node index in the position given by the parameter 'ind'
0047    */
0048   inline Standard_Integer  Node            (const Standard_Integer ind) const
0049   { return myNodes[ind]; }
0050 
0051 //   /**
0052 //    * Set the Node at the given position 'ind'.
0053 //    */ 
0054 //   inline void              SetNode         (const Standard_Integer ind,
0055 //                                             const Standard_Integer iNode)
0056 //   { myNodes[ind] = iNode; }
0057 
0058   /**
0059    * Query if this is a valid triangle.
0060    */
0061   inline Standard_Boolean  IsEmpty         () const
0062   { return myNodes[0] < 0 || myNodes[1] < 0 || myNodes[2] < 0; }
0063 
0064   /**
0065    * Create connection with another triangle theTri.
0066    * This method creates both connections: in this triangle and in theTri. You
0067    * do not need to call the same method on triangle theTr.
0068    * @param iConn
0069    *   Can be 0, 1 or 2 - index of the node that is opposite to the connection
0070    *   (shared link).
0071    * @param theTr
0072    *   Triangle that is connected on the given link.
0073    * @return
0074    *   True if successful, False if the connection is rejected
0075    *   due to improper topology.
0076    */
0077   Standard_EXPORT Standard_Boolean
0078                            SetConnection   (const Standard_Integer  iConn,
0079                                             Poly_CoherentTriangle&  theTr);
0080   
0081   /**
0082    * Create connection with another triangle theTri.
0083    * This method creates both connections: in this triangle and in theTri.
0084    * This method is slower than the previous one, because it makes analysis
0085    * what sides of both triangles are connected.
0086    * @param theTri
0087    *   Triangle that is connected.
0088    * @return
0089    *   True if successful, False if the connection is rejected
0090    *   due to improper topology.
0091    */
0092   Standard_EXPORT Standard_Boolean
0093                            SetConnection   (Poly_CoherentTriangle& theTri);
0094 
0095   /**
0096    * Remove the connection with the given index.
0097    * @param iConn
0098    *   Can be 0, 1 or 2 - index of the node that is opposite to the connection
0099    *   (shared link).
0100    */
0101   Standard_EXPORT void     RemoveConnection(const Standard_Integer iConn);
0102 
0103   /**
0104    * Remove the connection with the given Triangle.
0105    * @return
0106    *  True if successfuol or False if the connection has not been found.
0107    */
0108   Standard_EXPORT Standard_Boolean
0109                            RemoveConnection(Poly_CoherentTriangle& theTri);
0110 
0111   /**
0112    * Query the number of connected triangles.
0113    */
0114   inline Standard_Integer  NConnections    () const
0115   { return myNConnections; }
0116 
0117   /**
0118    * Query the connected node on the given side.
0119    * Returns -1 if there is no connection on the specified side.
0120    */
0121   inline Standard_Integer  GetConnectedNode(const Standard_Integer iConn) const
0122   { return myNodesOnConnected[iConn]; }
0123 
0124   /**
0125    * Query the connected triangle on the given side.
0126    * Returns NULL if there is no connection on the specified side.
0127    */
0128   inline const Poly_CoherentTriangle *
0129                            GetConnectedTri (const Standard_Integer iConn) const
0130   { return mypConnected[iConn]; }
0131 
0132   /**
0133    * Query the Link associate with the given side of the Triangle.
0134    * May return NULL if there are no links in the triangulation.
0135    */
0136   inline const Poly_CoherentLink *
0137                            GetLink         (const Standard_Integer iLink) const
0138   { return mypLink[iLink]; }
0139 
0140   /**
0141    * Returns the index of the connection with the given triangle, or -1 if not found.
0142    */
0143   Standard_EXPORT Standard_Integer
0144                            FindConnection  (const Poly_CoherentTriangle&) const;
0145 
0146  protected:
0147   // ---------- PROTECTED METHODS ----------
0148 
0149 
0150 
0151  private:
0152   // ---------- PRIVATE FIELDS ----------
0153 
0154   Standard_Integer              myNConnections;
0155   Standard_Integer              myNodes[3];
0156   Standard_Integer              myNodesOnConnected[3];
0157   const Poly_CoherentTriangle * mypConnected[3];
0158   const Poly_CoherentLink     * mypLink[3];
0159 
0160   friend class Poly_CoherentTriangulation;
0161 };
0162 
0163 
0164 #endif