diff options
Diffstat (limited to 'indra/llmath/m3math.h')
-rw-r--r-- | indra/llmath/m3math.h | 59 |
1 files changed, 31 insertions, 28 deletions
diff --git a/indra/llmath/m3math.h b/indra/llmath/m3math.h index d2848aaf5a..2be5452f8d 100644 --- a/indra/llmath/m3math.h +++ b/indra/llmath/m3math.h @@ -2,30 +2,25 @@ * @file m3math.h * @brief LLMatrix3 class header file. * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -33,6 +28,7 @@ #define LL_M3MATH_H #include "llerror.h" +#include "stdtypes.h" class LLVector4; class LLVector3; @@ -76,8 +72,9 @@ class LLMatrix3 // // various useful matrix functions - const LLMatrix3& identity(); // Load identity matrix - const LLMatrix3& zero(); // Clears Matrix to zero + const LLMatrix3& setIdentity(); // Load identity matrix + const LLMatrix3& clear(); // Clears Matrix to zero + const LLMatrix3& setZero(); // Clears Matrix to zero /////////////////////////// // @@ -91,6 +88,9 @@ class LLMatrix3 const LLMatrix3& setRot(const LLQuaternion &q); // Transform matrix by Euler angles and translating by pos const LLMatrix3& setRows(const LLVector3 &x_axis, const LLVector3 &y_axis, const LLVector3 &z_axis); + const LLMatrix3& setRow( U32 rowIndex, const LLVector3& row ); + const LLMatrix3& setCol( U32 colIndex, const LLVector3& col ); + /////////////////////////// // @@ -103,29 +103,31 @@ class LLMatrix3 LLVector3 getFwdRow() const; LLVector3 getLeftRow() const; LLVector3 getUpRow() const; - F32 determinant() const; // Return determinant + F32 determinant() const; // Return determinant /////////////////////////// // // Operations on an existing matrix // - const LLMatrix3& transpose(); // Transpose MAT4 - const LLMatrix3& invert(); // Invert MAT4 - const LLMatrix3& orthogonalize(); // Orthogonalizes X, then Y, then Z - const LLMatrix3& adjointTranspose(); // returns transpose of matrix adjoint, for multiplying normals + const LLMatrix3& transpose(); // Transpose MAT4 + const LLMatrix3& orthogonalize(); // Orthogonalizes X, then Y, then Z + void invert(); // Invert MAT4 + const LLMatrix3& adjointTranspose();// returns transpose of matrix adjoint, for multiplying normals // Rotate existing matrix // Note: the two lines below are equivalent: // foo.rotate(bar) // foo = foo * bar - // That is, foo.rotMat3(bar) multiplies foo by bar FROM THE RIGHT + // That is, foo.rotate(bar) multiplies foo by bar FROM THE RIGHT const LLMatrix3& rotate(const F32 angle, const F32 x, const F32 y, const F32 z); // Rotate matrix by rotating angle radians about (x, y, z) const LLMatrix3& rotate(const F32 angle, const LLVector3 &vec); // Rotate matrix by rotating angle radians about vec const LLMatrix3& rotate(const F32 roll, const F32 pitch, const F32 yaw); // Rotate matrix by roll (about x), pitch (about y), and yaw (about z) const LLMatrix3& rotate(const LLQuaternion &q); // Transform matrix by Euler angles and translating by pos + void add(const LLMatrix3& other_matrix); // add other_matrix to this one + // This operator is misleading as to operation direction // friend LLVector3 operator*(const LLMatrix3 &a, const LLVector3 &b); // Apply rotation a to vector b @@ -137,6 +139,7 @@ class LLMatrix3 friend bool operator!=(const LLMatrix3 &a, const LLMatrix3 &b); // Return a != b friend const LLMatrix3& operator*=(LLMatrix3 &a, const LLMatrix3 &b); // Return a * b + friend const LLMatrix3& operator*=(LLMatrix3 &a, F32 scalar ); // Return a * scalar friend std::ostream& operator<<(std::ostream& s, const LLMatrix3 &a); // Stream a }; |