[Scummvm-cvs-logs] SF.net SVN: scummvm:[55477] scummvm/trunk/engines/sword25/math
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Sun Jan 23 20:02:37 CET 2011
Revision: 55477
http://scummvm.svn.sourceforge.net/scummvm/?rev=55477&view=rev
Author: thebluegr
Date: 2011-01-23 19:02:36 +0000 (Sun, 23 Jan 2011)
Log Message:
-----------
SWORD25: Removed several unused methods from the Polygon class
Modified Paths:
--------------
scummvm/trunk/engines/sword25/math/polygon.cpp
scummvm/trunk/engines/sword25/math/polygon.h
Modified: scummvm/trunk/engines/sword25/math/polygon.cpp
===================================================================
--- scummvm/trunk/engines/sword25/math/polygon.cpp 2011-01-23 19:00:35 UTC (rev 55476)
+++ scummvm/trunk/engines/sword25/math/polygon.cpp 2011-01-23 19:02:36 UTC (rev 55477)
@@ -91,7 +91,6 @@
// Calculate properties of the polygon
_isCW = computeIsCW();
- _isConvex = computeIsConvex();
_centroid = computeCentroid();
return true;
@@ -103,11 +102,6 @@
bool Polygon::isCW() const {
return _isCW;
}
-
-bool Polygon::isCCW() const {
- return !isCW();
-}
-
bool Polygon::computeIsCW() const {
if (vertexCount) {
// Find the vertex on extreme bottom right
@@ -147,51 +141,6 @@
return -1;
}
-
-// Testing for Convex / Concave
-// ------------------------
-
-bool Polygon::isConvex() const {
- return _isConvex;
-}
-
-bool Polygon::isConcave() const {
- return !isConvex();
-}
-
-bool Polygon::computeIsConvex() const {
- // Polygons with three or less vertices can only be convex
- if (vertexCount <= 3) return true;
-
- // All angles in the polygon computed will have the same direction sign if the polygon is convex
- int flag = 0;
- for (int i = 0; i < vertexCount; i++) {
- // Determine the next two vertecies to check
- int j = (i + 1) % vertexCount;
- int k = (i + 2) % vertexCount;
-
- // Calculate the cross product of the three vertecies
- int cross = crossProduct(vertices[i], vertices[j], vertices[k]);
-
- // The lower two bits of the flag represent the following:
- // 0: negative angle occurred
- // 1: positive angle occurred
-
- // The sign of the current angle is recorded in Flag
- if (cross < 0)
- flag |= 1;
- else if (cross > 0)
- flag |= 2;
-
- // If flag is 3, there are both positive and negative angles; so the polygon is concave
- if (flag == 3)
- return false;
- }
-
- // Polygon is convex
- return true;
-}
-
// Make a determine vertex order
// -----------------------------
@@ -199,12 +148,6 @@
if (!isCW())
reverseVertexOrder();
}
-
-void Polygon::ensureCCWOrder() {
- if (!isCCW())
- reverseVertexOrder();
-}
-
// Reverse the order of vertecies
// ------------------------------
@@ -227,15 +170,6 @@
return (v2.x - v1.x) * (v3.y - v2.y) -
(v2.y - v1.y) * (v3.x - v2.x);
}
-
-// Scalar Product
-// --------------
-
-int Polygon::dotProduct(const Vertex &v1, const Vertex &v2, const Vertex &v3) const {
- return (v1.x - v2.x) * (v3.x - v2.x) +
- (v1.y - v2.y) * (v3.x - v2.y);
-}
-
// Check for self-intersections
// ----------------------------
Modified: scummvm/trunk/engines/sword25/math/polygon.h
===================================================================
--- scummvm/trunk/engines/sword25/math/polygon.h 2011-01-23 19:00:35 UTC (rev 55476)
+++ scummvm/trunk/engines/sword25/math/polygon.h 2011-01-23 19:02:36 UTC (rev 55477)
@@ -114,20 +114,6 @@
bool isCCW() const;
/**
- * Checks whether the polygon is convex.
- * @return Returns true if the polygon is convex. Returns false if the polygon is concave.
- * @remark This method only returns a meaningful result if the polygon has at least three Vertecies.
- */
- bool isConvex() const;
-
- /**
- * Checks whether the polygon is concave.
- * @return Returns true if the polygon is concave. Returns false if the polygon is convex.
- * @remark This method only returns a meaningful result if the polygon has at least three Vertecies.
- */
- bool isConcave() const;
-
- /**
* Checks whether a point is inside the polygon
* @param Vertex A Vertex with the co-ordinates of the point to be tested.
* @param BorderBelongsToPolygon Specifies whether the edge of the polygon should be considered
@@ -200,7 +186,6 @@
private:
bool _isCW;
- bool _isConvex;
Vertex _centroid;
/**
@@ -216,12 +201,6 @@
bool computeIsCW() const;
/**
- * Determines whether the polygon is convex or concave.
- * @return Returns true if the polygon is convex, otherwise false.
- */
- bool computeIsConvex() const;
-
- /**
* Calculates the cross product of three Vertecies
* @param V1 The first Vertex
* @param V2 The second Vertex
@@ -232,19 +211,6 @@
int crossProduct(const Vertex &v1, const Vertex &v2, const Vertex &v3) const;
/**
- * Computes the scalar product of two vectors spanning three vertecies
- *
- * The vectors are spanned by V2->V1 and V2->V3
- *
- * @param V1 The first Vertex
- * @param V2 The second Vertex
- * @param V3 The third Vertex
- * @return Returns the dot product of the three Vertecies.
- * @todo This method would be better as a method of the BS_Vertex class
- */
- int dotProduct(const Vertex &v1, const Vertex &v2, const Vertex &v3) const;
-
- /**
* Checks whether the polygon is self-intersecting
* @return Returns true if the polygon is self-intersecting.
* Returns false if the polygon is not self-intersecting.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list