Loading files
// Created on: 2007-11-24
// Created by: Alexander GRIGORIEV
// Copyright (c) 2007-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef Poly_CoherentTriangle_HeaderFile
#define Poly_CoherentTriangle_HeaderFile
#include <Standard_TypeDef.hxx>
class Poly_CoherentLink;
/**
* Data class used in Poly_CoherentTriangultion.
* Implements a triangle with references to its neighbours.
*/
class Poly_CoherentTriangle
{
public:
// ---------- PUBLIC METHODS ----------
/**
* Empty constructor.
*/
Standard_EXPORT Poly_CoherentTriangle();
/**
* Constructor.
*/
Standard_EXPORT Poly_CoherentTriangle(const int iNode0, const int iNode1, const int iNode2);
/**
* Query the node index in the position given by the parameter 'ind'
*/
inline int Node(const int ind) const { return myNodes[ind]; }
// /**
// * Set the Node at the given position 'ind'.
// */
// inline void SetNode (const int ind,
// const int iNode)
// { myNodes[ind] = iNode; }
/**
* Query if this is a valid triangle.
*/
inline bool IsEmpty() const noexcept
{
return myNodes[0] < 0 || myNodes[1] < 0 || myNodes[2] < 0;
}
/**
* Create connection with another triangle theTri.
* This method creates both connections: in this triangle and in theTri. You
* do not need to call the same method on triangle theTr.
* @param iConn
* Can be 0, 1 or 2 - index of the node that is opposite to the connection
* (shared link).
* @param theTr
* Triangle that is connected on the given link.
* @return
* True if successful, False if the connection is rejected
* due to improper topology.
*/
Standard_EXPORT bool SetConnection(const int iConn, Poly_CoherentTriangle& theTr);
/**
* Create connection with another triangle theTri.
* This method creates both connections: in this triangle and in theTri.
* This method is slower than the previous one, because it makes analysis
* what sides of both triangles are connected.
* @param theTri
* Triangle that is connected.
* @return
* True if successful, False if the connection is rejected
* due to improper topology.
*/
Standard_EXPORT bool SetConnection(Poly_CoherentTriangle& theTri);
/**
* Remove the connection with the given index.
* @param iConn
* Can be 0, 1 or 2 - index of the node that is opposite to the connection
* (shared link).
*/
Standard_EXPORT void RemoveConnection(const int iConn);
/**
* Remove the connection with the given Triangle.
* @return
* True if successfuol or False if the connection has not been found.
*/
Standard_EXPORT bool RemoveConnection(Poly_CoherentTriangle& theTri);
/**
* Query the number of connected triangles.
*/
inline int NConnections() const { return myNConnections; }
/**
* Query the connected node on the given side.
* Returns -1 if there is no connection on the specified side.
*/
inline int GetConnectedNode(const int iConn) const { return myNodesOnConnected[iConn]; }
/**
* Query the connected triangle on the given side.
* Returns NULL if there is no connection on the specified side.
*/
inline const Poly_CoherentTriangle* GetConnectedTri(const int iConn) const
{
return mypConnected[iConn];
}
/**
* Query the Link associate with the given side of the Triangle.
* May return NULL if there are no links in the triangulation.
*/
inline const Poly_CoherentLink* GetLink(const int iLink) const { return mypLink[iLink]; }
/**
* Returns the index of the connection with the given triangle, or -1 if not found.
*/
Standard_EXPORT int FindConnection(const Poly_CoherentTriangle&) const;
private:
// ---------- PRIVATE FIELDS ----------
int myNConnections;
int myNodes[3]{};
int myNodesOnConnected[3]{};
const Poly_CoherentTriangle* mypConnected[3]{};
const Poly_CoherentLink* mypLink[3]{};
friend class Poly_CoherentTriangulation;
};
#endif
f2929057eThis file is pinned to the selected release. Download the original to open it in your design tool.