1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <tools/gen.hxx>
22 void PointTemplateBase::RotateAround( PointTemplateBase
& rPoint
,
23 Degree10 nOrientation
) const
25 tools::Long nX
= rPoint
.mnA
;
26 tools::Long nY
= rPoint
.mnB
;
27 RotateAround(nX
, nY
, nOrientation
);
32 void PointTemplateBase::RotateAround( tools::Long
& rX
, tools::Long
& rY
,
33 Degree10 nOrientation
) const
35 const tools::Long nOriginX
= mnA
;
36 const tools::Long nOriginY
= mnB
;
38 if ( (nOrientation
>= 0_deg10
) && !(nOrientation
% 900_deg10
) )
40 if ( nOrientation
>= 3600_deg10
)
41 nOrientation
%= 3600_deg10
;
48 if ( nOrientation
== 900_deg10
)
50 tools::Long nTemp
= rX
;
54 else if ( nOrientation
== 1800_deg10
)
59 else /* ( nOrientation == 2700 ) */
61 tools::Long nTemp
= rX
;
72 double nRealOrientation
= toRadians(nOrientation
);
73 double nCos
= cos( nRealOrientation
);
74 double nSin
= sin( nRealOrientation
);
77 tools::Long nX
= rX
-nOriginX
;
78 tools::Long nY
= rY
-nOriginY
;
81 rX
= + static_cast<tools::Long
>(nCos
*nX
+ nSin
*nY
) + nOriginX
;
82 rY
= - static_cast<tools::Long
>(nSin
*nX
- nCos
*nY
) + nOriginY
;
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */