[overture] Re: Plot a Point

  • From: "#DOMINIC DENVER JOHN CHANDAR#" <DOMI0002@xxxxxxxxxx>
  • To: <overture@xxxxxxxxxxxxx>
  • Date: Tue, 16 Jun 2009 23:54:46 +0800

Thanks Bill, It worked fine..
Dominic 

-----Original Message-----
From: overture-bounce@xxxxxxxxxxxxx
[mailto:overture-bounce@xxxxxxxxxxxxx] On Behalf Of Bill Henshaw
Sent: Tuesday, June 16, 2009 10:51 PM
To: overture@xxxxxxxxxxxxx
Subject: [overture] Re: Plot a Point

hi Dominic,

   You can use the plotPoints function to plot coloured points (or
spheres).
Here is an example. ...Bill

     PlotStuff ps(true,"plot");
     GraphicsParameters psp;

     ...
     else if( answer=="plot points" || answer=="plot points with colour"
|| answer=="plot spheres with colour" )
     {
       const bool plotSpheres = answer=="plot spheres with colour";

       const int n=plotSpheres ? 41 : 51;
       const int m = plotSpheres ? 2 : 1;
       realArray points(n,3), value(n,m);
       for( int i=0; i<n; i++ )
       {
         real radius=i/(n+1.);
         real theta=twoPi*i/(n+1.);
         points(i,axis1)=cos(theta)*radius;
         points(i,axis2)=sin(theta)*radius;
        points(i,axis3)=cos(2.*theta)*radius;
         value(i,0)=
SQR(points(i,axis1))+SQR(points(i,axis2))+SQR(points(i,axis3));

         if( plotSpheres ) value(i,1)=.05; // radius for the sphere
       }
       psp.set(GI_POINT_SIZE,(real) 6.);  // size in pixels
       if( answer=="plot points" )
         ps.plotPoints(points,psp);
       else
         ps.plotPoints(points,value,psp); // colour point i by value(i)
     }

#DOMINIC DENVER JOHN CHANDAR# wrote:
> Hi,
>  
>   Is there a way to plot a point at a given location (x,y) using the 
> plotStuff class ? or should I use the OpenGL functions ? Basically I 
> have a contour plot plotted in a window and i want to plot points at 
> different locations (also later with different colors)
>  
> I tried something like :
>  
> DataPointMapping map;
> map.setDataPoints( points, 1,1);
> MappedGrid mg(map);
> mg.update();
>  
> here "points" is of dimension (1, 0:1). But this doesnt work.. I think

> we cannot generate a MappedGrid with just 1 point...?
>  
> Any other ways ?
>  
> Thanks,
> Dominic
>  
>  


Other related posts: