File indexing completed on 2026-11-29 10:54:52
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef _Poly_Triangle_HeaderFile
0018 #define _Poly_Triangle_HeaderFile
0019
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 #include <Standard_Integer.hxx>
0024 #include <Standard_OutOfRange.hxx>
0025
0026
0027
0028
0029
0030 class Poly_Triangle
0031 {
0032 public:
0033 DEFINE_STANDARD_ALLOC
0034
0035
0036 Poly_Triangle() { myNodes[0] = myNodes[1] = myNodes[2] = 0; }
0037
0038
0039
0040
0041 Poly_Triangle(const int theN1, const int theN2, const int theN3)
0042 {
0043 myNodes[0] = theN1;
0044 myNodes[1] = theN2;
0045 myNodes[2] = theN3;
0046 }
0047
0048
0049 void Set(const int theN1, const int theN2, const int theN3)
0050 {
0051 myNodes[0] = theN1;
0052 myNodes[1] = theN2;
0053 myNodes[2] = theN3;
0054 }
0055
0056
0057
0058 void Set(const int theIndex, const int theNode)
0059 {
0060 Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > 3,
0061 "Poly_Triangle::Set(), invalid index");
0062 myNodes[theIndex - 1] = theNode;
0063 }
0064
0065
0066 void Get(int& theN1, int& theN2, int& theN3) const
0067 {
0068 theN1 = myNodes[0];
0069 theN2 = myNodes[1];
0070 theN3 = myNodes[2];
0071 }
0072
0073
0074
0075 int Value(const int theIndex) const
0076 {
0077 Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > 3,
0078 "Poly_Triangle::Value(), invalid index");
0079 return myNodes[theIndex - 1];
0080 }
0081
0082 int operator()(const int Index) const { return Value(Index); }
0083
0084
0085
0086 int& ChangeValue(const int theIndex)
0087 {
0088 Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > 3,
0089 "Poly_Triangle::ChangeValue(), invalid index");
0090 return myNodes[theIndex - 1];
0091 }
0092
0093 int& operator()(const int Index) { return ChangeValue(Index); }
0094
0095 protected:
0096 int myNodes[3];
0097 };
0098
0099 #endif