/usr/include/oce/gp_XYZ.lxx is in liboce-foundation-dev 0.18.2-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 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 | // 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.
// LPA et JCV 07/92
#include <gp.hxx>
#include <gp_Mat.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_OutOfRange.hxx>
inline gp_XYZ::gp_XYZ () : x(0.), y(0.), z(0.) { }
inline gp_XYZ::gp_XYZ (const Standard_Real X,
const Standard_Real Y,
const Standard_Real Z) : x(X),y(Y),z(Z) { }
inline void gp_XYZ::SetCoord (const Standard_Real X,
const Standard_Real Y,
const Standard_Real Z)
{ x = X; y = Y; z = Z; }
inline void gp_XYZ::SetCoord (const Standard_Integer i,
const Standard_Real X) {
Standard_OutOfRange_Raise_if( i < 1 || i > 3,NULL);
(&x)[i-1] = X;
}
inline void gp_XYZ::SetX (const Standard_Real X)
{ x = X; }
inline void gp_XYZ::SetY (const Standard_Real Y)
{ y = Y; }
inline void gp_XYZ::SetZ (const Standard_Real Z)
{ z = Z; }
inline Standard_Real gp_XYZ::Coord (const Standard_Integer i) const {
Standard_OutOfRange_Raise_if( i < 1 || i > 3,NULL);
return (&x)[i-1];
}
inline Standard_Real& gp_XYZ::ChangeCoord(const Standard_Integer theIndex)
{
Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > 3,NULL);
return (&x)[theIndex - 1];
}
inline void gp_XYZ::Coord (Standard_Real& X,
Standard_Real& Y,
Standard_Real& Z) const
{ X = x; Y = y; Z = z; }
inline Standard_Real gp_XYZ::X () const
{ return x; }
inline Standard_Real gp_XYZ::Y () const
{ return y; }
inline Standard_Real gp_XYZ::Z () const
{ return z; }
inline Standard_Real gp_XYZ::Modulus () const {
return sqrt (x * x + y * y + z * z);
}
inline Standard_Real gp_XYZ::SquareModulus () const {
return (x * x + y * y + z * z);
}
inline void gp_XYZ::Add (const gp_XYZ& Other)
{
x += Other.x;
y += Other.y;
z += Other.z;
}
inline gp_XYZ gp_XYZ::Added (const gp_XYZ& Other) const {
return gp_XYZ(x + Other.x,y + Other.y,z + Other.z);
}
inline void gp_XYZ::Cross (const gp_XYZ& Right)
{
Standard_Real Xresult = y * Right.z - z * Right.y;
Standard_Real Yresult = z * Right.x - x * Right.z;
z = x * Right.y - y * Right.x;
x = Xresult;
y = Yresult;
}
inline gp_XYZ gp_XYZ::Crossed (const gp_XYZ& Right) const
{
return gp_XYZ (y * Right.z - z * Right.y,
z * Right.x - x * Right.z,
x * Right.y - y * Right.x);
}
inline Standard_Real gp_XYZ::CrossMagnitude (const gp_XYZ& Right) const
{
Standard_Real Xresult = y * Right.z - z * Right.y;
Standard_Real Yresult = z * Right.x - x * Right.z;
Standard_Real Zresult = x * Right.y - y * Right.x;
return sqrt(Xresult * Xresult + Yresult * Yresult + Zresult * Zresult);
}
inline Standard_Real gp_XYZ::CrossSquareMagnitude (const gp_XYZ& Right) const
{
Standard_Real Xresult = y * Right.z - z * Right.y;
Standard_Real Yresult = z * Right.x - x * Right.z;
Standard_Real Zresult = x * Right.y - y * Right.x;
return Xresult * Xresult + Yresult * Yresult + Zresult * Zresult;
}
inline void gp_XYZ::CrossCross (const gp_XYZ& Coord1,
const gp_XYZ& Coord2)
{
Standard_Real Xresult =
y * (Coord1.x * Coord2.y - Coord1.y * Coord2.x) -
z * (Coord1.z * Coord2.x - Coord1.x * Coord2.z);
Standard_Real Yresult =
z * (Coord1.y * Coord2.z - Coord1.z * Coord2.y) -
x * (Coord1.x * Coord2.y - Coord1.y * Coord2.x);
z =
x * (Coord1.z * Coord2.x - Coord1.x * Coord2.z) -
y * (Coord1.y * Coord2.z - Coord1.z * Coord2.y);
x = Xresult;
y = Yresult;
}
inline gp_XYZ gp_XYZ::CrossCrossed (const gp_XYZ& Coord1,
const gp_XYZ& Coord2) const
{
gp_XYZ Coord0 = *this;
Coord0.CrossCross (Coord1, Coord2);
return Coord0;
}
inline void gp_XYZ::Divide (const Standard_Real Scalar)
{
x /= Scalar;
y /= Scalar;
z /= Scalar;
}
inline gp_XYZ gp_XYZ::Divided (const Standard_Real Scalar) const {
return gp_XYZ(x / Scalar,y / Scalar,z / Scalar);
}
inline Standard_Real gp_XYZ::Dot (const gp_XYZ& Other) const {
return(x * Other.x + y * Other.y + z * Other.z);
}
inline Standard_Real gp_XYZ::DotCross (const gp_XYZ& Coord1,
const gp_XYZ& Coord2) const
{
Standard_Real Xresult = Coord1.y * Coord2.z - Coord1.z * Coord2.y;
Standard_Real Yresult = Coord1.z * Coord2.x - Coord1.x * Coord2.z;
Standard_Real Zresult = Coord1.x * Coord2.y - Coord1.y * Coord2.x;
return ( x * Xresult + y * Yresult + z * Zresult);
}
inline void gp_XYZ::Multiply (const Standard_Real Scalar)
{
x *= Scalar;
y *= Scalar;
z *= Scalar;
}
inline void gp_XYZ::Multiply (const gp_XYZ& Other)
{
x *= Other.x;
y *= Other.y;
z *= Other.z;
}
inline void gp_XYZ::Multiply (const gp_Mat& Matrix)
{
Standard_Real Xresult = Matrix.matrix[0][0] * x + Matrix.matrix[0][1] * y + Matrix.matrix[0][2] * z;
Standard_Real Yresult = Matrix.matrix[1][0] * x + Matrix.matrix[1][1] * y + Matrix.matrix[1][2] * z;
z = Matrix.matrix[2][0] * x + Matrix.matrix[2][1] * y + Matrix.matrix[2][2] * z;
x = Xresult;
y = Yresult;
}
inline gp_XYZ gp_XYZ::Multiplied (const Standard_Real Scalar) const {
return gp_XYZ(x * Scalar,y * Scalar,z * Scalar);
}
inline gp_XYZ gp_XYZ::Multiplied (const gp_XYZ& Other) const {
return gp_XYZ(x * Other.x, y * Other.y, z * Other.z);
}
inline gp_XYZ gp_XYZ::Multiplied (const gp_Mat& Matrix) const
{
return gp_XYZ (Matrix.matrix[0][0] * x + Matrix.matrix[0][1] * y + Matrix.matrix[0][2] * z,
Matrix.matrix[1][0] * x + Matrix.matrix[1][1] * y + Matrix.matrix[1][2] * z,
Matrix.matrix[2][0] * x + Matrix.matrix[2][1] * y + Matrix.matrix[2][2] * z);
}
inline void gp_XYZ::Normalize ()
{
Standard_Real D = Modulus();
Standard_ConstructionError_Raise_if (D <= gp::Resolution(), "");
x = x / D; y = y / D; z = z / D;
}
inline gp_XYZ gp_XYZ::Normalized () const
{
Standard_Real D = Modulus();
Standard_ConstructionError_Raise_if (D <= gp::Resolution(), "");
return gp_XYZ (x / D, y / D, z / D);
}
inline void gp_XYZ::Reverse ()
{
x = - x;
y = - y;
z = - z;
}
inline gp_XYZ gp_XYZ::Reversed () const
{
return gp_XYZ(-x, -y, -z);
}
inline void gp_XYZ::Subtract (const gp_XYZ& Right)
{
x-=Right.x;
y-=Right.y;
z-=Right.z;
}
inline gp_XYZ gp_XYZ::Subtracted (const gp_XYZ& Right) const
{
return gp_XYZ(x - Right.x, y - Right.y, z - Right.z);
}
inline void gp_XYZ::SetLinearForm (const Standard_Real L,
const gp_XYZ& Left,
const Standard_Real R,
const gp_XYZ& Right) {
x = L * Left.x + R * Right.x;
y = L * Left.y + R * Right.y;
z = L * Left.z + R * Right.z;
}
inline void gp_XYZ::SetLinearForm(const Standard_Real L,
const gp_XYZ& Left,
const gp_XYZ& Right) {
x = L * Left.x + Right.x;
y = L * Left.y + Right.y;
z = L * Left.z + Right.z;
}
inline void gp_XYZ::SetLinearForm (const gp_XYZ& Left, const gp_XYZ& Right) {
x = Left.x + Right.x;
y = Left.y + Right.y;
z = Left.z + Right.z;
}
inline void gp_XYZ::SetLinearForm (const Standard_Real A1, const gp_XYZ& XYZ1,
const Standard_Real A2, const gp_XYZ& XYZ2,
const Standard_Real A3, const gp_XYZ& XYZ3) {
x = A1 * XYZ1.x + A2 * XYZ2.x + A3 * XYZ3.x;
y = A1 * XYZ1.y + A2 * XYZ2.y + A3 * XYZ3.y;
z = A1 * XYZ1.z + A2 * XYZ2.z + A3 * XYZ3.z;
}
inline void gp_XYZ::SetLinearForm (const Standard_Real A1, const gp_XYZ& XYZ1,
const Standard_Real A2, const gp_XYZ& XYZ2,
const gp_XYZ& XYZ3) {
x = A1 * XYZ1.x + A2 * XYZ2.x + XYZ3.x;
y = A1 * XYZ1.y + A2 * XYZ2.y + XYZ3.y;
z = A1 * XYZ1.z + A2 * XYZ2.z + XYZ3.z;
}
inline void gp_XYZ::SetLinearForm (const Standard_Real A1, const gp_XYZ& XYZ1,
const Standard_Real A2, const gp_XYZ& XYZ2,
const Standard_Real A3, const gp_XYZ& XYZ3,
const gp_XYZ& XYZ4) {
x = A1 * XYZ1.x + A2 * XYZ2.x + A3 * XYZ3.x + XYZ4.x;
y = A1 * XYZ1.y + A2 * XYZ2.y + A3 * XYZ3.y + XYZ4.y;
z = A1 * XYZ1.z + A2 * XYZ2.z + A3 * XYZ3.z + XYZ4.z;
}
inline gp_XYZ operator* (const gp_Mat& Matrix, const gp_XYZ& Coord1) {
return Coord1.Multiplied (Matrix);
}
inline gp_XYZ operator* (const Standard_Real Scalar, const gp_XYZ& Coord1) {
return Coord1.Multiplied (Scalar);
}
inline const Standard_Real* gp_XYZ::GetData() const { return (&x); }
inline Standard_Real* gp_XYZ::ChangeData() { return (&x); }
|