Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hi,

Attached is a patch for removal of unused code in files
core/basegfx/source/polygon/b3dpolygontools.cxx and
core/basegfx/inc/basegfx/polygon/b3dpolygontools.hxx

thanks,

Björgvin
From 87195b203f05a76f26b383126a514a20a70a69eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rgvin=20Ragnarsson?= <nifgraup@gmail.com>
Date: Wed, 15 Feb 2012 01:04:12 +0000
Subject: [PATCH] Removed unused code.

---
 basegfx/inc/basegfx/polygon/b3dpolygontools.hxx |   26 +----
 basegfx/source/polygon/b3dpolygontools.cxx      |  146 -----------------------
 2 files changed, 1 insertions(+), 171 deletions(-)

diff --git a/basegfx/inc/basegfx/polygon/b3dpolygontools.hxx 
b/basegfx/inc/basegfx/polygon/b3dpolygontools.hxx
index 2cd8ec9..defaae8 100644
--- a/basegfx/inc/basegfx/polygon/b3dpolygontools.hxx
+++ b/basegfx/inc/basegfx/polygon/b3dpolygontools.hxx
@@ -59,7 +59,6 @@ namespace basegfx
 
         // Get successor and predecessor indices. Returning the same index means there
         // is none. Same for successor.
-        BASEGFX_DLLPUBLIC sal_uInt32 getIndexOfPredecessor(sal_uInt32 nIndex, const B3DPolygon& 
rCandidate);
         BASEGFX_DLLPUBLIC sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const B3DPolygon& 
rCandidate);
 
         // Get orientation of Polygon
@@ -71,15 +70,9 @@ namespace basegfx
         // get normal vector of polygon
         BASEGFX_DLLPUBLIC B3DVector getNormal(const B3DPolygon& rCandidate);
 
-        // get normal vector of positive oriented polygon
-        BASEGFX_DLLPUBLIC B3DVector getPositiveOrientedNormal(const B3DPolygon& rCandidate);
-
         // get signed area of polygon
         BASEGFX_DLLPUBLIC double getSignedArea(const B3DPolygon& rCandidate);
 
-        // get area of polygon
-        BASEGFX_DLLPUBLIC double getArea(const B3DPolygon& rCandidate);
-
         // get signed area of polygon
         BASEGFX_DLLPUBLIC double getSignedArea(const B3DPolygon& rCandidate);
 
@@ -97,11 +90,6 @@ namespace basegfx
         // using getLength(...)
         BASEGFX_DLLPUBLIC B3DPoint getPositionAbsolute(const B3DPolygon& rCandidate, double 
fDistance, double fLength = 0.0);
 
