LibreOffice Module basegfx (master) 1
b2dvector.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
26
27namespace basegfx
28{
29 class B2DHomMatrix;
30
40 {
41 public:
47 {}
48
59 B2DVector(double fX, double fY)
60 : B2DTuple(fX, fY)
61 {}
62
68 explicit B2DVector(const ::basegfx::B2IVector& rVec)
69 : B2DTuple(rVec)
70 {}
71
76 : B2DTuple(rTuple)
77 {}
78
82 {
83 mfX *= rPnt.mfX;
84 mfY *= rPnt.mfY;
85 return *this;
86 }
87
91 {
92 mfX *= t;
93 mfY *= t;
94 return *this;
95 }
96
101 {
102 mfX = rVector.getX();
103 mfY = rVector.getY();
104 return *this;
105 }
106
111 double getLength() const;
112
118 B2DVector& setLength(double fLen);
119
125
134 double scalar( const B2DVector& rVec ) const { return((mfX * rVec.mfX) + (mfY * rVec.mfY)); }
135
151 double cross( const B2DVector& rVec ) const { return(mfX * rVec.getY() - mfY * rVec.getX()); }
152
161 double angle( const B2DVector& rVec ) const;
162
168 B2DVector& operator*=( const B2DHomMatrix& rMat );
169
170 static const B2DVector& getEmptyVector();
171 };
172
173 // external operators
174
175
187 BASEGFX_DLLPUBLIC B2VectorOrientation getOrientation( const B2DVector& rVecA, const B2DVector& rVecB );
188
199 BASEGFX_DLLPUBLIC B2DVector getPerpendicular( const B2DVector& rNormalizedVec );
200
210 BASEGFX_DLLPUBLIC B2DVector getNormalizedPerpendicular( const B2DVector& rVec );
211
224 BASEGFX_DLLPUBLIC bool areParallel( const B2DVector& rVecA, const B2DVector& rVecB );
225
231 BASEGFX_DLLPUBLIC B2DVector operator*( const B2DHomMatrix& rMat, const B2DVector& rVec );
232
238 BASEGFX_DLLPUBLIC B2VectorContinuity getContinuity( const B2DVector& rBackVector, const B2DVector& rForwardVector );
239
240} // end of namespace basegfx
241
242/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
XPropertyListType t
#define BASEGFX_DLLPUBLIC
Definition: basegfxdllapi.h:35
Base class for all Points/Vectors with two double values.
Definition: b2dtuple.hxx:39
Base Point class with two double values.
Definition: b2dvector.hxx:40
B2DVector & operator=(Tuple2D< double > const &rVector)
assignment operator to allow assigning the results of B2DTuple calculations
Definition: b2dvector.hxx:100
double scalar(const B2DVector &rVec) const
Calculate the Scalar with another 2D Vector.
Definition: b2dvector.hxx:134
double cross(const B2DVector &rVec) const
Calculate the length of the cross product with another 2D Vector.
Definition: b2dvector.hxx:151
B2DVector(double fX, double fY)
Create a 2D Vector.
Definition: b2dvector.hxx:59
B2DVector & operator*=(const B2DVector &rPnt)
*=operator to allow usage from B2DVector, too
Definition: b2dvector.hxx:81
B2DVector(Tuple2D< double > const &rTuple)
constructor with tuple to allow copy-constructing from B2DTuple-based classes
Definition: b2dvector.hxx:75
B2DVector & operator*=(double t)
*=operator to allow usage from B2DVector, too
Definition: b2dvector.hxx:90
B2DVector()
Create a 2D Vector.
Definition: b2dvector.hxx:46
B2DVector(const ::basegfx::B2IVector &rVec)
Create a copy of a 2D Vector.
Definition: b2dvector.hxx:68
TYPE getX() const
Get X-Coordinate of 2D Tuple.
Definition: Tuple2D.hxx:63
TYPE getY() const
Get Y-Coordinate of 2D Tuple.
Definition: Tuple2D.hxx:66
double getLength(const B2DPolygon &rCandidate)
get length of polygon
B2VectorContinuity
Descriptor for the mathematical continuity of two 2D Vectors.
Definition: b2enums.hxx:41
bool areParallel(const B2DVector &rVecA, const B2DVector &rVecB)
Test two vectors which need not to be normalized for parallelism.
Definition: b2dvector.cxx:111
B2VectorOrientation getOrientation(const B2DVector &rVecA, const B2DVector &rVecB)
Calculate the orientation to another 2D Vector.
Definition: b2dvector.cxx:119
B2VectorOrientation
Descriptor for the mathematical orientations of two 2D Vectors.
Definition: b2enums.hxx:27
B2DVector getNormalizedPerpendicular(const B2DVector &rVec)
Calculate a perpendicular 2D Vector to the given one, normalize the given one as preparation.
Definition: b2dvector.cxx:144
B2VectorContinuity getContinuity(const B2DVector &rBackVector, const B2DVector &rForwardVector)
Test continuity between given vectors.
Definition: b2dvector.cxx:161
B2DVector getPerpendicular(const B2DVector &rNormalizedVec)
Calculate a perpendicular 2D Vector to the given one.
Definition: b2dvector.cxx:138
B2DPoint operator*(const ::basegfx::B2DHomMatrix &rMat, const B2DPoint &rPoint)
Definition: b2dpoint.cxx:43
bool normalize(sal_uInt16 &rDay, sal_uInt16 &rMonth, sal_Int16 &rYear)
double mfY
double mfX
#define SAL_WARN_UNUSED
SmFace & operator*=(SmFace &rFace, const Fraction &rFrac)