0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / Poly / Poly_CoherentLink.cxx
1 // Created on: 2008-01-03
2 // Created by: Alexander GRIGORIEV
3 // Copyright (c) 2008-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #include <Poly_CoherentLink.hxx>
17 #include <Poly_CoherentTriangle.hxx>
18 #include <Standard_ProgramError.hxx>
19
20 //=======================================================================
21 //function : Poly_CoherentLink()
22 //purpose  : Empty Constructor
23 //=======================================================================
24
25 Poly_CoherentLink::Poly_CoherentLink ()
26   : myAttribute (0L)
27 {
28   myNode[0] = -1;
29   myNode[1] = -1;
30   myOppositeNode[0] = -1;
31   myOppositeNode[1] = -1;
32 }
33
34 //=======================================================================
35 //function : Poly_CoherentLink()
36 //purpose  : Constructor
37 //=======================================================================
38
39 Poly_CoherentLink::Poly_CoherentLink (const Poly_CoherentTriangle& theTri,
40                                       Standard_Integer             iSide)
41   : myAttribute (0L)
42 {
43   static const Standard_Integer ind[] = { 1, 2, 0, 1 };
44   Standard_ProgramError_Raise_if(iSide < 0 || iSide > 2,
45                                  "Poly_CoherentLink::Poly_CoherentLink: "
46                                  "Wrong iSide parameter");
47   const Standard_Integer aNodeInd[2] = {
48     theTri.Node(ind[iSide+0]),
49     theTri.Node(ind[iSide+1])
50   };
51   if (aNodeInd[0] < aNodeInd[1]) {
52     myNode[0] = aNodeInd[0];
53     myNode[1] = aNodeInd[1];
54     myOppositeNode[0] = theTri.Node(iSide);
55     myOppositeNode[1] = theTri.GetConnectedNode(iSide);
56   } else {
57     myNode[0] = aNodeInd[1];
58     myNode[1] = aNodeInd[0];
59     myOppositeNode[0] = theTri.GetConnectedNode(iSide);
60     myOppositeNode[1] = theTri.Node(iSide);
61   }
62 }