0023022: This is desirable to access OpenGl extensions and core API (1.2+) in one...
[occt.git] / src / Poly / Poly_CoherentLink.cxx
CommitLineData
7fd59977 1// File: Poly_CoherentLink.cxx
2// Created: 03.01.08 09:27
3// Author: Alexander GRIGORIEV
4// Copyright: Open Cascade 2008
5
6
7#include <Poly_CoherentLink.hxx>
8#include <Poly_CoherentTriangle.hxx>
9#include <Standard_ProgramError.hxx>
10
11//=======================================================================
12//function : Poly_CoherentLink()
13//purpose : Empty Constructor
14//=======================================================================
15
16Poly_CoherentLink::Poly_CoherentLink ()
17 : myAttribute (0L)
18{
19 myNode[0] = -1;
20 myNode[1] = -1;
21 myOppositeNode[0] = -1;
22 myOppositeNode[1] = -1;
23}
24
25//=======================================================================
26//function : Poly_CoherentLink()
27//purpose : Constructor
28//=======================================================================
29
30Poly_CoherentLink::Poly_CoherentLink (const Poly_CoherentTriangle& theTri,
31 Standard_Integer iSide)
32 : myAttribute (0L)
33{
34 static const Standard_Integer ind[] = { 1, 2, 0, 1 };
35 Standard_ProgramError_Raise_if(iSide < 0 || iSide > 2,
36 "Poly_CoherentLink::Poly_CoherentLink: "
37 "Wrong iSide parameter");
38 const Standard_Integer aNodeInd[2] = {
39 theTri.Node(ind[iSide+0]),
40 theTri.Node(ind[iSide+1])
41 };
42 if (aNodeInd[0] < aNodeInd[1]) {
43 myNode[0] = aNodeInd[0];
44 myNode[1] = aNodeInd[1];
45 myOppositeNode[0] = theTri.Node(iSide);
46 myOppositeNode[1] = theTri.GetConnectedNode(iSide);
47 } else {
48 myNode[0] = aNodeInd[1];
49 myNode[1] = aNodeInd[0];
50 myOppositeNode[0] = theTri.GetConnectedNode(iSide);
51 myOppositeNode[1] = theTri.Node(iSide);
52 }
53}