LibreOffice Module basegfx (master) 1
b2ivector.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
22#include <ostream>
23
26
27namespace basegfx
28{
29 class B2DHomMatrix;
30
40 {
41 public:
47 {}
48
59 B2IVector(sal_Int32 nX, sal_Int32 nY)
60 : B2ITuple(nX, nY)
61 {}
62
66 B2IVector(const ::basegfx::B2ITuple& rTuple)
67 : B2ITuple(rTuple)
68 {}
69
73 {
74 mnX *= rPnt.mnX;
75 mnY *= rPnt.mnY;
76 return *this;
77 }
78
81 B2IVector& operator*=(sal_Int32 t)
82 {
83 mnX *= t;
84 mnY *= t;
85 return *this;
86 }
87
91 B2IVector& operator=( const ::basegfx::B2ITuple& rVec );
92
98 B2IVector& setLength(double fLen);
99
108 double scalar( const B2IVector& rVec ) const { return((mnX * rVec.mnX) + (mnY * rVec.mnY)); }
109
115 B2IVector& operator*=( const B2DHomMatrix& rMat );
116 };
117
118 // external operators
119
120 template< typename charT, typename traits >
121 inline std::basic_ostream<charT, traits> & operator <<(
122 std::basic_ostream<charT, traits> & stream, const basegfx::B2IVector& vector )
123 {
124 return stream << "(" << vector.getX() << "," << vector.getY() << ")";
125 }
126
127} // end of namespace basegfx
128
129/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
XPropertyListType t
#define BASEGFX_DLLPUBLIC
Definition: basegfxdllapi.h:35
Base class for all Points/Vectors with two sal_Int32 values.
Definition: b2ituple.hxx:37
Base Point class with two sal_Int32 values.
Definition: b2ivector.hxx:40
double scalar(const B2IVector &rVec) const
Calculate the Scalar with another 2D Vector.
Definition: b2ivector.hxx:108
B2IVector & operator*=(const B2IVector &rPnt)
*=operator to allow usage from B2IVector, too
Definition: b2ivector.hxx:72
B2IVector(const ::basegfx::B2ITuple &rTuple)
constructor with tuple to allow copy-constructing from B2ITuple-based classes
Definition: b2ivector.hxx:66
B2IVector(sal_Int32 nX, sal_Int32 nY)
Create a 2D Vector.
Definition: b2ivector.hxx:59
B2IVector()
Create a 2D Vector.
Definition: b2ivector.hxx:46
B2IVector & operator*=(sal_Int32 t)
*=operator to allow usage from B2IVector, too
Definition: b2ivector.hxx:81
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
Reference< XOutputStream > stream
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &stream, BColor const &color)
Definition: bcolor.hxx:176
SmFace & operator*=(SmFace &rFace, const Fraction &rFrac)