summaryrefslogtreecommitdiff
path: root/basegfx/inc/basegfx/polygon
diff options
context:
space:
mode:
authorArmin Weiss <aw@openoffice.org>2003-11-05 11:25:58 +0000
committerArmin Weiss <aw@openoffice.org>2003-11-05 11:25:58 +0000
commitc3663a687ccc9365b2b4eb4a3950b8d94c2d6ea7 (patch)
treec47ce5e59d718d5f772121000a356ef523662b17 /basegfx/inc/basegfx/polygon
parent571971699571e0baf9710ddf076ebf27aebb548d (diff)
Added PolyPolygonTools, Added PolygonTool functionality, changed bool to sal_Bool
Diffstat (limited to 'basegfx/inc/basegfx/polygon')
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolygon.hxx21
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolygontools.hxx67
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx29
3 files changed, 88 insertions, 29 deletions
diff --git a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx
index ec13b1b3b69b..60d1219d431a 100644
--- a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx
+++ b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolygon.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:05:58 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -81,11 +81,6 @@ namespace basegfx
{
class B2DPoint;
} // end of namespace point
-
- namespace vector
- {
- class B2DVector;
- } // end of namespace vector
} // end of namespace basegfx
//////////////////////////////////////////////////////////////////////////////
@@ -149,8 +144,18 @@ namespace basegfx
sal_Bool isClosed() const;
void setClosed(sal_Bool bNew);
- // flip polygon
+ // flip polygon direction
void flip();
+
+ // test if Polygon has double points
+ sal_Bool hasDoublePoints() const;
+
+ // remove double points, at the begin/end and follow-ups, too
+ void removeDoublePoints();
+
+ // isInside tests for B2dPoint and other B2dPolygon. On border is not inside.
+ sal_Bool isInside(const point::B2DPoint& rPoint);
+ sal_Bool isInside(const B2DPolygon& rPolygon);
};
} // end of namespace polygon
} // end of namespace basegfx
diff --git a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx
index ac9e2b1f90d8..f3a7601f0f78 100644
--- a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx
+++ b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolygontools.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:05:59 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -84,6 +84,11 @@ namespace basegfx
class B2DPolygon;
} // end of namespace polygon
+ namespace range
+ {
+ class B2DRange;
+ } // end of namespace range
+
namespace polygon
{
namespace tools
@@ -99,29 +104,57 @@ namespace basegfx
*/
void checkClosed(polygon::B2DPolygon& rCandidate);
- // Checks if one of the control vectors is used
- bool isEdgeBezier(const polygon::B2DPolygon& rPolygon, sal_uInt32 nEdgeIndex);
+ // Get index of outmost point (e.g. biggest X and biggest Y)
+ sal_uInt32 getIndexOfOutmostPoint(const polygon::B2DPolygon& rCandidate);
+
+ // Get successor and predecessor indices. Returning the same index means there
+ // is none. Same for successor.
+ sal_uInt32 getIndexOfPredecessor(sal_uInt32 nIndex, const polygon::B2DPolygon& rCandidate);
+ sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const polygon::B2DPolygon& rCandidate);
+
+ // Get index of first different predecessor. Returning the same index means there
+ // is none. Same for successor.
+ sal_uInt32 getIndexOfDifferentPredecessor(sal_uInt32 nIndex, const polygon::B2DPolygon& rCandidate);
+ sal_uInt32 getIndexOfDifferentSuccessor(sal_uInt32 nIndex, const polygon::B2DPolygon& rCandidate);
+
+ // Get orientation of Polygon
+ ::basegfx::vector::B2DVectorOrientation getOrientation(const ::basegfx::polygon::B2DPolygon& rCandidate);
+
+ // isInside tests for B2dPoint and other B2dPolygon. On border is not inside.
+ sal_Bool isInside(const ::basegfx::polygon::B2DPolygon& rCandidate, const ::basegfx::point::B2DPoint& rPoint);
+ sal_Bool isInside(const ::basegfx::polygon::B2DPolygon& rCandidate, const ::basegfx::polygon::B2DPolygon& rPolygon);
+
+ // get size of polygon
+ ::basegfx::range::B2DRange getRange(const ::basegfx::polygon::B2DPolygon& rCandidate);
- // Checks if usage of the control vectors is only for trivial cubic bezier.
- bool isEdgeTrivialBezier(const polygon::B2DPolygon& rPolygon, sal_uInt32 nEdgeIndex);
+ // get area of polygon
+ double getArea(const ::basegfx::polygon::B2DPolygon& rCandidate);
+
+ // get length of polygon edge from point nIndex to nIndex + 1
+ double getEdgeLength(const ::basegfx::polygon::B2DPolygon& rCandidate, sal_uInt32 nIndex);
+
+ // get length of polygon
+ double getLength(const ::basegfx::polygon::B2DPolygon& rCandidate);
+
+ // get position on polygon for absolute given distance. If
+ // length is given, it is assumed the correct polygon length, if 0.0 it is calculated
+ // using getLength(...)
+ ::basegfx::point::B2DPoint getPositionAbsolute(const ::basegfx::polygon::B2DPolygon& 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::point::B2DPoint getPositionRelative(const ::basegfx::polygon::B2DPolygon& rCandidate, double fDistance, double fLength = 0.0);
+
+ // get orientation at given polygon point
+ ::basegfx::vector::B2DVectorOrientation getPointOrientation(const ::basegfx::polygon::B2DPolygon& rCandidate, sal_uInt32 nIndex);
/* Still missing:
- BOOL isClockwise(const Vector3D &rNormal) const;
- void removeDoublePoints();
void transform(const Matrix4D& rTfMatrix);
- BOOL isInside(const Vector3D& rPnt, BOOL bWithBorder=FALSE) const;
- BOOL isInside(const Polygon3D& rPoly, BOOL bWithBorder=TRUE) const;
- Volume3D getPolySize() const;
- double getPolyArea() const;
- double getLength() const;
- BOOL getPointOrientation(UINT16 nIndex) const;
- Vector3D getPosition(double fPos) const;
Polygon3D getExpandedPolygon(sal_uInt32 nNum);
*/
-
-
} // end of namespace tools
} // end of namespace polygon
} // end of namespace basegfx
diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx
index 565e024cf1c3..b54d067ec78c 100644
--- a/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx
+++ b/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolypolygon.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:06:00 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -75,6 +75,11 @@ namespace basegfx
{
class B2DPolygon;
} // end of namespace polygon
+
+ namespace vector
+ {
+ enum B2DVectorOrientation;
+ } // end of namespace vector
} // end of namespace basegfx
//////////////////////////////////////////////////////////////////////////////
@@ -101,8 +106,8 @@ namespace basegfx
B2DPolyPolygon& operator=(const B2DPolyPolygon& rPolyPolygon);
// compare operators
- bool operator==(const B2DPolyPolygon& rPolyPolygon) const;
- bool operator!=(const B2DPolyPolygon& rPolyPolygon) const;
+ sal_Bool operator==(const B2DPolyPolygon& rPolyPolygon) const;
+ sal_Bool operator!=(const B2DPolyPolygon& rPolyPolygon) const;
// polygon interface
sal_uInt32 count() const;
@@ -123,6 +128,22 @@ namespace basegfx
// reset to empty state
void clear();
+
+ // closed state
+ sal_Bool isClosed() const;
+ void setClosed(sal_Bool bNew);
+
+ // Check and evtl. correct orientations of contained Polygons
+ ::basegfx::vector::B2DVectorOrientation checkOrientations();
+
+ // flip polygon direction
+ void flip();
+
+ // test if PolyPolygon has double points
+ sal_Bool hasDoublePoints() const;
+
+ // remove double points, at the begin/end and follow-ups, too
+ void removeDoublePoints();
};
} // end of namespace polygon
} // end of namespace basegfx