/src/libreoffice/include/basegfx/polygon/b2dpolygontriangulator.hxx
Line | Count | Source |
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 <basegfx/point/b2dpoint.hxx> |
23 | | #include <basegfx/basegfxdllapi.h> |
24 | | |
25 | | #include <vector> |
26 | | |
27 | | namespace basegfx { class B2DPolyPolygon; } |
28 | | namespace basegfx { class B2DPolygon; } |
29 | | |
30 | | namespace basegfx::triangulator |
31 | | { |
32 | | // Simple B2D-based triangle. Main reason is to |
33 | | // keep the data types separated (before a B2DPolygon |
34 | | // was used with the convention that three points in |
35 | | // a row define a triangle) |
36 | | class BASEGFX_DLLPUBLIC B2DTriangle |
37 | | { |
38 | | // positions |
39 | | basegfx::B2DPoint maA; |
40 | | basegfx::B2DPoint maB; |
41 | | basegfx::B2DPoint maC; |
42 | | |
43 | | public: |
44 | | B2DTriangle( |
45 | | const basegfx::B2DPoint& rA, |
46 | | const basegfx::B2DPoint& rB, |
47 | | const basegfx::B2DPoint& rC) |
48 | 0 | : maA(rA), |
49 | 0 | maB(rB), |
50 | 0 | maC(rC) |
51 | 0 | { |
52 | 0 | } |
53 | | |
54 | | // get positions |
55 | 0 | const basegfx::B2DPoint& getA() const { return maA; } |
56 | 0 | const basegfx::B2DPoint& getB() const { return maB; } |
57 | 0 | const basegfx::B2DPoint& getC() const { return maC; } |
58 | | }; |
59 | | |
60 | | // typedef for a vector of B2DTriangle |
61 | | typedef ::std::vector< B2DTriangle > B2DTriangleVector; |
62 | | |
63 | | // triangulate given polygon |
64 | | BASEGFX_DLLPUBLIC B2DTriangleVector triangulate(const ::basegfx::B2DPolygon& rCandidate); |
65 | | |
66 | | // triangulate given PolyPolygon |
67 | | BASEGFX_DLLPUBLIC B2DTriangleVector triangulate(const ::basegfx::B2DPolyPolygon& rCandidate); |
68 | | |
69 | | } // end of namespace basegfx::triangulator |
70 | | |
71 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |