LibreOffice Module basegfx (master) 1
b3dpolygontools.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 <vector>
23#include <functional>
24
28
29namespace basegfx
30{
31 class B3DPolyPolygon;
32 class B3DPolygon;
33 class B3DRange;
34}
35
36namespace basegfx::utils
37{
38 // B3DPolygon tools
39
47 BASEGFX_DLLPUBLIC void checkClosed(B3DPolygon& rCandidate);
48
49 // Get successor and predecessor indices. Returning the same index means there
50 // is none. Same for successor.
51 BASEGFX_DLLPUBLIC sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const B3DPolygon& rCandidate);
52
53 // get size of polygon. Control vectors are included in that ranges.
54 BASEGFX_DLLPUBLIC B3DRange getRange(const B3DPolygon& rCandidate);
55
56 // get length of polygon
57 BASEGFX_DLLPUBLIC double getLength(const B3DPolygon& rCandidate);
58
65 const B3DPolygon& rCandidate,
66 const std::vector<double>& rDotDashArray,
67 std::function<void(const basegfx::B3DPolygon& rSnippet)> aLineTargetCallback,
68 double fDotDashLength = 0.0);
70 const B3DPolygon& rCandidate,
71 const ::std::vector<double>& rDotDashArray,
72 B3DPolyPolygon* pLineTarget,
73 double fDotDashLength = 0.0);
74
79 B3DPolygon applyDefaultNormalsSphere( const B3DPolygon& rCandidate, const B3DPoint& rCenter);
80
84
90 B3DPolygon applyDefaultTextureCoordinatesParallel( const B3DPolygon& rCandidate, const B3DRange& rRange, bool bChangeX, bool bChangeY);
91
97 B3DPolygon applyDefaultTextureCoordinatesSphere( const B3DPolygon& rCandidate, const B3DPoint& rCenter, bool bChangeX, bool bChangeY);
98
99 // isInside tests for B3DPoint. On border is not inside as long as not true is given in bWithBorder flag.
100 BASEGFX_DLLPUBLIC bool isInside(const B3DPolygon& rCandidate, const B3DPoint& rPoint, bool bWithBorder);
101
102 // calculates if given point is on given line, taking care of the numerical epsilon
103 BASEGFX_DLLPUBLIC bool isPointOnLine(const B3DPoint& rStart, const B3DPoint& rEnd, const B3DPoint& rCandidate, bool bWithPoints);
104
105 // calculates if given point is on given polygon, taking care of the numerical epsilon. Uses
106 // isPointOnLine internally
107 BASEGFX_DLLPUBLIC bool isPointOnPolygon(const B3DPolygon& rCandidate, const B3DPoint& rPoint);
108
109 // helper to get a fCut position between a plane (given with normal and a point)
110 // and a line given by start and end point
111 BASEGFX_DLLPUBLIC bool getCutBetweenLineAndPlane(const B3DVector& rPlaneNormal, const B3DPoint& rPlanePoint, const B3DPoint& rEdgeStart, const B3DPoint& rEdgeEnd, double& fCut);
112
126
127} // end of namespace basegfx::utils
128
129/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define BASEGFX_DLLPUBLIC
Definition: basegfxdllapi.h:35
Base Point class with three double values.
Definition: b3dpoint.hxx:38
Base Point class with three double values.
Definition: b3dvector.hxx:38
bool isPointOnLine(const B2DPoint &rStart, const B2DPoint &rEnd, const B2DPoint &rCandidate, bool bWithPoints)
B3DPolygon applyDefaultTextureCoordinatesSphere(const B3DPolygon &rCandidate, const B3DPoint &rCenter, bool bChangeX, bool bChangeY)
Create/replace texture coordinates for given 3d geometry with spherical one rCenter: the centre of th...
double getLength(const B2DPolygon &rCandidate)
get length of polygon
bool getCutBetweenLineAndPlane(const B3DVector &rPlaneNormal, const B3DPoint &rPlanePoint, const B3DPoint &rEdgeStart, const B3DPoint &rEdgeEnd, double &fCut)
void applyLineDashing(const B2DPolygon &rCandidate, const std::vector< double > &rDotDashArray, B2DPolyPolygon *pLineTarget, B2DPolyPolygon *pGapTarget, double fDotDashLength)
sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const B2DPolygon &rCandidate)
bool isInside(const B2DPolygon &rCandidate, const B2DPoint &rPoint, bool bWithBorder)
B3DPolygon applyDefaultNormalsSphere(const B3DPolygon &rCandidate, const B3DPoint &rCenter)
Create/replace normals for given 3d geometry with default normals from given center to outside.
B2DPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolygon &rCandidate)
snap some polygon coordinates to discrete coordinates
bool isPointOnPolygon(const B2DPolygon &rCandidate, const B2DPoint &rPoint, bool bWithPoints)
B3DPolygon invertNormals(const B3DPolygon &rCandidate)
invert normals for given 3d geometry.
B3DPolygon applyDefaultTextureCoordinatesParallel(const B3DPolygon &rCandidate, const B3DRange &rRange, bool bChangeX, bool bChangeY)
Create/replace texture coordinates for given 3d geometry with parallel projected one rRange: the full...
void checkClosed(B2DPolygon &rCandidate)
Check if given polygon is closed.
B2DRange getRange(const B2DPolygon &rCandidate)
Get the range of a polygon.