From e1ee37accf3973cae1c373a6be84273d96401c39 Mon Sep 17 00:00:00 2001 From: Thorsten Behrens Date: Fri, 16 Jan 2004 09:39:11 +0000 Subject: [PATCH] Initial revision --- basegfx/source/point/b2ipoint.cxx | 96 ++++++++++++++ basegfx/source/point/b3ipoint.cxx | 93 +++++++++++++ basegfx/source/tuple/b2i64tuple.cxx | 73 ++++++++++ basegfx/source/tuple/b2ituple.cxx | 73 ++++++++++ basegfx/source/tuple/b3i64tuple.cxx | 72 ++++++++++ basegfx/source/tuple/b3ituple.cxx | 72 ++++++++++ basegfx/source/vector/b2ivector.cxx | 199 ++++++++++++++++++++++++++++ basegfx/source/vector/b3ivector.cxx | 88 ++++++++++++ 8 files changed, 766 insertions(+) create mode 100644 basegfx/source/point/b2ipoint.cxx create mode 100644 basegfx/source/point/b3ipoint.cxx create mode 100644 basegfx/source/tuple/b2i64tuple.cxx create mode 100644 basegfx/source/tuple/b2ituple.cxx create mode 100644 basegfx/source/tuple/b3i64tuple.cxx create mode 100644 basegfx/source/tuple/b3ituple.cxx create mode 100644 basegfx/source/vector/b2ivector.cxx create mode 100644 basegfx/source/vector/b3ivector.cxx diff --git a/basegfx/source/point/b2ipoint.cxx b/basegfx/source/point/b2ipoint.cxx new file mode 100644 index 000000000000..9451aeb0b818 --- /dev/null +++ b/basegfx/source/point/b2ipoint.cxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * $RCSfile: b2ipoint.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: thb $ $Date: 2004-01-16 10:36:03 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * 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. + * + * 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. + * + * 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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _BGFX_POINT_B2IPOINT_HXX +#include +#endif + +#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX +#include +#endif + +#include + + +namespace basegfx +{ + B2IPoint& B2IPoint::operator=( const ::basegfx::B2ITuple& rPoint ) + { + mnX = rPoint.getX(); + mnY = rPoint.getY(); + return *this; + } + + B2IPoint& B2IPoint::operator*=( const ::basegfx::B2DHomMatrix& rMat ) + { + mnX = fround( rMat.get(0,0)*mnX + + rMat.get(0,1)*mnY + + rMat.get(0,2) ); + + mnY = fround( rMat.get(1,0)*mnX + + rMat.get(1,1)*mnY + + rMat.get(1,2) ); + + return *this; + } +} // end of namespace basegfx + +// eof diff --git a/basegfx/source/point/b3ipoint.cxx b/basegfx/source/point/b3ipoint.cxx new file mode 100644 index 000000000000..1ed45b79f546 --- /dev/null +++ b/basegfx/source/point/b3ipoint.cxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * $RCSfile: b3ipoint.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: thb $ $Date: 2004-01-16 10:36:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * 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. + * + * 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. + * + * 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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _BGFX_POINT_B3IPOINT_HXX +#include +#endif + +#ifndef _BGFX_MATRIX_B3DHOMMATRIX_HXX +#include +#endif + +#include + +namespace basegfx +{ + B3IPoint& B3IPoint::operator*=( const ::basegfx::B3DHomMatrix& rMat ) + { + mnX = fround(rMat.get(0,0)*mnX + + rMat.get(0,1)*mnY + + rMat.get(0,2)*mnZ + + rMat.get(0,3)); + mnY = fround(rMat.get(1,0)*mnX + + rMat.get(1,1)*mnY + + rMat.get(1,2)*mnZ + + rMat.get(1,3)); + mnZ = fround(rMat.get(2,0)*mnX + + rMat.get(2,1)*mnY + + rMat.get(2,2)*mnZ + + rMat.get(2,3)); + + return *this; + } +} // end of namespace basegfx + +// eof diff --git a/basegfx/source/tuple/b2i64tuple.cxx b/basegfx/source/tuple/b2i64tuple.cxx new file mode 100644 index 000000000000..0cdabf35e90f --- /dev/null +++ b/basegfx/source/tuple/b2i64tuple.cxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * $RCSfile: b2i64tuple.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: thb $ $Date: 2004-01-16 10:37:42 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * 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. + * + * 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. + * + * 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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _BGFX_TUPLE_B2I64TUPLE_HXX +#include +#endif + +namespace basegfx +{ + // initialize static member + ::basegfx::B2I64Tuple B2I64Tuple::maEmptyTuple(0, 0); + +} // end of namespace basegfx + +// eof diff --git a/basegfx/source/tuple/b2ituple.cxx b/basegfx/source/tuple/b2ituple.cxx new file mode 100644 index 000000000000..24bb4bc1d160 --- /dev/null +++ b/basegfx/source/tuple/b2ituple.cxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * $RCSfile: b2ituple.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: thb $ $Date: 2004-01-16 10:37:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * 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. + * + * 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. + * + * 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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _BGFX_TUPLE_B2ITUPLE_HXX +#include +#endif + +namespace basegfx +{ + // initialize static member + ::basegfx::B2ITuple B2ITuple::maEmptyTuple(0, 0); + +} // end of namespace basegfx + +// eof diff --git a/basegfx/source/tuple/b3i64tuple.cxx b/basegfx/source/tuple/b3i64tuple.cxx new file mode 100644 index 000000000000..5c413d01f995 --- /dev/null +++ b/basegfx/source/tuple/b3i64tuple.cxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * $RCSfile: b3i64tuple.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: thb $ $Date: 2004-01-16 10:38:15 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * 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. + * + * 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. + * + * 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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _BGFX_TUPLE_B3I64TUPLE_HXX +#include +#endif + +namespace basegfx +{ + // initialize static member + ::basegfx::B3I64Tuple B3I64Tuple::maEmptyTuple(0, 0, 0); +} // end of namespace basegfx + +// eof diff --git a/basegfx/source/tuple/b3ituple.cxx b/basegfx/source/tuple/b3ituple.cxx new file mode 100644 index 000000000000..70cc5e6df2e3 --- /dev/null +++ b/basegfx/source/tuple/b3ituple.cxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * $RCSfile: b3ituple.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: thb $ $Date: 2004-01-16 10:37:59 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * 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. + * + * 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. + * + * 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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _BGFX_TUPLE_B3ITUPLE_HXX +#include +#endif + +namespace basegfx +{ + // initialize static member + ::basegfx::B3ITuple B3ITuple::maEmptyTuple(0, 0, 0); +} // end of namespace basegfx + +// eof diff --git a/basegfx/source/vector/b2ivector.cxx b/basegfx/source/vector/b2ivector.cxx new file mode 100644 index 000000000000..e71c392b4366 --- /dev/null +++ b/basegfx/source/vector/b2ivector.cxx @@ -0,0 +1,199 @@ +/************************************************************************* + * + * $RCSfile: b2ivector.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: thb $ $Date: 2004-01-16 10:38:49 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * 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. + * + * 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. + * + * 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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _BGFX_VECTOR_B2IVECTOR_HXX +#include +#endif + +#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX +#include +#endif + +#ifndef _BGFX_NUMERIC_FTOOLS_HXX +#include +#endif + +namespace basegfx +{ + B2IVector& B2IVector::operator=( const ::basegfx::B2ITuple& rVec ) + { + mnX = rVec.getX(); + mnY = rVec.getY(); + return *this; + } + + + double B2IVector::getLength() const + { + return hypot( mnX, mnY ); + } + + double B2IVector::scalar( const B2IVector& rVec ) const + { + return((mnX * rVec.mnX) + (mnY * rVec.mnY)); + } + + double B2IVector::cross( const B2IVector& rVec ) const + { + return(mnX * rVec.getY() - mnY * rVec.getX()); + } + + double B2IVector::angle( const B2IVector& rVec ) const + { + return atan2(mnX * rVec.getY() - mnY * rVec.getX(), + mnX * rVec.getX() + mnY * rVec.getY()); + } + + const B2IVector& B2IVector::getEmptyVector() + { + return (const B2IVector&) ::basegfx::B2ITuple::getEmptyTuple(); + } + + B2IVector& B2IVector::operator*=( const B2DHomMatrix& rMat ) + { + mnX = fround( rMat.get(0,0)*mnX + + rMat.get(0,1)*mnY ); + mnY = fround( rMat.get(1,0)*mnX + + rMat.get(1,1)*mnY ); + + return *this; + } + + B2IVector& B2IVector::setLength(double fLen) + { + double fLenNow(scalar(*this)); + + if(!::basegfx::fTools::equalZero(fLenNow)) + { + const double fOne(10.0); + + if(!::basegfx::fTools::equal(fOne, fLenNow)) + { + fLen /= sqrt(fLenNow); + } + + mnX = fround( mnX*fLen ); + mnY = fround( mnY*fLen ); + } + + return *this; + } + + bool areParallel( const B2IVector& rVecA, const B2IVector& rVecB ) + { + double fVal(rVecA.getX() * rVecB.getY() - rVecA.getY() * rVecB.getX()); + return ::basegfx::fTools::equalZero(fVal); + } + + B2VectorOrientation getOrientation( const B2IVector& rVecA, const B2IVector& rVecB ) + { + double fVal(rVecA.getX() * rVecB.getY() - rVecA.getY() * rVecB.getX()); + + if(fVal > 0.0) + { + return ORIENTATION_POSITIVE; + } + + if(fVal < 0.0) + { + return ORIENTATION_NEGATIVE; + } + + return ORIENTATION_NEUTRAL; + } + + B2IVector getPerpendicular( const B2IVector& rNormalizedVec ) + { + B2IVector aPerpendicular(-rNormalizedVec.getY(), rNormalizedVec.getX()); + return aPerpendicular; + } + + B2IVector operator*( const B2DHomMatrix& rMat, const B2IVector& rVec ) + { + B2IVector aRes( rVec ); + return aRes*=rMat; + } + + B2VectorContinuity getContinuity(const B2IVector& rBackVector, const B2IVector& rForwardVector ) + { + B2VectorContinuity eRetval(CONTINUITY_NONE); + + if(!rBackVector.equalZero() && !rForwardVector.equalZero()) + { + const B2IVector aInverseForwardVector(-rForwardVector.getX(), -rForwardVector.getY()); + + if(rBackVector == aInverseForwardVector) + { + // same direction and same length -> C2 + eRetval = CONTINUITY_C2; + } + else if(areParallel(rBackVector, aInverseForwardVector)) + { + // same direction -> C1 + eRetval = CONTINUITY_C1; + } + } + + return eRetval; + } +} // end of namespace basegfx + +// eof diff --git a/basegfx/source/vector/b3ivector.cxx b/basegfx/source/vector/b3ivector.cxx new file mode 100644 index 000000000000..48cd594bca3f --- /dev/null +++ b/basegfx/source/vector/b3ivector.cxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * $RCSfile: b3ivector.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: thb $ $Date: 2004-01-16 10:39:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * 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. + * + * 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. + * + * 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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _BGFX_VECTOR_B3IVECTOR_HXX +#include +#endif + +#ifndef _BGFX_MATRIX_B3DHOMMATRIX_HXX +#include +#endif + +namespace basegfx +{ + B3IVector& B3IVector::operator*=( const B3DHomMatrix& rMat ) + { + mnX = fround( rMat.get(0,0)*mnX + rMat.get(0,1)*mnY + rMat.get(0,2)*mnZ ); + mnY = fround( rMat.get(1,0)*mnX + rMat.get(1,1)*mnY + rMat.get(1,2)*mnZ ); + mnZ = fround( rMat.get(2,0)*mnX + rMat.get(2,1)*mnY + rMat.get(2,2)*mnZ ); + + return *this; + } + + B3IVector operator*( const B3DHomMatrix& rMat, const B3IVector& rVec ) + { + B3IVector aRes( rVec ); + return aRes*=rMat; + } +} // end of namespace basegfx + +// eof