/usr/include/oce/gp_Mat.lxx is in liboce-foundation-dev 0.15-4.
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 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | // 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 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>
#include <Standard_ConstructionError.hxx>
#define Mat00 matrix[0][0]
#define Mat01 matrix[0][1]
#define Mat02 matrix[0][2]
#define Mat10 matrix[1][0]
#define Mat11 matrix[1][1]
#define Mat12 matrix[1][2]
#define Mat20 matrix[2][0]
#define Mat21 matrix[2][1]
#define Mat22 matrix[2][2]
#define Nat00 NewMat.matrix[0][0]
#define Nat01 NewMat.matrix[0][1]
#define Nat02 NewMat.matrix[0][2]
#define Nat10 NewMat.matrix[1][0]
#define Nat11 NewMat.matrix[1][1]
#define Nat12 NewMat.matrix[1][2]
#define Nat20 NewMat.matrix[2][0]
#define Nat21 NewMat.matrix[2][1]
#define Nat22 NewMat.matrix[2][2]
#define Oat00 Other.matrix[0][0]
#define Oat01 Other.matrix[0][1]
#define Oat02 Other.matrix[0][2]
#define Oat10 Other.matrix[1][0]
#define Oat11 Other.matrix[1][1]
#define Oat12 Other.matrix[1][2]
#define Oat20 Other.matrix[2][0]
#define Oat21 Other.matrix[2][1]
#define Oat22 Other.matrix[2][2]
inline gp_Mat::gp_Mat () {
Mat00 =
Mat01 =
Mat02 =
Mat10 =
Mat11 =
Mat12 =
Mat20 =
Mat21 =
Mat22 = 0.0;
}
inline gp_Mat::gp_Mat (const Standard_Real a11,
const Standard_Real a12,
const Standard_Real a13,
const Standard_Real a21,
const Standard_Real a22,
const Standard_Real a23,
const Standard_Real a31,
const Standard_Real a32,
const Standard_Real a33) {
Mat00 = a11;
Mat01 = a12;
Mat02 = a13;
Mat10 = a21;
Mat11 = a22;
Mat12 = a23;
Mat20 = a31;
Mat21 = a32;
Mat22 = a33;
}
inline void gp_Mat::SetDiagonal (const Standard_Real X1,
const Standard_Real X2,
const Standard_Real X3)
{
Mat00 = X1; Mat11 = X2; Mat22 = X3;
}
inline void gp_Mat::SetIdentity ()
{
Mat00 = Mat11 = Mat22 = 1.0;
Mat01 = Mat02 = Mat10 = Mat12 = Mat20 = Mat21 = 0.0;
}
inline void gp_Mat::SetScale (const Standard_Real S)
{
Mat00 = Mat11 = Mat22 = S;
Mat01 = Mat02 = Mat10 = Mat12 = Mat20 = Mat21 = 0.0;
}
inline void gp_Mat::SetValue (const Standard_Integer Row,
const Standard_Integer Col,
const Standard_Real Value)
{
Standard_OutOfRange_Raise_if
(Row < 1 || Row > 3 || Col < 1 || Col > 3, " ");
matrix[Row-1][Col-1] = Value;
}
inline Standard_Real gp_Mat::Determinant () const
{
return
Mat00 * (Mat11 * Mat22 - Mat21 * Mat12) -
Mat01 * (Mat10 * Mat22 - Mat20 * Mat12) +
Mat02 * (Mat10 * Mat21 - Mat20 * Mat11);
}
inline const Standard_Real& gp_Mat::Value (const Standard_Integer Row,
const Standard_Integer Col) const
{
Standard_OutOfRange_Raise_if
(Row < 1 || Row > 3 || Col < 1 || Col > 3, " ");
return matrix[Row-1][Col-1];
}
inline Standard_Real& gp_Mat::ChangeValue (const Standard_Integer Row,
const Standard_Integer Col)
{
Standard_OutOfRange_Raise_if
(Row < 1 || Row > 3 || Col < 1 || Col > 3, " ");
return matrix[Row-1][Col-1];
}
inline Standard_Boolean gp_Mat::IsSingular () const
{
// Pour etre sur que Gauss va fonctionner, il faut faire Gauss ...
Standard_Real val = Determinant();
if (val < 0) val = - val;
return val <= gp::Resolution();
}
inline void gp_Mat::Add (const gp_Mat& Other)
{
Mat00 = Mat00 + Oat00;
Mat01 = Mat01 + Oat01;
Mat02 = Mat02 + Oat02;
Mat10 = Mat10 + Oat10;
Mat11 = Mat11 + Oat11;
Mat12 = Mat12 + Oat12;
Mat20 = Mat20 + Oat20;
Mat21 = Mat21 + Oat21;
Mat22 = Mat22 + Oat22;
}
inline gp_Mat gp_Mat::Added (const gp_Mat& Other) const
{
gp_Mat NewMat;
Nat00 = Mat00 + Oat00;
Nat01 = Mat01 + Oat01;
Nat02 = Mat02 + Oat02;
Nat10 = Mat10 + Oat10;
Nat11 = Mat11 + Oat11;
Nat12 = Mat12 + Oat12;
Nat20 = Mat20 + Oat20;
Nat21 = Mat21 + Oat21;
Nat22 = Mat22 + Oat22;
return NewMat;
}
inline void gp_Mat::Divide (const Standard_Real Scalar)
{
Standard_Real val = Scalar;
if (val < 0) val = - val;
Standard_ConstructionError_Raise_if
(val <= gp::Resolution(),"gp_Mat : Divide by 0");
Standard_Real UnSurScalar = 1.0 / Scalar;
Mat00 *= UnSurScalar;
Mat01 *= UnSurScalar;
Mat02 *= UnSurScalar;
Mat10 *= UnSurScalar;
Mat11 *= UnSurScalar;
Mat12 *= UnSurScalar;
Mat20 *= UnSurScalar;
Mat21 *= UnSurScalar;
Mat22 *= UnSurScalar;
}
inline gp_Mat gp_Mat::Divided (const Standard_Real Scalar) const
{
Standard_Real val = Scalar;
if (val < 0) val = - val;
Standard_ConstructionError_Raise_if
(val <= gp::Resolution(),"gp_Mat : Divide by 0");
gp_Mat NewMat;
Standard_Real UnSurScalar = 1.0 / Scalar;
Nat00 = Mat00 * UnSurScalar;
Nat01 = Mat01 * UnSurScalar;
Nat02 = Mat02 * UnSurScalar;
Nat10 = Mat10 * UnSurScalar;
Nat11 = Mat11 * UnSurScalar;
Nat12 = Mat12 * UnSurScalar;
Nat20 = Mat20 * UnSurScalar;
Nat21 = Mat21 * UnSurScalar;
Nat22 = Mat22 * UnSurScalar;
return NewMat;
}
inline gp_Mat gp_Mat::Multiplied (const gp_Mat& Other) const
{
gp_Mat NewMat = *this;
NewMat.Multiply(Other);
return NewMat;
}
inline void gp_Mat::Multiply (const gp_Mat& Other)
{
Standard_Real T00,T01,T02,T10,T11,T12,T20,T21,T22;
T00 = Mat00 * Oat00 + Mat01 * Oat10 + Mat02 * Oat20;
T01 = Mat00 * Oat01 + Mat01 * Oat11 + Mat02 * Oat21;
T02 = Mat00 * Oat02 + Mat01 * Oat12 + Mat02 * Oat22;
T10 = Mat10 * Oat00 + Mat11 * Oat10 + Mat12 * Oat20;
T11 = Mat10 * Oat01 + Mat11 * Oat11 + Mat12 * Oat21;
T12 = Mat10 * Oat02 + Mat11 * Oat12 + Mat12 * Oat22;
T20 = Mat20 * Oat00 + Mat21 * Oat10 + Mat22 * Oat20;
T21 = Mat20 * Oat01 + Mat21 * Oat11 + Mat22 * Oat21;
T22 = Mat20 * Oat02 + Mat21 * Oat12 + Mat22 * Oat22;
Mat00 = T00;
Mat01 = T01;
Mat02 = T02;
Mat10 = T10;
Mat11 = T11;
Mat12 = T12;
Mat20 = T20;
Mat21 = T21;
Mat22 = T22;
}
inline void gp_Mat::PreMultiply (const gp_Mat& Other)
{
Standard_Real T00,T01,T02,T10,T11,T12,T20,T21,T22;
T00 = Oat00 * Mat00 + Oat01 * Mat10 + Oat02 * Mat20;
T01 = Oat00 * Mat01 + Oat01 * Mat11 + Oat02 * Mat21;
T02 = Oat00 * Mat02 + Oat01 * Mat12 + Oat02 * Mat22;
T10 = Oat10 * Mat00 + Oat11 * Mat10 + Oat12 * Mat20;
T11 = Oat10 * Mat01 + Oat11 * Mat11 + Oat12 * Mat21;
T12 = Oat10 * Mat02 + Oat11 * Mat12 + Oat12 * Mat22;
T20 = Oat20 * Mat00 + Oat21 * Mat10 + Oat22 * Mat20;
T21 = Oat20 * Mat01 + Oat21 * Mat11 + Oat22 * Mat21;
T22 = Oat20 * Mat02 + Oat21 * Mat12 + Oat22 * Mat22;
Mat00 = T00;
Mat01 = T01;
Mat02 = T02;
Mat10 = T10;
Mat11 = T11;
Mat12 = T12;
Mat20 = T20;
Mat21 = T21;
Mat22 = T22;
}
inline gp_Mat gp_Mat::Multiplied (const Standard_Real Scalar) const
{
gp_Mat NewMat;
Nat00 = Scalar * Mat00;
Nat01 = Scalar * Mat01;
Nat02 = Scalar * Mat02;
Nat10 = Scalar * Mat10;
Nat11 = Scalar * Mat11;
Nat12 = Scalar * Mat12;
Nat20 = Scalar * Mat20;
Nat21 = Scalar * Mat21;
Nat22 = Scalar * Mat22;
return NewMat;
}
inline void gp_Mat::Multiply (const Standard_Real Scalar)
{
Mat00 *= Scalar;
Mat01 *= Scalar;
Mat02 *= Scalar;
Mat10 *= Scalar;
Mat11 *= Scalar;
Mat12 *= Scalar;
Mat20 *= Scalar;
Mat21 *= Scalar;
Mat22 *= Scalar;
}
inline gp_Mat gp_Mat::Powered (const Standard_Integer N) const
{
gp_Mat MatN = *this;
MatN.Power (N);
return MatN;
}
inline void gp_Mat::Subtract (const gp_Mat& Other)
{
Mat00 -= Oat00;
Mat01 -= Oat01;
Mat02 -= Oat02;
Mat10 -= Oat10;
Mat11 -= Oat11;
Mat12 -= Oat12;
Mat20 -= Oat20;
Mat21 -= Oat21;
Mat22 -= Oat22;
}
inline gp_Mat gp_Mat::Subtracted (const gp_Mat& Other) const
{
gp_Mat NewMat;
Nat00 = Mat00 - Oat00;
Nat01 = Mat01 - Oat01;
Nat02 = Mat02 - Oat02;
Nat10 = Mat10 - Oat10;
Nat11 = Mat11 - Oat11;
Nat12 = Mat12 - Oat12;
Nat20 = Mat20 - Oat20;
Nat21 = Mat21 - Oat21;
Nat22 = Mat22 - Oat22;
return NewMat;
}
inline void gp_Mat::Transpose ()
{
Standard_Real Temp;
Temp = Mat01;
Mat01 = Mat10;
Mat10 = Temp;
Temp = Mat02;
Mat02 = Mat20;
Mat20 = Temp;
Temp = Mat12;
Mat12 = Mat21;
Mat21 = Temp;
}
inline gp_Mat gp_Mat::Transposed () const
{
gp_Mat NewMat = *this;
NewMat.Transpose();
return NewMat;
}
inline gp_Mat operator* (const Standard_Real Scalar, const gp_Mat& Mat3D)
{ return Mat3D.Multiplied (Scalar); }
|