/usr/include/opencascade/gp_Mat2d.lxx is in libopencascade-foundation-dev 6.5.0.dfsg-2build1.
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 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | //File gp_Mat2d.lxx, JCV 04/12/90
#include <gp.hxx>
#include <Standard_OutOfRange.hxx>
#define Mat2d00 ((Standard_Real*)M)[0]
#define Mat2d01 ((Standard_Real*)M)[1]
#define Mat2d10 ((Standard_Real*)M)[2]
#define Mat2d11 ((Standard_Real*)M)[3]
#define Nat2d00 ((Standard_Real*)N)[0]
#define Nat2d01 ((Standard_Real*)N)[1]
#define Nat2d10 ((Standard_Real*)N)[2]
#define Nat2d11 ((Standard_Real*)N)[3]
#define Oat2d00 ((Standard_Real*)O)[0]
#define Oat2d01 ((Standard_Real*)O)[1]
#define Oat2d10 ((Standard_Real*)O)[2]
#define Oat2d11 ((Standard_Real*)O)[3]
inline gp_Mat2d::gp_Mat2d ()
{
const Standard_Address M = (Standard_Address)&(matrix[0][0]);
Mat2d00 = Mat2d01 = Mat2d10 = Mat2d11 = 0.0;
}
inline void gp_Mat2d::SetDiagonal (const Standard_Real X1,
const Standard_Real X2)
{
const Standard_Address M = (Standard_Address)&(matrix[0][0]);
Mat2d00 = X1; Mat2d11 = X2;
}
inline void gp_Mat2d::SetIdentity ()
{
const Standard_Address M = (Standard_Address)&(matrix[0][0]);
Mat2d00 = Mat2d11 = 1.0;
Mat2d01 = Mat2d10 = 0.0;
}
inline void gp_Mat2d::SetRotation (const Standard_Real Ang)
{
const Standard_Address M = (Standard_Address)&(matrix[0][0]);
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)
{
const Standard_Address M = (Standard_Address)&(matrix[0][0]);
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
{
const Standard_Address M = (Standard_Address)&(matrix[0][0]);
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)
{
const Standard_Address M = (Standard_Address)&( matrix[0][0]);
const Standard_Address O = (Standard_Address)&(Other.matrix[0][0]);
Mat2d00 += Oat2d00;
Mat2d01 += Oat2d01;
Mat2d10 += Oat2d10;
Mat2d11 += Oat2d11;
}
inline gp_Mat2d gp_Mat2d::Added (const gp_Mat2d& Other) const
{
gp_Mat2d NewMat2d;
const Standard_Address M = (Standard_Address)&( matrix[0][0]);
const Standard_Address N = (Standard_Address)&(NewMat2d.matrix[0][0]);
const Standard_Address O = (Standard_Address)&(Other .matrix[0][0]);
Nat2d00 = Mat2d00 + Oat2d00;
Nat2d01 = Mat2d01 + Oat2d01;
Nat2d10 = Mat2d10 + Oat2d10;
Nat2d11 = Mat2d11 + Oat2d11;
return NewMat2d;
}
inline void gp_Mat2d::Divide (const Standard_Real Scalar)
{
const Standard_Address M = (Standard_Address)&(matrix[0][0]);
Mat2d00 /= Scalar;
Mat2d01 /= Scalar;
Mat2d10 /= Scalar;
Mat2d11 /= Scalar;
}
inline gp_Mat2d gp_Mat2d::Divided (const Standard_Real Scalar) const
{
gp_Mat2d NewMat2d;
const Standard_Address M = (Standard_Address)&( matrix[0][0]);
const Standard_Address N = (Standard_Address)&(NewMat2d.matrix[0][0]);
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;
const Standard_Address M = (Standard_Address)&( matrix[0][0]);
const Standard_Address O = (Standard_Address)&(Other.matrix[0][0]);
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;
const Standard_Address M = (Standard_Address)&( matrix[0][0]);
const Standard_Address O = (Standard_Address)&(Other.matrix[0][0]);
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;
const Standard_Address M = (Standard_Address)&( matrix[0][0]);
const Standard_Address N = (Standard_Address)&(NewMat2d.matrix[0][0]);
Nat2d00 = Mat2d00 * Scalar;
Nat2d01 = Mat2d01 * Scalar;
Nat2d10 = Mat2d10 * Scalar;
Nat2d11 = Mat2d11 * Scalar;
return NewMat2d;
}
inline void gp_Mat2d::Multiply (const Standard_Real Scalar)
{
const Standard_Address M = (Standard_Address)&(matrix[0][0]);
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)
{
const Standard_Address M = (Standard_Address)&( matrix[0][0]);
const Standard_Address O = (Standard_Address)&(Other.matrix[0][0]);
Mat2d00 -= Oat2d00;
Mat2d01 -= Oat2d01;
Mat2d10 -= Oat2d10;
Mat2d11 -= Oat2d11;
}
inline gp_Mat2d gp_Mat2d::Subtracted (const gp_Mat2d& Other) const
{
gp_Mat2d NewMat2d;
const Standard_Address M = (Standard_Address)&( matrix[0][0]);
const Standard_Address N = (Standard_Address)&(NewMat2d.matrix[0][0]);
const Standard_Address O = (Standard_Address)&(Other .matrix[0][0]);
Nat2d00 = Mat2d00 - Oat2d00;
Nat2d01 = Mat2d01 - Oat2d01;
Nat2d10 = Mat2d10 - Oat2d10;
Nat2d11 = Mat2d11 - Oat2d11;
return NewMat2d;
}
inline void gp_Mat2d::Transpose ()
{
const Standard_Address M = (Standard_Address)&(matrix[0][0]);
Standard_Real Temp;
Temp = Mat2d01;
Mat2d01 = Mat2d10;
Mat2d10 = Temp;
}
inline gp_Mat2d gp_Mat2d::Transposed () const
{
gp_Mat2d NewMat2d;
const Standard_Address M = (Standard_Address)&( matrix[0][0]);
const Standard_Address N = (Standard_Address)&(NewMat2d.matrix[0][0]);
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); }
|