/usr/include/oce/gp_Mat2d.lxx is in liboce-foundation-dev 0.17.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | // Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-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.
#include <gp.hxx>
#include <Standard_OutOfRange.hxx>
#define Mat2d00 matrix[0][0]
#define Mat2d01 matrix[0][1]
#define Mat2d10 matrix[1][0]
#define Mat2d11 matrix[1][1]
#define Nat2d00 NewMat2d.matrix[0][0]
#define Nat2d01 NewMat2d.matrix[0][1]
#define Nat2d10 NewMat2d.matrix[1][0]
#define Nat2d11 NewMat2d.matrix[1][1]
#define Oat2d00 Other.matrix[0][0]
#define Oat2d01 Other.matrix[0][1]
#define Oat2d10 Other.matrix[1][0]
#define Oat2d11 Other.matrix[1][1]
inline gp_Mat2d::gp_Mat2d ()
{
Mat2d00 = Mat2d01 = Mat2d10 = Mat2d11 = 0.0;
}
inline void gp_Mat2d::SetDiagonal (const Standard_Real X1,
const Standard_Real X2)
{
Mat2d00 = X1; Mat2d11 = X2;
}
inline void gp_Mat2d::SetIdentity ()
{
Mat2d00 = Mat2d11 = 1.0;
Mat2d01 = Mat2d10 = 0.0;
}
inline void gp_Mat2d::SetRotation (const Standard_Real Ang)
{
Standard_Real SinA = sin(Ang);
Standard_Real CosA = cos(Ang);
Mat2d00 = Mat2d11 = CosA;
Mat2d01 = -SinA;
Mat2d10 = SinA;
}
inline void gp_Mat2d::SetScale (const Standard_Real S)
{
Mat2d00 = Mat2d11 = S;
Mat2d01 = Mat2d10 = 0.0;
}
inline void gp_Mat2d::SetValue (const Standard_Integer Row,
const Standard_Integer Col,
const Standard_Real Value)
{
Standard_OutOfRange_Raise_if
(Row < 1 || Row > 2 || Col < 1 || Col > 2, " ");
matrix[Row-1][Col-1] = Value;
}
inline Standard_Real gp_Mat2d::Determinant () const
{
return Mat2d00 * Mat2d11 - Mat2d10 * Mat2d01;
}
inline const Standard_Real& gp_Mat2d::Value (const Standard_Integer Row,
const Standard_Integer Col) const
{
Standard_OutOfRange_Raise_if
(Row < 1 || Row > 2 || Col < 1 || Col > 2, " ");
return matrix[Row-1][Col-1];
}
inline Standard_Real&
gp_Mat2d::ChangeValue (const Standard_Integer Row,
const Standard_Integer Col)
{
Standard_OutOfRange_Raise_if
(Row < 1 || Row > 2 || Col < 1 || Col > 2, " ");
return matrix[Row-1][Col-1];
}
inline Standard_Boolean gp_Mat2d::IsSingular () const
{
Standard_Real det = Determinant();
if (det < 0) det = - det;
return det <= gp::Resolution();
}
inline void gp_Mat2d::Add (const gp_Mat2d& Other)
{
Mat2d00 += Oat2d00;
Mat2d01 += Oat2d01;
Mat2d10 += Oat2d10;
Mat2d11 += Oat2d11;
}
inline gp_Mat2d gp_Mat2d::Added (const gp_Mat2d& Other) const
{
gp_Mat2d NewMat2d;
Nat2d00 = Mat2d00 + Oat2d00;
Nat2d01 = Mat2d01 + Oat2d01;
Nat2d10 = Mat2d10 + Oat2d10;
Nat2d11 = Mat2d11 + Oat2d11;
return NewMat2d;
}
inline void gp_Mat2d::Divide (const Standard_Real Scalar)
{
Mat2d00 /= Scalar;
Mat2d01 /= Scalar;
Mat2d10 /= Scalar;
Mat2d11 /= Scalar;
}
inline gp_Mat2d gp_Mat2d::Divided (const Standard_Real Scalar) const
{
gp_Mat2d NewMat2d;
Nat2d00 = Mat2d00 / Scalar;
Nat2d01 = Mat2d01 / Scalar;
Nat2d10 = Mat2d10 / Scalar;
Nat2d11 = Mat2d11 / Scalar;
return NewMat2d;
}
inline gp_Mat2d gp_Mat2d::Inverted () const
{
gp_Mat2d NewMat = *this;
NewMat.Invert();
return NewMat;
}
inline gp_Mat2d gp_Mat2d::Multiplied (const gp_Mat2d& Other) const
{
gp_Mat2d NewMat2d = *this;
NewMat2d.Multiply(Other);
return NewMat2d;
}
inline void gp_Mat2d::Multiply (const gp_Mat2d& Other)
{
Standard_Real T00,T10;
T00 = Mat2d00 * Oat2d00 + Mat2d01 * Oat2d10;
T10 = Mat2d10 * Oat2d00 + Mat2d11 * Oat2d10;
Mat2d01 = Mat2d00 * Oat2d01 + Mat2d01 * Oat2d11;
Mat2d11 = Mat2d10 * Oat2d01 + Mat2d11 * Oat2d11;
Mat2d00 = T00;
Mat2d10 = T10;
}
inline void gp_Mat2d::PreMultiply (const gp_Mat2d& Other)
{
Standard_Real T00,T01;
T00 = Oat2d00 * Mat2d00 + Oat2d01 * Mat2d10;
Mat2d10 = Oat2d10 * Mat2d00 + Oat2d11 * Mat2d10;
T01 = Oat2d00 * Mat2d01 + Oat2d01 * Mat2d11;
Mat2d11 = Oat2d10 * Mat2d01 + Oat2d11 * Mat2d11;
Mat2d00 = T00;
Mat2d01 = T01;
}
inline gp_Mat2d gp_Mat2d::Multiplied (const Standard_Real Scalar) const
{
gp_Mat2d NewMat2d;
Nat2d00 = Mat2d00 * Scalar;
Nat2d01 = Mat2d01 * Scalar;
Nat2d10 = Mat2d10 * Scalar;
Nat2d11 = Mat2d11 * Scalar;
return NewMat2d;
}
inline void gp_Mat2d::Multiply (const Standard_Real Scalar)
{
Mat2d00 *= Scalar;
Mat2d01 *= Scalar;
Mat2d10 *= Scalar;
Mat2d11 *= Scalar;
}
inline gp_Mat2d gp_Mat2d::Powered (const Standard_Integer N) const
{
gp_Mat2d Mat2dN = *this;
Mat2dN.Power (N);
return Mat2dN;
}
inline void gp_Mat2d::Subtract (const gp_Mat2d& Other)
{
Mat2d00 -= Oat2d00;
Mat2d01 -= Oat2d01;
Mat2d10 -= Oat2d10;
Mat2d11 -= Oat2d11;
}
inline gp_Mat2d gp_Mat2d::Subtracted (const gp_Mat2d& Other) const
{
gp_Mat2d NewMat2d;
Nat2d00 = Mat2d00 - Oat2d00;
Nat2d01 = Mat2d01 - Oat2d01;
Nat2d10 = Mat2d10 - Oat2d10;
Nat2d11 = Mat2d11 - Oat2d11;
return NewMat2d;
}
inline void gp_Mat2d::Transpose ()
{
Standard_Real Temp;
Temp = Mat2d01;
Mat2d01 = Mat2d10;
Mat2d10 = Temp;
}
inline gp_Mat2d gp_Mat2d::Transposed () const
{
gp_Mat2d NewMat2d;
Nat2d10 = Mat2d01;
Nat2d01 = Mat2d10;
Nat2d00 = Mat2d00;
Nat2d11 = Mat2d11;
return NewMat2d;
}
inline gp_Mat2d operator* (const Standard_Real Scalar,
const gp_Mat2d& Mat2D)
{ return Mat2D.Multiplied (Scalar); }
|