[cig-commits] r4064 - in long/3D/Gale/trunk/src/gLucifer: .
DrawingObjects/src
walter at geodynamics.org
walter at geodynamics.org
Thu Jul 20 20:08:09 PDT 2006
Author: walter
Date: 2006-07-20 20:08:09 -0700 (Thu, 20 Jul 2006)
New Revision: 4064
Modified:
long/3D/Gale/trunk/src/gLucifer/
long/3D/Gale/trunk/src/gLucifer/DrawingObjects/src/SwarmViewer.c
long/3D/Gale/trunk/src/gLucifer/DrawingObjects/src/SwarmViewer.h
Log:
r62 at earth (orig r594): CecileDuboz | 2006-07-12 19:17:37 -0700
Implemented a way to display only particles whose position are falling in a certain range.
To use it, a boolean positionRange must be set to True, then the min and max position should be entered.
The default min values are -10000 in x,y,z and the default maximum values are 10000 in x, y, z.
Usage :
<param name="positionRange">True</param>
<param name="minPositionX">-5.0</param>
<param name="minPositionY">-5.0</param>
<param name="minPositionZ">-5.0</param>
<param name="maxPositionX">5.0</param>
<param name="maxPositionY">5.0</param>
<param name="maxPositionZ">0.05</param>
<param name="pointSize">2.0</param>
Property changes on: long/3D/Gale/trunk/src/gLucifer
___________________________________________________________________
Name: svk:merge
- 3433ad49-13df-0310-980d-a6a68cf0952a:/trunk:593
d11c8794-cf10-0410-8271-cb625e597d60:/cig:218
+ 3433ad49-13df-0310-980d-a6a68cf0952a:/trunk:594
d11c8794-cf10-0410-8271-cb625e597d60:/cig:218
Modified: long/3D/Gale/trunk/src/gLucifer/DrawingObjects/src/SwarmViewer.c
===================================================================
--- long/3D/Gale/trunk/src/gLucifer/DrawingObjects/src/SwarmViewer.c 2006-07-21 03:08:05 UTC (rev 4063)
+++ long/3D/Gale/trunk/src/gLucifer/DrawingObjects/src/SwarmViewer.c 2006-07-21 03:08:09 UTC (rev 4064)
@@ -127,7 +127,10 @@
lucDrawingObjectMask* mask,
Bool drawParticleNumber,
Bool particleColour,
- int subSetEvery
+ int subSetEvery,
+ Bool positionRange,
+ Coord minPosition,
+ Coord maxPosition
)
{
self->swarm = swarm;
@@ -139,9 +142,12 @@
self->drawParticleNumber = drawParticleNumber;
self->sameParticleColour = particleColour;
self->subSetEvery = subSetEvery;
+ self->positionRange = positionRange;
memcpy( &self->mask, mask, sizeof( lucDrawingObjectMask ) );
-
+ memcpy( &self->minPosition, minPosition , sizeof( Coord ) );
+ memcpy( &self->maxPosition, maxPosition , sizeof( Coord ) );
+
lucColour_FromString( &self->colour, colourName );
}
@@ -202,6 +208,9 @@
Bool drawParticleNumber;
Bool sameParticleColour;
int subSetEvery;
+ Bool positionRange;
+ Coord minPosition;
+ Coord maxPosition;
lucDrawingObjectMask mask;
/* Construct Parent */
@@ -230,8 +239,17 @@
sameParticleColour = Stg_ComponentFactory_GetBool( cf, self->name, "sameParticleColour", False );
subSetEvery = Stg_ComponentFactory_GetInt( cf, self->name, "subSetEvery", 1 );
+ positionRange = Stg_ComponentFactory_GetBool( cf, self->name, "positionRange", False );
+ minPosition[I_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, "minPositionX", -100000.0 );
+ minPosition[J_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, "minPositionY", -100000.0 );
+ minPosition[K_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, "minPositionZ", -100000.0 );
+ maxPosition[I_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, "maxPositionX", 100000.0 );
+ maxPosition[J_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, "maxPositionY", 100000.0 );
+ maxPosition[K_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, "maxPositionZ", 100000.0 );
+
+
lucDrawingObjectMask_Construct( &mask, self->name, cf );
#ifdef GLUCIFER_USE_PICELLERATOR
@@ -259,7 +277,10 @@
&mask,
drawParticleNumber,
sameParticleColour,
- subSetEvery);
+ subSetEvery,
+ positionRange,
+ minPosition,
+ maxPosition);
}
void _lucSwarmViewer_Build( void* drawingObject, void* data ) {}
@@ -333,9 +354,22 @@
Bool drawParticleNumber = self->drawParticleNumber;
Bool sameParticleColour = self->sameParticleColour;
int subSetEvery = self->subSetEvery;
+ Bool positionRange = self->positionRange;
+ Coord minPosition;
+ Coord maxPosition;
+
+ GlobalParticle* particle;
+ double* coord;
+
+
/* Initialise colour value */
memcpy( &colour, &self->colour, sizeof(lucColour) );
+ if(positionRange){
+ memcpy( &minPosition, &self->minPosition, sizeof(Coord) );
+ memcpy( &maxPosition, &self->maxPosition, sizeof(Coord) );
+ }
+
glPointSize( self->pointSize );
/* lighting of small particle objects like particle dots seems to do more harm than good -
@@ -370,24 +404,39 @@
/*Sets the colour for the particle */
lucColour_SetOpenGLColour( &colour );
-
- /* Plot the particle as a point */
- glBegin(GL_POINTS);
- lucSwarmViewer_PlotParticle( self, _context, lParticle_I );
- glEnd();
- /* Draw the particle number if desired */
- if( drawParticleNumber ){
- if( sameParticleColour ) { /*if the colour is the same than the particle one */
- lucSwarmViewer_PlotParticleNumber( self, _context, lParticle_I, colour );
- }
- else{
- lucColour_FromString( &colour, "black" );
- lucSwarmViewer_PlotParticleNumber( self, _context, lParticle_I, colour );
- }
- }
+
+ /* Check if needed that the particle falls into the right position range */
+ if(positionRange){
+ particle = (GlobalParticle*)Swarm_ParticleAt( self->swarm, lParticle_I );
+ coord = particle->coord;
+
+ if( (coord[0] >= minPosition[I_AXIS] ) && (coord[1] >= minPosition[J_AXIS]) && (coord[0] <= maxPosition[I_AXIS] ) && (coord[1] <= maxPosition[J_AXIS]) )
+ {
+ if( ((DiscretisationContext*)_context)->dim == 3){
+ /* check on the third dimension as well */
+ if ( (coord[2] >= minPosition[K_AXIS]) && (coord[2] <= maxPosition[K_AXIS]) ){
+
+ /* Plot the particle as a point */
+ glBegin(GL_POINTS);
+ lucSwarmViewer_PlotParticle( self, _context, lParticle_I );
+ glEnd();
+
+ /* Draw the particle number if desired */
+ if( drawParticleNumber ){
+ if( sameParticleColour ) { /*if the colour is the same than the particle one */
+ lucSwarmViewer_PlotParticleNumber( self, _context, lParticle_I, colour );
+ }
+ else{
+ lucColour_FromString( &colour, "black" );
+ lucSwarmViewer_PlotParticleNumber( self, _context, lParticle_I, colour );
+ }
+ }
+ }
+ }
+ }
+ }
}
-
/* Put back lighting settings */
glEnable(GL_LIGHTING);
}
Modified: long/3D/Gale/trunk/src/gLucifer/DrawingObjects/src/SwarmViewer.h
===================================================================
--- long/3D/Gale/trunk/src/gLucifer/DrawingObjects/src/SwarmViewer.h 2006-07-21 03:08:05 UTC (rev 4063)
+++ long/3D/Gale/trunk/src/gLucifer/DrawingObjects/src/SwarmViewer.h 2006-07-21 03:08:09 UTC (rev 4064)
@@ -78,7 +78,10 @@
float pointSize; \
Bool drawParticleNumber; \
Bool sameParticleColour; \
- int subSetEvery;
+ int subSetEvery; \
+ Bool positionRange; \
+ Coord minPosition; \
+ Coord maxPosition;
struct lucSwarmViewer { __lucSwarmViewer };
More information about the cig-commits
mailing list