[cig-commits] commit:
Mercurial
hg at geodynamics.org
Mon Nov 24 11:58:36 PST 2008
changeset: 60:6b2e4dd7c9d3
user: JulianGiordani
date: Mon Mar 17 02:42:10 2008 +0000
files: Shape/src/BelowCosinePlane.c Shape/src/BelowCosinePlane.h Shape/src/BelowPlane.c Shape/src/BelowPlane.h Shape/src/Box.c Shape/src/Box.h Shape/src/ConvexHull.c Shape/src/ConvexHull.h Shape/src/Cylinder.c Shape/src/Cylinder.h Shape/src/Everywhere.c Shape/src/Everywhere.h Shape/src/Intersection.c Shape/src/Intersection.h Shape/src/PolygonShape.c Shape/src/PolygonShape.h Shape/src/PythonShape.c Shape/src/PythonShape.h Shape/src/ShapeClass.c Shape/src/ShapeClass.h Shape/src/Sphere.c Shape/src/Sphere.h Shape/src/Superellipsoid.c Shape/src/Superellipsoid.h Shape/src/Union.c Shape/src/Union.h
description:
Adding a new method to the Shape class to calculate the _DistanceFromCenterAxis. This function only applies to the Cylinder and Sphere(2D) class at present.
In the future I'll generalise this method to just be DistanceFromCenter, with the option of calculating _DistanceFromCenterAxis for 2D shapes that are just extended into a 3th dim.
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/BelowCosinePlane.c
--- a/Shape/src/BelowCosinePlane.c Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/BelowCosinePlane.c Mon Mar 17 02:42:10 2008 +0000
@@ -96,6 +96,7 @@ BelowCosinePlane* _BelowCosinePlane_New(
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name )
{
BelowCosinePlane* self;
@@ -116,12 +117,14 @@ BelowCosinePlane* _BelowCosinePlane_New(
_destroy,
_isCoordInside,
_calculateVolume,
+ _distanceFromCenterAxis,
name );
/* General info */
/* Virtual Info */
self->_isCoordInside = _isCoordInside;
+ self->_distanceFromCenterAxis = _distanceFromCenterAxis;
return self;
}
@@ -206,6 +209,7 @@ void* _BelowCosinePlane_DefaultNew( Name
_BelowCosinePlane_Destroy,
_BelowCosinePlane_IsCoordInside,
_BelowCosinePlane_CalculateVolume,
+ _BelowCosinePlane_DistanceFromCenterAxis,
name );
}
@@ -292,4 +296,10 @@ double _BelowCosinePlane_CalculateVolume
return volume;
}
-
+void _BelowCosinePlane_DistanceFromCenterAxis( void* shape, Coord coord, double* disVec ) {
+ Stg_Shape* self = (Stg_Shape*)shape;
+ Journal_Firewall( False, Journal_Register( Error_Type, self->type ),
+ "Error in function %s: This functions hasn't been implemented.",
+ "Please inform uderworld-dev at vpac.org you've received this error.\n", __func__ );
+}
+
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/BelowCosinePlane.h
--- a/Shape/src/BelowCosinePlane.h Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/BelowCosinePlane.h Mon Mar 17 02:42:10 2008 +0000
@@ -72,6 +72,7 @@
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name );
void _BelowCosinePlane_Init( void* belowPlane, double offset, XYZ width, double amplitude, double period, double phase ) ;
@@ -109,6 +110,8 @@
Bool _BelowCosinePlane_IsCoordInside( void* belowPlane, Coord coord ) ;
double _BelowCosinePlane_CalculateVolume( void* belowPlane );
+ void _BelowCosinePlane_DistanceFromCenterAxis( void* shape, Coord coord, double* disVec );
+
/*---------------------------------------------------------------------------------------------------------------------
** Public member functions
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/BelowPlane.c
--- a/Shape/src/BelowPlane.c Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/BelowPlane.c Mon Mar 17 02:42:10 2008 +0000
@@ -89,6 +89,7 @@ BelowPlane* _BelowPlane_New(
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name )
{
BelowPlane* self;
@@ -109,13 +110,14 @@ BelowPlane* _BelowPlane_New(
_destroy,
_isCoordInside,
_calculateVolume,
+ _distanceFromCenterAxis,
name );
/* General info */
/* Virtual Info */
self->_isCoordInside = _isCoordInside;
-
+ self->_distanceFromCenterAxis = _distanceFromCenterAxis;
return self;
}
@@ -196,6 +198,7 @@ void* _BelowPlane_DefaultNew( Name name
_BelowPlane_Destroy,
_BelowPlane_IsCoordInside,
_BelowPlane_CalculateVolume,
+ _BelowPlane_DistanceFromCenterAxis,
name );
}
@@ -282,3 +285,10 @@ double _BelowPlane_CalculateVolume( void
return volume;
}
+void _BelowPlane_DistanceFromCenterAxis( void* shape, Coord coord, double* disVec ){
+ Stg_Shape* self = (Stg_Shape*)shape;
+ Journal_Firewall( False, Journal_Register( Error_Type, self->type ),
+ "Error in function %s: This functions hasn't been implemented.",
+ "Please inform uderworld-dev at vpac.org you've received this error.\n", __func__ );
+}
+
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/BelowPlane.h
--- a/Shape/src/BelowPlane.h Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/BelowPlane.h Mon Mar 17 02:42:10 2008 +0000
@@ -73,6 +73,7 @@
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name );
void _BelowPlane_Init( void* belowPlane, double offset, XYZ width, XYZ minValue, XYZ maxValue ) ;
@@ -107,6 +108,7 @@
Bool _BelowPlane_IsCoordInside( void* belowPlane, Coord coord ) ;
double _BelowPlane_CalculateVolume( void* belowPlane );
+ void _BelowPlane_DistanceFromCenterAxis( void* shape, Coord coord, double* disVec );
/*---------------------------------------------------------------------------------------------------------------------
** Public member functions
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/Box.c
--- a/Shape/src/Box.c Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/Box.c Mon Mar 17 02:42:10 2008 +0000
@@ -83,6 +83,7 @@ Box* _Box_New(
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name )
{
Box* self;
@@ -103,25 +104,28 @@ Box* _Box_New(
_destroy,
_isCoordInside,
_calculateVolume,
+ _distanceFromCenterAxis,
name );
/* General info */
/* Virtual Info */
self->_isCoordInside = _isCoordInside;
+ self->_calculateVolume = _calculateVolume;
+ self->_distanceFromCenterAxis = _distanceFromCenterAxis;
return self;
}
-void _Box_Init( void* box, XYZ width ) {
- Box* self = (Box*)box;
+void _Box_Init( void* shape, XYZ width ) {
+ Box* self = (Box*)shape;
memcpy( self->width, width, sizeof(XYZ));
}
void Box_InitAll(
- void* box,
+ void* shape,
Dimension_Index dim,
Coord centre,
double alpha,
@@ -129,7 +133,7 @@ void Box_InitAll(
double gamma,
XYZ width)
{
- Box* self = (Box*)box;
+ Box* self = (Box*)shape;
Stg_Shape_InitAll( self, dim, centre, alpha, beta, gamma );
_Box_Init( self, width );
@@ -140,16 +144,16 @@ void Box_InitAll(
** Virtual functions
*/
-void _Box_Delete( void* box ) {
- Box* self = (Box*)box;
+void _Box_Delete( void* shape ) {
+ Box* self = (Box*)shape;
/* Delete parent */
_Stg_Shape_Delete( self );
}
-void _Box_Print( void* box, Stream* stream ) {
- Box* self = (Box*)box;
+void _Box_Print( void* shape, Stream* stream ) {
+ Box* self = (Box*)shape;
/* Print parent */
_Stg_Shape_Print( self, stream );
@@ -157,8 +161,8 @@ void _Box_Print( void* box, Stream* stre
-void* _Box_Copy( void* box, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
- Box* self = (Box*)box;
+void* _Box_Copy( void* shape, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+ Box* self = (Box*)shape;
Box* newBox;
newBox = (Box*)_Stg_Shape_Copy( self, dest, deep, nameExt, ptrMap );
@@ -183,12 +187,13 @@ void* _Box_DefaultNew( Name name ) {
_Box_Destroy,
_Box_IsCoordInside,
_Box_CalculateVolume,
+ _Box_DistanceFromCenterAxis,
name );
}
-void _Box_Construct( void* box, Stg_ComponentFactory* cf, void* data ) {
- Box* self = (Box*) box;
+void _Box_Construct( void* shape, Stg_ComponentFactory* cf, void* data ) {
+ Box* self = (Box*) shape;
Dictionary* dictionary = Dictionary_GetDictionary( cf->componentDict, self->name );
XYZ width;
double start, end;
@@ -227,23 +232,23 @@ void _Box_Construct( void* box, Stg_Comp
_Box_Init( self, width );
}
-void _Box_Build( void* box, void* data ) {
- Box* self = (Box*)box;
+void _Box_Build( void* shape, void* data ) {
+ Box* self = (Box*)shape;
_Stg_Shape_Build( self, data );
}
-void _Box_Initialise( void* box, void* data ) {
- Box* self = (Box*)box;
+void _Box_Initialise( void* shape, void* data ) {
+ Box* self = (Box*)shape;
_Stg_Shape_Initialise( self, data );
}
-void _Box_Execute( void* box, void* data ) {
- Box* self = (Box*)box;
+void _Box_Execute( void* shape, void* data ) {
+ Box* self = (Box*)shape;
_Stg_Shape_Execute( self, data );
}
-void _Box_Destroy( void* box, void* data ) {
- Box* self = (Box*)box;
+void _Box_Destroy( void* shape, void* data ) {
+ Box* self = (Box*)shape;
_Stg_Shape_Destroy( self, data );
}
@@ -256,8 +261,8 @@ void _Box_Destroy( void* box, void* data
** Private Member functions
*/
-Bool _Box_IsCoordInside( void* box, Coord coord ) {
- Box* self = (Box*)box;
+Bool _Box_IsCoordInside( void* shape, Coord coord ) {
+ Box* self = (Box*)shape;
Coord newCoord;
Dimension_Index dim_I;
@@ -271,8 +276,8 @@ Bool _Box_IsCoordInside( void* box, Coor
return True;
}
-double _Box_CalculateVolume( void* box ) {
- Box* self = (Box*)box;
+double _Box_CalculateVolume( void* shape ) {
+ Box* self = (Box*)shape;
Dimension_Index dim_I;
double result;
result = 1.0;
@@ -282,3 +287,11 @@ double _Box_CalculateVolume( void* box )
return result;
}
+void _Box_DistanceFromCenterAxis( void* shape, Coord coord, double* disVec ) {
+ /* To be implemented */
+ Stg_Shape* self = (Stg_Shape*)shape;
+ Journal_Firewall( False, Journal_Register( Error_Type, self->type ),
+ "Error in function %s: This functions hasn't been implemented.",
+ "Please inform uderworld-dev at vpac.org you've received this error.\n", __func__ );
+}
+
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/Box.h
--- a/Shape/src/Box.h Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/Box.h Mon Mar 17 02:42:10 2008 +0000
@@ -70,6 +70,7 @@
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name );
void _Box_Init( void* box, XYZ width ) ;
@@ -102,6 +103,7 @@
double _Box_CalculateVolume( void* box );
+ void _Box_DistanceFromCenterAxis( void* box, Coord coord, double* disVec );
/*---------------------------------------------------------------------------------------------------------------------
** Public member functions
*/
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/ConvexHull.c
--- a/Shape/src/ConvexHull.c Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/ConvexHull.c Mon Mar 17 02:42:10 2008 +0000
@@ -86,6 +86,7 @@ ConvexHull* _ConvexHull_New(
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name )
{
ConvexHull* self;
@@ -106,6 +107,7 @@ ConvexHull* _ConvexHull_New(
_destroy,
_isCoordInside,
_calculateVolume,
+ _distanceFromCenterAxis,
name );
/* General info */
@@ -253,6 +255,7 @@ void* _ConvexHull_DefaultNew( Name name
_ConvexHull_Destroy,
_ConvexHull_IsCoordInside,
_ConvexHull_CalculateVolume,
+ _ConvecHull_DistanceFromCenterAxis,
name );
}
@@ -354,5 +357,11 @@ double _ConvexHull_CalculateVolume( void
assert( 0 );
return 0.0;
}
-
-
+void _ConvecHull_DistanceFromCenterAxis( void* shape, Coord coord, double* disVec ) {
+ Stg_Shape* self = (Stg_Shape*)shape;
+ Journal_Firewall( False, Journal_Register( Error_Type, self->type ),
+ "Error in function %s: This functions hasn't been implemented.",
+ "Please inform uderworld-dev at vpac.org you've received this error.\n", __func__ );
+}
+
+
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/ConvexHull.h
--- a/Shape/src/ConvexHull.h Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/ConvexHull.h Mon Mar 17 02:42:10 2008 +0000
@@ -82,6 +82,7 @@
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name );
void _ConvexHull_Init( void* convexHull, Coord_List vertexList, Index vertexCount);
@@ -113,6 +114,7 @@
Bool _ConvexHull_IsCoordInside( void* convexHull, Coord coord ) ;
double _ConvexHull_CalculateVolume( void* convexHull );
+ void _ConvecHull_DistanceFromCenterAxis( void* self, Coord coord, double* disVec );
/*---------------------------------------------------------------------------------------------------------------------
** Public member functions
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/Cylinder.c
--- a/Shape/src/Cylinder.c Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/Cylinder.c Mon Mar 17 02:42:10 2008 +0000
@@ -89,6 +89,7 @@ Cylinder* _Cylinder_New(
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name )
{
Cylinder* self;
@@ -109,6 +110,7 @@ Cylinder* _Cylinder_New(
_destroy,
_isCoordInside,
_calculateVolume,
+ _distanceFromCenterAxis,
name );
/* General info */
@@ -196,6 +198,7 @@ void* _Cylinder_DefaultNew( Name name )
_Cylinder_Destroy,
_Cylinder_IsCoordInside,
_Cylinder_CalculateVolume,
+ _Cylinder_DistanceFromCenterAxis,
name );
}
@@ -299,6 +302,25 @@ Bool _Cylinder_IsCoordInside( void* cyli
return True;
}
+void _Cylinder_DistanceFromCenterAxis( void* cylinder, Coord coord, double* disVec ) {
+ Cylinder* self = (Cylinder*)cylinder;
+ Coord newCoord;
+
+ /* Transform coordinate into canonical reference frame */
+ Stg_Shape_TransformCoord( self, coord, newCoord );
+
+ newCoord[ self->perpendicularAxis ] = 0.0;
+
+ /* Check if coord is within radius */
+ disVec[0] = newCoord[ I_AXIS ];
+ disVec[1] = newCoord[ J_AXIS ];
+ if(self->dim == 3)
+ disVec[2] = newCoord[ K_AXIS ];
+
+ return;
+}
+
+
double _Cylinder_CalculateVolume( void* cylinder ) {
assert( 0 /* unsure how this cylinder is setup...but shouldn't be hard to implement -- Alan */ );
return 0.0;
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/Cylinder.h
--- a/Shape/src/Cylinder.h Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/Cylinder.h Mon Mar 17 02:42:10 2008 +0000
@@ -84,6 +84,7 @@
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name );
void _Cylinder_Init( Cylinder* self, double radius, XYZ start, XYZ end, Axis perpendicularAxis ) ;
@@ -116,6 +117,7 @@
void _Cylinder_Destroy( void* cylinder, void* data ) ;
Bool _Cylinder_IsCoordInside( void* cylinder, Coord coord ) ;
+ void _Cylinder_DistanceFromCenterAxis( void* cylinder, Coord coord, double* disVec );
double _Cylinder_CalculateVolume( void* cylinder );
/*---------------------------------------------------------------------------------------------------------------------
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/Everywhere.c
--- a/Shape/src/Everywhere.c Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/Everywhere.c Mon Mar 17 02:42:10 2008 +0000
@@ -78,6 +78,7 @@ Everywhere* _Everywhere_New(
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name )
{
Everywhere* self;
@@ -98,12 +99,14 @@ Everywhere* _Everywhere_New(
_destroy,
_isCoordInside,
_calculateVolume,
+ _distanceFromCenterAxis,
name );
/* General info */
/* Virtual Info */
self->_isCoordInside = _isCoordInside;
+ self->_distanceFromCenterAxis = _distanceFromCenterAxis;
return self;
}
@@ -169,6 +172,7 @@ void* _Everywhere_DefaultNew( Name name
_Everywhere_Destroy,
_Everywhere_IsCoordInside,
_Everywhere_CalculateVolume,
+ _Everywhere_DistanceFromCenterAxis,
name );
}
@@ -212,6 +216,12 @@ double _Everywhere_CalculateVolume( void
double _Everywhere_CalculateVolume( void* everywhere ) {
return 1.0;
}
+void _Everywhere_DistanceFromCenterAxis( void* shape, Coord coord, double* disVec ){
+ Stg_Shape* self = (Stg_Shape*)shape;
+ Journal_Firewall( False, Journal_Register( Error_Type, self->type ),
+ "Error in function %s: This functions hasn't been implemented.",
+ "Please inform uderworld-dev at vpac.org you've received this error.\n", __func__ );
+}
/*----------------------------------------------------------------------------------------------------------------------------------
** Private Functions
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/Everywhere.h
--- a/Shape/src/Everywhere.h Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/Everywhere.h Mon Mar 17 02:42:10 2008 +0000
@@ -73,6 +73,7 @@
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name );
void _Everywhere_Init( void* everywhere ) ;
@@ -102,6 +103,7 @@
Bool _Everywhere_IsCoordInside( void* everywhere, Coord coord ) ;
double _Everywhere_CalculateVolume( void* everywhere );
+ void _Everywhere_DistanceFromCenterAxis( void* shape, Coord coord, double* disVec );
/*---------------------------------------------------------------------------------------------------------------------
** Public member functions
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/Intersection.c
--- a/Shape/src/Intersection.c Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/Intersection.c Mon Mar 17 02:42:10 2008 +0000
@@ -88,6 +88,7 @@ Intersection* _Intersection_New(
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name )
{
Intersection* self;
@@ -108,12 +109,14 @@ Intersection* _Intersection_New(
_destroy,
_isCoordInside ,
_calculateVolume,
+ _distanceFromCenterAxis,
name );
/* General info */
/* Virtual Info */
self->_isCoordInside = _isCoordInside;
+ self->_distanceFromCenterAxis = _distanceFromCenterAxis;
return self;
}
@@ -207,6 +210,7 @@ void* _Intersection_DefaultNew( Name nam
_Intersection_Destroy,
_Intersection_IsCoordInside,
_Intersection_CalculateVolume,
+ _Intersection_DistanceFromCenterAxis,
name );
}
@@ -318,6 +322,12 @@ double _Intersection_CalculateVolume( vo
assert( 0 /* not impossible as long as you have other shapes with volum */ );
return 0.0;
}
+void _Intersection_DistanceFromCenterAxis( void* shape, Coord coord, double* disVec ){
+ Stg_Shape* self = (Stg_Shape*)shape;
+ Journal_Firewall( False, Journal_Register( Error_Type, self->type ),
+ "Error in function %s: This functions hasn't been implemented.",
+ "Please inform uderworld-dev at vpac.org you've received this error.\n", __func__ );
+}
/*----------------------------------------------------------------------------------------------------------------------------------
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/Intersection.h
--- a/Shape/src/Intersection.h Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/Intersection.h Mon Mar 17 02:42:10 2008 +0000
@@ -83,6 +83,7 @@
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name );
void _Intersection_Init( void* intersection, Stg_Shape** shapeList, Index shapeCount, Bool* isComplement ) ;
@@ -116,7 +117,7 @@
Bool _Intersection_IsCoordInside( void* intersection, Coord coord ) ;
double _Intersection_CalculateVolume( void* intersection );
-
+ void _Intersection_DistanceFromCenterAxis( void* shape, Coord coord, double* disVec );
/*---------------------------------------------------------------------------------------------------------------------
** Public member functions
*/
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/PolygonShape.c
--- a/Shape/src/PolygonShape.c Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/PolygonShape.c Mon Mar 17 02:42:10 2008 +0000
@@ -91,6 +91,7 @@ PolygonShape* _PolygonShape_New(
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name )
{
PolygonShape* self;
@@ -111,12 +112,14 @@ PolygonShape* _PolygonShape_New(
_destroy,
_isCoordInside ,
_calculateVolume,
+ _distanceFromCenterAxis,
name );
/* General info */
/* Virtual Info */
self->_isCoordInside = _isCoordInside;
+ self->_distanceFromCenterAxis = _distanceFromCenterAxis;
return self;
}
@@ -209,6 +212,7 @@ void* _PolygonShape_DefaultNew( Name nam
_PolygonShape_Destroy,
_PolygonShape_IsCoordInside,
_PolygonShape_CalculateVolume,
+ _PolygonShape_DistanceFromCenterAxis,
name );
}
@@ -379,3 +383,10 @@ double _PolygonShape_CalculateVolume( vo
assert( 0 );
return 0.0;
}
+
+void _PolygonShape_DistanceFromCenterAxis( void* shape, Coord coord, double* disVec ){
+ Stg_Shape* self = (Stg_Shape*)shape;
+ Journal_Firewall( False, Journal_Register( Error_Type, self->type ),
+ "Error in function %s: This functions hasn't been implemented.",
+ "Please inform uderworld-dev at vpac.org you've received this error.\n", __func__ );
+}
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/PolygonShape.h
--- a/Shape/src/PolygonShape.h Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/PolygonShape.h Mon Mar 17 02:42:10 2008 +0000
@@ -87,6 +87,7 @@
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name );
void _PolygonShape_Init( void* polygon, Coord_List vertexList, Index vertexCount, XYZ start, XYZ end, Axis perpendicular ) ;
@@ -122,6 +123,7 @@
Bool _PolygonShape_IsCoordInside( void* polygon, Coord coord ) ;
double _PolygonShape_CalculateVolume( void* polygon );
+ void _PolygonShape_DistanceFromCenterAxis( void* shape, Coord coord, double* disVec );
/*---------------------------------------------------------------------------------------------------------------------
** Public member functions
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/PythonShape.c
--- a/Shape/src/PythonShape.c Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/PythonShape.c Mon Mar 17 02:42:10 2008 +0000
@@ -89,6 +89,7 @@ PythonShape* _PythonShape_New(
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxis* _distanceFromCenterAxis,
Name name )
{
PythonShape* self;
@@ -109,6 +110,7 @@ PythonShape* _PythonShape_New(
_destroy,
_isCoordInside ,
_calculateVolume,
+ _distanceFromCenterAxis,
name );
/* General info */
@@ -193,6 +195,7 @@ void* _PythonShape_DefaultNew( Name name
_PythonShape_Destroy,
_PythonShape_IsCoordInside,
_PythonShape_CalculateVolume,
+ _PythonShape_DistanceFromCenterAxis,
name );
}
@@ -274,5 +277,11 @@ double _PythonShape_CalculateVolume( voi
assert( 0 );
return 0.0;
}
+void _PythonShape_DistanceFromCenterAxis( void* shape, Coord coord, double* disVec ){
+ Stg_Shape* self = (Stg_Shape*)shape;
+ Journal_Firewall( False, Journal_Register( Error_Type, self->type ),
+ "Error in function %s: This functions hasn't been implemented.",
+ "Please inform uderworld-dev at vpac.org you've received this error.\n", __func__ );
+}
#endif /* HAVE_PYTHON */
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/PythonShape.h
--- a/Shape/src/PythonShape.h Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/PythonShape.h Mon Mar 17 02:42:10 2008 +0000
@@ -81,6 +81,7 @@
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxis* _distanceFromCenterAxis,
Name name );
void _PythonShape_Init( void* pythonShape, char* conditionFunction ) ;
@@ -111,6 +112,7 @@
Bool _PythonShape_IsCoordInside( void* pythonShape, Coord coord ) ;
double _PythonShape_CalculateVolume( void* pythonShape );
+ void _PythonShape_DistanceFromCenterAxis( void* shape, Coord coord, double* disVec );
/*---------------------------------------------------------------------------------------------------------------------
** Public member functions
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/ShapeClass.c
--- a/Shape/src/ShapeClass.c Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/ShapeClass.c Mon Mar 17 02:42:10 2008 +0000
@@ -61,6 +61,7 @@ Stg_Shape* _Stg_Shape_New(
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name )
{
Stg_Shape* self;
@@ -87,6 +88,7 @@ Stg_Shape* _Stg_Shape_New(
/* Virtual Info */
self->_isCoordInside = _isCoordInside;
self->_calculateVolume = _calculateVolume;
+ self->_distanceFromCenterAxis = _distanceFromCenterAxis,
self->invert = False;
@@ -238,6 +240,11 @@ double Stg_Shape_CalculateVolume( void*
}
}
+void Stg_Shape_DistanceFromCenterAxis( void* shape, Coord coord, double* disVec ) {
+ Stg_Shape* self = (Stg_Shape*)shape;
+
+ self->_distanceFromCenterAxis( self, coord, disVec );
+}
/*--------------------------------------------------------------------------------------------------------------------------
** Public Functions
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/ShapeClass.h
--- a/Shape/src/ShapeClass.h Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/ShapeClass.h Mon Mar 17 02:42:10 2008 +0000
@@ -41,6 +41,8 @@
typedef Bool (Stg_Shape_IsCoordInsideFunction) ( void* shape, Coord coord );
+ typedef void (Stg_Shape_DistanceFromCenterAxisFunction) ( void* shape, Coord coord, double* disVec );
+
typedef double (Stg_Shape_CalculateVolumeFunction) ( void* shape );
@@ -54,6 +56,7 @@
/* Virtual Info */ \
Stg_Shape_IsCoordInsideFunction* _isCoordInside; \
Stg_Shape_CalculateVolumeFunction* _calculateVolume; \
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis; \
/* Other info */ \
Dimension_Index dim; \
XYZ centre; \
@@ -80,6 +83,7 @@
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name );
void _Stg_Shape_Init( void* shape, Dimension_Index dim, Coord centre, Bool invert, double alpha, double beta, double gamma ) ;
@@ -107,6 +111,7 @@
Bool Stg_Shape_IsCoordInside( void* shape, Coord coord ) ;
double Stg_Shape_CalculateVolume( void* shape );
+ void Stg_Shape_DistanceFromCenterAxis( void* shape, Coord coord, double* disVec );
/*---------------------------------------------------------------------------------------------------------------------
** Public member functions
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/Sphere.c
--- a/Shape/src/Sphere.c Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/Sphere.c Mon Mar 17 02:42:10 2008 +0000
@@ -84,6 +84,7 @@ Sphere* _Sphere_New(
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name )
{
Sphere* self;
@@ -104,12 +105,15 @@ Sphere* _Sphere_New(
_destroy,
_isCoordInside ,
_calculateVolume,
+ _distanceFromCenterAxis,
name );
/* General info */
/* Virtual Info */
self->_isCoordInside = _isCoordInside;
+ self->_calculateVolume = _calculateVolume;
+ self->_distanceFromCenterAxis = _distanceFromCenterAxis;
return self;
}
@@ -184,6 +188,7 @@ void* _Sphere_DefaultNew( Name name ) {
_Sphere_Destroy,
_Sphere_IsCoordInside,
_Sphere_CalculateVolume,
+ _Sphere_DistanceFromCenterAxis,
name );
}
@@ -251,6 +256,20 @@ Bool _Sphere_IsCoordInside( void* sphere
}
+void _Sphere_DistanceFromCenterAxis( void* sphere, Coord coord, double* disVec ) {
+ Sphere* self = (Sphere*)sphere;
+ Coord newCoord;
+
+ /* Transform coordinate into canonical reference frame */
+ Stg_Shape_TransformCoord( self, coord, newCoord );
+
+ disVec[0] = newCoord[ I_AXIS ];
+ disVec[1] = newCoord[ J_AXIS ];
+ if( self->dim == 3 )
+ disVec[2] = newCoord[ K_AXIS ];
+}
+
+
double _Sphere_CalculateVolume( void* sphere ) {
Sphere* self = sphere;
if ( self->dim == 2 ) {
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/Sphere.h
--- a/Shape/src/Sphere.h Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/Sphere.h Mon Mar 17 02:42:10 2008 +0000
@@ -80,6 +80,7 @@
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name );
void _Sphere_Init( void* sphere, double radius ) ;
@@ -109,6 +110,7 @@
void _Sphere_Destroy( void* sphere, void* data ) ;
Bool _Sphere_IsCoordInside( void* sphere, Coord coord ) ;
+ void _Sphere_DistanceFromCenterAxis( void* sphere, Coord coord, double* disVec );
double _Sphere_CalculateVolume( void* sphere );
/*---------------------------------------------------------------------------------------------------------------------
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/Superellipsoid.c
--- a/Shape/src/Superellipsoid.c Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/Superellipsoid.c Mon Mar 17 02:42:10 2008 +0000
@@ -88,6 +88,7 @@ Superellipsoid* _Superellipsoid_New(
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name )
{
Superellipsoid* self;
@@ -108,12 +109,14 @@ Superellipsoid* _Superellipsoid_New(
_destroy,
_isCoordInside,
_calculateVolume,
+ _distanceFromCenterAxis,
name );
/* General info */
/* Virtual Info */
self->_isCoordInside = _isCoordInside;
+ self->_distanceFromCenterAxis = _distanceFromCenterAxis;
return self;
}
@@ -196,6 +199,7 @@ void* _Superellipsoid_DefaultNew( Name n
_Superellipsoid_Destroy,
_Superellipsoid_IsCoordInside,
_Superellipsoid_CalculateVolume,
+ _Superellipsoid_DistanceFromCenterAxis,
name );
}
@@ -277,4 +281,10 @@ double _Superellipsoid_CalculateVolume(
assert( 0 );
return 0.0;
}
-
+
+void _Superellipsoid_DistanceFromCenterAxis( void* shape, Coord coord, double* disVec ){
+ Stg_Shape* self = (Stg_Shape*)shape;
+ Journal_Firewall( False, Journal_Register( Error_Type, self->type ),
+ "Error in function %s: This functions hasn't been implemented.",
+ "Please inform uderworld-dev at vpac.org you've received this error.\n", __func__ );
+}
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/Superellipsoid.h
--- a/Shape/src/Superellipsoid.h Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/Superellipsoid.h Mon Mar 17 02:42:10 2008 +0000
@@ -83,6 +83,7 @@
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name );
void _Superellipsoid_Init( void* superellipsoid, double epsilon1, double epsilon2, XYZ radius ) ;
@@ -115,6 +116,7 @@
Bool _Superellipsoid_IsCoordInside( void* superellipsoid, Coord coord ) ;
double _Superellipsoid_CalculateVolume( void* superellipsoid );
+ void _Superellipsoid_DistanceFromCenterAxis( void* shape, Coord coord, double* disVec );
/*---------------------------------------------------------------------------------------------------------------------
** Public member functions
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/Union.c
--- a/Shape/src/Union.c Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/Union.c Mon Mar 17 02:42:10 2008 +0000
@@ -88,6 +88,7 @@ Union* _Union_New(
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name )
{
Union* self;
@@ -108,6 +109,7 @@ Union* _Union_New(
_destroy,
_isCoordInside ,
_calculateVolume,
+ _distanceFromCenterAxis,
name );
/* General info */
@@ -207,6 +209,7 @@ void* _Union_DefaultNew( Name name ) {
_Union_Destroy,
_Union_IsCoordInside,
_Union_CalculateVolume,
+ _Union_DistanceFromCenterAxis,
name );
}
@@ -319,4 +322,11 @@ double _Union_CalculateVolume( void* com
assert ( 0 );
return 0.0;
}
-
+
+void _Union_DistanceFromCenterAxis( void* shape, Coord coord, double* disVec ) {
+ Stg_Shape* self = (Stg_Shape*)shape;
+ Journal_Firewall( False, Journal_Register( Error_Type, self->type ),
+ "Error in function %s: This functions hasn't been implemented.",
+ "Please inform uderworld-dev at vpac.org you've received this error.\n", __func__ );
+}
+
diff -r 13109340d9cd -r 6b2e4dd7c9d3 Shape/src/Union.h
--- a/Shape/src/Union.h Sun Mar 16 23:21:04 2008 +0000
+++ b/Shape/src/Union.h Mon Mar 17 02:42:10 2008 +0000
@@ -83,6 +83,7 @@
Stg_Component_DestroyFunction* _destroy,
Stg_Shape_IsCoordInsideFunction* _isCoordInside,
Stg_Shape_CalculateVolumeFunction* _calculateVolume,
+ Stg_Shape_DistanceFromCenterAxisFunction* _distanceFromCenterAxis,
Name name );
void _Union_Init( void* combination, Stg_Shape** shapeList, Index shapeCount, Bool* isComplement ) ;
@@ -116,6 +117,7 @@
Bool _Union_IsCoordInside( void* combination, Coord coord ) ;
double _Union_CalculateVolume( void* combination );
+ void _Union_DistanceFromCenterAxis( void* sphere, Coord coord, double* disVec );
/*---------------------------------------------------------------------------------------------------------------------
** Public member functions
More information about the CIG-COMMITS
mailing list