00001 /************************************************************************* 00002 * 00003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 00004 * 00005 * Copyright 2000, 2010 Oracle and/or its affiliates. 00006 * 00007 * OpenOffice.org - a multi-platform office productivity suite 00008 * 00009 * This file is part of OpenOffice.org. 00010 * 00011 * OpenOffice.org is free software: you can redistribute it and/or modify 00012 * it under the terms of the GNU Lesser General Public License version 3 00013 * only, as published by the Free Software Foundation. 00014 * 00015 * OpenOffice.org is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Lesser General Public License version 3 for more details 00019 * (a copy is included in the LICENSE file that accompanied this code). 00020 * 00021 * You should have received a copy of the GNU Lesser General Public License 00022 * version 3 along with OpenOffice.org. If not, see 00023 * <http://www.openoffice.org/license.html> 00024 * for a copy of the LGPLv3 License. 00025 * 00026 ************************************************************************/ 00027 00028 #ifndef _BGFX_VECTOR_B2DVECTOR_HXX 00029 #define _BGFX_VECTOR_B2DVECTOR_HXX 00030 00031 #include <basegfx/tuple/b2dtuple.hxx> 00032 #include <basegfx/vector/b2ivector.hxx> 00033 #include <basegfx/vector/b2enums.hxx> 00034 00035 namespace basegfx 00036 { 00037 // predeclaration 00038 class B2DHomMatrix; 00039 00048 class B2DVector : public ::basegfx::B2DTuple 00049 { 00050 public: 00055 B2DVector() 00056 : B2DTuple() 00057 {} 00058 00069 B2DVector(double fX, double fY) 00070 : B2DTuple(fX, fY) 00071 {} 00072 00078 B2DVector(const B2DVector& rVec) 00079 : B2DTuple(rVec) 00080 {} 00081 00087 B2DVector(const ::basegfx::B2IVector& rVec) 00088 : B2DTuple(rVec) 00089 {} 00090 00094 B2DVector(const ::basegfx::B2DTuple& rTuple) 00095 : B2DTuple(rTuple) 00096 {} 00097 00098 ~B2DVector() 00099 {} 00100 00103 B2DVector& operator*=( const B2DVector& rPnt ) 00104 { 00105 mfX *= rPnt.mfX; 00106 mfY *= rPnt.mfY; 00107 return *this; 00108 } 00109 00112 B2DVector& operator*=(double t) 00113 { 00114 mfX *= t; 00115 mfY *= t; 00116 return *this; 00117 } 00118 00122 B2DVector& operator=( const ::basegfx::B2DTuple& rVec ); 00123 00128 double getLength() const; 00129 00135 B2DVector& setLength(double fLen); 00136 00141 B2DVector& normalize(); 00142 00149 bool isNormalized() const; 00150 00159 double scalar( const B2DVector& rVec ) const; 00160 00176 double cross( const B2DVector& rVec ) const; 00177 00186 double angle( const B2DVector& rVec ) const; 00187 00193 B2DVector& operator*=( const B2DHomMatrix& rMat ); 00194 00195 static const B2DVector& getEmptyVector(); 00196 }; 00197 00198 // external operators 00200 00212 B2VectorOrientation getOrientation( const B2DVector& rVecA, const B2DVector& rVecB ); 00213 00224 B2DVector getPerpendicular( const B2DVector& rNormalizedVec ); 00225 00235 B2DVector getNormalizedPerpendicular( const B2DVector& rVec ); 00236 00249 bool areParallel( const B2DVector& rVecA, const B2DVector& rVecB ); 00250 00256 B2DVector operator*( const B2DHomMatrix& rMat, const B2DVector& rVec ); 00257 00263 B2VectorContinuity getContinuity( const B2DVector& rBackVector, const B2DVector& rForwardVector ); 00264 00265 } // end of namespace basegfx 00266 00267 #endif /* _BGFX_VECTOR_B2DVECTOR_HXX */
1.5.6