Function:ns2vpa

From S2PLOT

(Difference between revisions)
Jump to: navigation, search
Revision as of 05:09, 13 December 2007
S2plot admin (Talk | contribs)

← Previous diff
Current revision
S2plot admin (Talk | contribs)

Line 1: Line 1:
==ns2vpa== ==ns2vpa==
-Draw a point at the given position and colour.+Draw a thick, transparent point.
==Prototype== ==Prototype==
Line 18: Line 18:
<tr><td>[[Function:ns2thpoint | ns2thpoint ]]</td><td>Draw a thick point at given position, in colour and thickness in pixels (not world coords). </td></tr> <tr><td>[[Function:ns2thpoint | ns2thpoint ]]</td><td>Draw a thick point at given position, in colour and thickness in pixels (not world coords). </td></tr>
<tr><td>[[Function:ns2vthpoint | ns2vthpoint ]]</td><td>Draw a thick point at given position, in colour and thickness in pixels (not world coords) - vector input. </td></tr> <tr><td>[[Function:ns2vthpoint | ns2vthpoint ]]</td><td>Draw a thick point at given position, in colour and thickness in pixels (not world coords) - vector input. </td></tr>
- +<tr><td>[[Function:struct_COLOUR | struct_COLOUR ]]</td><td>Data structure for (r,g,b) colour indices. </td></tr>
- +<tr><td>[[Function:struct_XYZ | struct_XYZ ]]</td><td>Data structure for (x,y,z) coordinates. </td></tr>
</table> </table>

Current revision

ns2vpa

Draw a thick, transparent point.

Prototype

void ns2vpa(XYZ P, COLOUR icol, float isize, char itrans, float ialpha);

Description

Draw a thick, transparent point with specified size (isize), transparency is one of 's' (standard blend), 't' (transparent) or 'o' (opaque), and alpha channel (ialpha). Takes vector inputs for position P and colour icol.

See Also

ns2vpoint Draw a point at the given position and colour - vector input.
ns2thpoint Draw a thick point at given position, in colour and thickness in pixels (not world coords).
ns2vthpoint Draw a thick point at given position, in colour and thickness in pixels (not world coords) - vector input.
struct_COLOUR Data structure for (r,g,b) colour indices.
struct_XYZ Data structure for (x,y,z) coordinates.


Code Example

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "s2plot.h"

int main(int argc, char *argv[])
{
   XYZ xyz;                                     /* Position */
   COLOUR col;                                  /* Colour */
   float isize;                                 /* Dot size */
   char itrans;                                 /* Transparency type */
   float ialpha;                                /* Alpha channel */
   int i;

   srand48((long)time(NULL));                   /* Seed random numbers */

   s2opend("/?",argc, argv);                    /* Open the display */
   s2swin(-1.,1., -1.,1., -1.,1.);              /* Set the window coordinates */
   s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0);  /* Draw coordinate box */

   for (i=0;i<50;i++) {
      xyz.x = drand48()*2.0 - 1.0;              /* Random position */
      xyz.y = drand48()*2.0 - 1.0;
      xyz.z = drand48()*2.0 - 1.0;
      col.r = drand48();                        /* Random colour */
      col.g = drand48();
      col.b = drand48();
      itrans = 't';                             /* Transparency */
      ialpha = 0.5;                             /* Alpha channel */
      isize  = 8.0;                             /* Point size */
      ns2vpa(xyz, col, isize, itrans, ialpha);  /* Draw transparent point */
   }
   s2show(1);                                   /* Open the s2plot window */

   return 1;
}

Back to S2PLOT function list.


Personal tools