[cig-commits] r13258 - in long/3D/Gale/trunk: . src/StGermain/Discretisation/Shape/src
walter at geodynamics.org
walter at geodynamics.org
Tue Nov 4 13:51:29 PST 2008
Author: walter
Date: 2008-11-04 13:51:29 -0800 (Tue, 04 Nov 2008)
New Revision: 13258
Modified:
long/3D/Gale/trunk/
long/3D/Gale/trunk/src/StGermain/Discretisation/Shape/src/PolygonShape.c
Log:
r2370 at earth: boo | 2008-11-04 13:46:09 -0800
Make polygons use CentreXYZ and rotations
Property changes on: long/3D/Gale/trunk
___________________________________________________________________
Name: svk:merge
- 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:2368
+ 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:2370
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Shape/src/PolygonShape.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Shape/src/PolygonShape.c 2008-11-04 21:02:08 UTC (rev 13257)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Shape/src/PolygonShape.c 2008-11-04 21:51:29 UTC (rev 13258)
@@ -291,7 +291,7 @@
* Algorithm works by summing the angles between the test coordinate and each pair of verticies that make up an edge
* in the polygon. An inside point will give an angle of 2pi and and outside point will give an angle of 0 */
-Bool _PolygonShape_IsCoordInside( void* polygon, Coord testCoord ) {
+Bool _PolygonShape_IsCoordInside( void* polygon, Coord coord ) {
PolygonShape* self = (PolygonShape*) polygon;
Index vertexCount = self->vertexCount;
Coord_List vertexList = self->vertexList;
@@ -303,9 +303,13 @@
Index vertex_I;
double* startVertex;
double* endVertex;
+ Coord newCoord;
+ /* Transform coordinate into canonical reference frame */
+ Stg_Shape_TransformCoord( self, coord, newCoord );
+
/* Check to make sure that the coordinate is within startZ and endZ in 3D */
- if ( self->dim == 3 && ( testCoord[ K_AXIS ] < self->startZ || testCoord[ K_AXIS ] > self->endZ ))
+ if ( self->dim == 3 && ( newCoord[ K_AXIS ] < self->startZ || newCoord[ K_AXIS ] > self->endZ ))
return False;
for ( vertex_I = 0 ; vertex_I < vertexCount ; vertex_I++ ) {
@@ -314,8 +318,8 @@
endVertex = vertexList[ (vertex_I + 1) % vertexCount ];
/* Work out vectors */
- StGermain_VectorSubtraction( vectorToStartVertex, testCoord, startVertex, 2 );
- StGermain_VectorSubtraction( vectorToEndVertex, testCoord, endVertex, 2 );
+ StGermain_VectorSubtraction( vectorToStartVertex, newCoord, startVertex, 2 );
+ StGermain_VectorSubtraction( vectorToEndVertex, newCoord, endVertex, 2 );
/* Work out angle - just by doing dot product - will always be positive */
currAngle = StGermain_AngleBetweenVectors( vectorToStartVertex, vectorToEndVertex, 2 );
More information about the CIG-COMMITS
mailing list