|
From: <and...@us...> - 2013-11-05 13:47:09
|
Revision: 12652
http://sourceforge.net/p/plplot/code/12652
Author: andrewross
Date: 2013-11-05 13:47:05 +0000 (Tue, 05 Nov 2013)
Log Message:
-----------
Apply modified version of patch from Phil Rosenberg so that global coordinate transformations are applied to vector plots.
Also fix bug in autoscaling of vectors for the case where vectors were all parallel to one of the coordinate axes.
Modified Paths:
--------------
trunk/src/plvect.c
Modified: trunk/src/plvect.c
===================================================================
--- trunk/src/plvect.c 2013-11-05 11:31:45 UTC (rev 12651)
+++ trunk/src/plvect.c 2013-11-05 13:47:05 UTC (rev 12652)
@@ -68,6 +68,7 @@
plP_plotvect( PLFLT x, PLFLT y, PLFLT u, PLFLT v, PLFLT scale )
{
PLFLT uu, vv, px0, py0, dpx, dpy;
+ PLFLT xt, yt;
// Unnecessarily initialize a_y to quiet a -O1 -Wuninitialized warning
// which is a false alarm. (If something goes wrong with the
// a_x malloc below any further use of a_y does not occur.)
@@ -86,13 +87,16 @@
plexit( "plP_plotvect: Insufficient memory" );
}
- px0 = plP_wcpcx( x );
- py0 = plP_wcpcy( y );
+ TRANSFORM( x, y, &xt, &yt );
+ px0 = plP_wcpcx( xt );
+ py0 = plP_wcpcy( yt );
pldebug( "plP_plotvect", "%f %f %d %d\n", x, y, px0, py0 );
- dpx = plP_wcpcx( x + 0.5 * uu ) - px0;
- dpy = plP_wcpcy( y + 0.5 * vv ) - py0;
+ TRANSFORM( x + 0.5 * uu, y + 0.5 * vv, &xt, &yt );
+ //printf("plvect: %f %f %f %f %f %f %f\n",scale, x,0.5*uu, y,0.5*vv, xt, yt);
+ dpx = plP_wcpcx( xt ) - px0;
+ dpy = plP_wcpcy( yt ) - py0;
// transform arrow -> a
@@ -187,10 +191,7 @@
vmax = ( v[i][j] > vmax ) ? v[i][j] : vmax;
}
}
- umax = umax / dxmin;
- vmax = vmax / dymin;
- lscale = ( umax < vmax ) ? umax : vmax;
- lscale = 1.5 / lscale;
+ lscale = 1.5*MIN(dxmin / umax, dymin / vmax);
if ( scale < 0.0 )
{
scale = -scale * lscale;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <hba...@us...> - 2014-02-28 01:43:36
|
Revision: 13027
http://sourceforge.net/p/plplot/code/13027
Author: hbabcock
Date: 2014-02-28 01:43:31 +0000 (Fri, 28 Feb 2014)
Log Message:
-----------
Fix divide by zero error in the case where umax or vmax are all zero.
Modified Paths:
--------------
trunk/src/plvect.c
Modified: trunk/src/plvect.c
===================================================================
--- trunk/src/plvect.c 2014-02-26 01:14:43 UTC (rev 13026)
+++ trunk/src/plvect.c 2014-02-28 01:43:31 UTC (rev 13027)
@@ -200,7 +200,21 @@
vmax = ( v[i][j] > vmax ) ? v[i][j] : vmax;
}
}
- lscale = 1.5 * MIN( dxmin / umax, dymin / vmax );
+ if (umax != 0.0)
+ {
+ dxmin = dxmin / umax;
+ }
+ else {
+ dxmin = 10E10;
+ }
+ if (vmax != 0.0)
+ {
+ dymin = dymin / vmax;
+ }
+ else {
+ dymin = 10E10;
+ }
+ lscale = 1.5 * MIN( dxmin, dymin);
if ( scale < 0.0 )
{
scale = -scale * lscale;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ai...@us...> - 2014-03-04 20:42:21
|
Revision: 13037
http://sourceforge.net/p/plplot/code/13037
Author: airwin
Date: 2014-03-04 20:42:19 +0000 (Tue, 04 Mar 2014)
Log Message:
-----------
Style previous commit.
Modified Paths:
--------------
trunk/src/plvect.c
Modified: trunk/src/plvect.c
===================================================================
--- trunk/src/plvect.c 2014-03-04 20:41:18 UTC (rev 13036)
+++ trunk/src/plvect.c 2014-03-04 20:42:19 UTC (rev 13037)
@@ -200,21 +200,23 @@
vmax = ( v[i][j] > vmax ) ? v[i][j] : vmax;
}
}
- if (umax != 0.0)
+ if ( umax != 0.0 )
{
- dxmin = dxmin / umax;
+ dxmin = dxmin / umax;
}
- else {
- dxmin = 10E10;
+ else
+ {
+ dxmin = 10E10;
}
- if (vmax != 0.0)
+ if ( vmax != 0.0 )
{
- dymin = dymin / vmax;
+ dymin = dymin / vmax;
}
- else {
- dymin = 10E10;
+ else
+ {
+ dymin = 10E10;
}
- lscale = 1.5 * MIN( dxmin, dymin);
+ lscale = 1.5 * MIN( dxmin, dymin );
if ( scale < 0.0 )
{
scale = -scale * lscale;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|