-        // get position on polygon for relative given distance in range [0.0 .. 1.0]. If
-        // length is given, it is assumed the correct polygon length, if 0.0 it is calculated
-        // using getLength(...)
-        BASEGFX_DLLPUBLIC B3DPoint getPositionRelative(const B3DPolygon& rCandidate, double 
fDistance, double fLength = 0.0);
-
         /** Apply given LineDashing to given polygon
 
             For a description see applyLineDashing in b2dpolygontoos.hxx
@@ -143,15 +131,8 @@ namespace basegfx
         // fDistance, and the sphere around both points with radius fDistance.
         BASEGFX_DLLPUBLIC bool isInEpsilonRange(const B3DPoint& rEdgeStart, const B3DPoint& 
rEdgeEnd, const B3DPoint& rTestPosition, double fDistance);
 
-        // test if point is inside epsilon-range around the given Polygon. Can be used
-        // for HitTesting. The epsilon-range is defined to be the cylinder centered to
-        // the given edge, using radius fDistance, and the sphere around both points with radius 
fDistance.
-        BASEGFX_DLLPUBLIC bool isInEpsilonRange(const B3DPolygon& rCandidate, const B3DPoint& 
rTestPosition, double fDistance);
-
-        // isInside tests for B3DPoint and other B3DPolygon. On border is not inside as long as
-        // not true is given in bWithBorder flag.
+        // isInside tests for B3DPoint. On border is not inside as long as not true is given in 
bWithBorder flag.
         BASEGFX_DLLPUBLIC bool isInside(const B3DPolygon& rCandidate, const B3DPoint& rPoint, bool 
bWithBorder = false);
-        BASEGFX_DLLPUBLIC bool isInside(const B3DPolygon& rCandidate, const B3DPolygon& rPolygon, 
bool bWithBorder = false);
 
         // calculates if given point is on given line, taking care of the numerical epsilon
         BASEGFX_DLLPUBLIC bool isPointOnLine(const B3DPoint& rStart, const B3DPoint& rEnd, const 
B3DPoint& rCandidate, bool bWithPoints = false);
@@ -164,14 +145,9 @@ namespace basegfx
         // and a line given by start and end point
         BASEGFX_DLLPUBLIC bool getCutBetweenLineAndPlane(const B3DVector& rPlaneNormal, const 
B3DPoint& rPlanePoint, const B3DPoint& rEdgeStart, const B3DPoint& rEdgeEnd, double& fCut);
 
-        // helper to get a fCut position between a 3d Polygon
-        // and a line given by start and end point
-        BASEGFX_DLLPUBLIC bool getCutBetweenLineAndPolygon(const B3DPolygon& rCandidate, const 
B3DPoint& rEdgeStart, const B3DPoint& rEdgeEnd, double& fCut);
-
         //////////////////////////////////////////////////////////////////////
         // comparators with tolerance for 3D Polygons
         BASEGFX_DLLPUBLIC bool equal(const B3DPolygon& rCandidateA, const B3DPolygon& rCandidateB, 
const double& rfSmallValue);
-        BASEGFX_DLLPUBLIC bool equal(const B3DPolygon& rCandidateA, const B3DPolygon& rCandidateB);
 
         /** snap some polygon coordinates to discrete coordinates
 
diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx
index fda58fb..b31712a 100644
--- a/basegfx/source/polygon/b3dpolygontools.cxx
+++ b/basegfx/source/polygon/b3dpolygontools.cxx
@@ -55,26 +55,6 @@ namespace basegfx
             }
         }
 
-        // Get successor and predecessor indices. Returning the same index means there
-        // is none. Same for successor.
-        sal_uInt32 getIndexOfPredecessor(sal_uInt32 nIndex, const B3DPolygon& rCandidate)
-        {
-            OSL_ENSURE(nIndex < rCandidate.count(), "getIndexOfPredecessor: Access to polygon out 
of range (!)");
-
-            if(nIndex)
-            {
-                return nIndex - 1L;
-            }
-            else if(rCandidate.count())
-            {
-                return rCandidate.count() - 1L;
-            }
-            else
-            {
-                return nIndex;
-            }
-        }
-
         sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const B3DPolygon& rCandidate)
         {
             OSL_ENSURE(nIndex < rCandidate.count(), "getIndexOfPredecessor: Access to polygon out 
of range (!)");
@@ -108,18 +88,6 @@ namespace basegfx
             return rCandidate.getNormal();
         }
 
-        B3DVector getPositiveOrientedNormal(const B3DPolygon& rCandidate)
-        {
-            B3DVector aRetval(rCandidate.getNormal());
-
-            if(ORIENTATION_NEGATIVE == getOrientation(rCandidate))
-            {
-                aRetval = -aRetval;
-            }
-
-            return aRetval;
-        }
-
         B2VectorOrientation getOrientation(const B3DPolygon& rCandidate)
         {
             B2VectorOrientation eRetval(ORIENTATION_NEUTRAL);
@@ -206,24 +174,6 @@ namespace basegfx
             return fRetval;
         }
 
-        double getArea(const B3DPolygon& rCandidate)
-        {
-            double fRetval(0.0);
-
-            if(rCandidate.count() > 2)
-            {
-                fRetval = getSignedArea(rCandidate);
-                const double fZero(0.0);
-
-                if(fTools::less(fRetval, fZero))
-                {
-                    fRetval = -fRetval;
-                }
-            }
-
-            return fRetval;
-        }
-
         double getEdgeLength(const B3DPolygon& rCandidate, sal_uInt32 nIndex)
         {
             OSL_ENSURE(nIndex < rCandidate.count(), "getEdgeLength: Access to polygon out of range 
(!)");
@@ -366,19 +316,6 @@ namespace basegfx
             return aRetval;
         }
 
-        B3DPoint getPositionRelative(const B3DPolygon& rCandidate, double fDistance, double 
fLength)
-        {
-            // get length if not given
-            if(fTools::equalZero(fLength))
-            {
-                fLength = getLength(rCandidate);
-            }
-
-            // multiply fDistance with real length to get absolute position and
-            // use getPositionAbsolute
-            return getPositionAbsolute(rCandidate, fDistance * fLength, fLength);
-        }
-
         void applyLineDashing(const B3DPolygon& rCandidate, const ::std::vector<double>& 
rDotDashArray, B3DPolyPolygon* pLineTarget, B3DPolyPolygon* pGapTarget, double fDotDashLength)
         {
             const sal_uInt32 nPointCount(rCandidate.count());
@@ -823,46 +760,6 @@ namespace basegfx
             return false;
         }
 
-        bool isInEpsilonRange(const B3DPolygon& rCandidate, const B3DPoint& rTestPosition, double 
fDistance)
-        {
-            const sal_uInt32 nPointCount(rCandidate.count());
-
-            if(nPointCount)
-            {
-                const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? nPointCount : nPointCount - 
1L);
-                B3DPoint aCurrent(rCandidate.getB3DPoint(0));
-
-                if(nEdgeCount)
-                {
-                    // edges
-                    for(sal_uInt32 a(0); a < nEdgeCount; a++)
-                    {
-                        const sal_uInt32 nNextIndex((a + 1) % nPointCount);
-                        const B3DPoint aNext(rCandidate.getB3DPoint(nNextIndex));
-
-                        if(isInEpsilonRange(aCurrent, aNext, rTestPosition, fDistance))
-                        {
-                            return true;
-                        }
-
-                        // prepare next step
-                        aCurrent = aNext;
-                    }
-                }
-                else
-                {
-                    // no edges, but points -> not closed. Check single point. Just
-                    // use isInEpsilonRange with twice the same point, it handles those well
-                    if(isInEpsilonRange(aCurrent, aCurrent, rTestPosition, fDistance))
-                    {
-                        return true;
-                    }
-                }
-            }
-
-            return false;
-        }
-
         bool isInside(const B3DPolygon& rCandidate, const B3DPoint& rPoint, bool bWithBorder)
         {
             if(bWithBorder && isPointOnPolygon(rCandidate, rPoint, true))
@@ -1015,23 +912,6 @@ namespace basegfx
             }
         }
 
-        bool isInside(const B3DPolygon& rCandidate, const B3DPolygon& rPolygon, bool bWithBorder)
-        {
-            const sal_uInt32 nPointCount(rPolygon.count());
-
-            for(sal_uInt32 a(0L); a < nPointCount; a++)
-            {
-                const B3DPoint aTestPoint(rPolygon.getB3DPoint(a));
-
-                if(!isInside(rCandidate, aTestPoint, bWithBorder))
-                {
-                    return false;
-                }
-            }
-
-            return true;
-        }
-
         bool isPointOnLine(const B3DPoint& rStart, const B3DPoint& rEnd, const B3DPoint& 
rCandidate, bool bWithPoints)
         {
             if(rCandidate.equal(rStart) || rCandidate.equal(rEnd))
@@ -1141,25 +1021,6 @@ namespace basegfx
             return false;
         }
 
-        bool getCutBetweenLineAndPolygon(const B3DPolygon& rCandidate, const B3DPoint& rEdgeStart, 
const B3DPoint& rEdgeEnd, double& fCut)
-        {
-            const sal_uInt32 nPointCount(rCandidate.count());
-
-            if(nPointCount > 2 && !rEdgeStart.equal(rEdgeEnd))
-            {
-                const B3DVector aPlaneNormal(rCandidate.getNormal());
-
-                if(!aPlaneNormal.equalZero())
-                {
-                    const B3DPoint aPointOnPlane(rCandidate.getB3DPoint(0));
-
-                    return getCutBetweenLineAndPlane(aPlaneNormal, aPointOnPlane, rEdgeStart, 
rEdgeEnd, fCut);
-                }
-            }
-
-            return false;
-        }
-
         //////////////////////////////////////////////////////////////////////
         // comparators with tolerance for 3D Polygons
 
@@ -1186,13 +1047,6 @@ namespace basegfx
             return true;
         }
 
-        bool equal(const B3DPolygon& rCandidateA, const B3DPolygon& rCandidateB)
-        {
-            const double fSmallValue(fTools::getSmallValue());
-
-            return equal(rCandidateA, rCandidateB, fSmallValue);
-        }
-
         // snap points of horizontal or vertical edges to discrete values
         B3DPolygon snapPointsOfHorizontalOrVerticalEdges(const B3DPolygon& rCandidate)
         {
-- 
1.7.9


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.