pfCylAroundSegs API

New Message Reply Date view Thread view Subject view Author view

lelkins++at++relay.nswc.navy.mil
Thu, 22 Dec 94 8:18:14 EST


Hello...

I'm trying to make a segment intersection routine run faster by adding
bounding cylinders to the pfSegSet when I have a number of segments to
look at. My problem is in sending the segments to pfCylAroundSegments.
So consider the following code fragment...

#include <pf.h>

long segment_intersect(pfSegSet vol_segset, pfNode *target,
                       long cursegment,
                       struct points_struct *pts)
{
  static pfHit **hits[100];
  static long isect, counter;
  static pfCylinder dst;

  /* Build the bits... */

  if(cursegment>0)
    vol_segset.activeMask=0x01;
  else
    vol_segset.activeMask=0x0;
     
     
  for(counter=1;counter<cursegment;counter++)
    vol_segset.activeMask=(vol_segset.activeMask<<1)|0x01;

  /* If there are three or more segments, then determine the bounding
   * cylinder so pfSegsIsectNode can use this as a pre-intersection test.
   */
    
  if(cursegment<3)
    {
    vol_segset.bound=NULL;
    vol_segset.mode=vol_segset.mode&(!((long)PFTRAV_IS_BCYL));
    }
  else
    {
    vol_segset.mode=vol_segset.mode|PFTRAV_IS_BCYL;
    pfCylAroundSegs(&dst, &(vol_segset.segs), cursegment);
            
    vol_segset.bound=&dst;
    }
   

  /* ..................... */
   
      
}/*end of segment_intersect*/

This won't compile...

onyx2:elkins:/usr/people/elkins/perfsrc/volcol/temp> make
making OPT version of volcol
        cc -xansi -D__STvolcol__ -I.. -I.. -I/usr/src/Performer/include -I/usr/include/Performer -O -c ../volcol.c
cfe: Warning 709: ../volcol.c, line 44: Incompatible pointer type assignment
     pfCylAroundSegs(&dst, &(vol_segset.segs), cursegment);
 --------------------------^

The man page for pfCylAroundSegs says that it has the following prototype:

void pfCylAroundSegs(pfCylinder *dst, pfSeg **segs, long nseg);

So what it wants there is a pfSeg**.... However, vol_segset is a pfSegSet:

        typedef struct _pfSegSet
        {
            long mode;
            void * userData;
            pfSeg segs[PFIS_MAX_SEGS];
            ulong activeMask;
            ulong isectMask;
            void * bound;
            long (*discFunc)(pfHit*);
        } pfSegSet;

so vol_segset.segs should be a (pfSeg *), and it seems to me that
&(vol_segset.segs) should be a (pfSeg **)... But the compiler
doesn't like it.

I have also tried the following fragment:

  if(cursegment<3)
    {
    vol_segset.bound=NULL;
    vol_segset.mode=vol_segset.mode&(!((long)PFTRAV_IS_BCYL));
    }
  else
    {
    pfSeg **ssseg;

     
    ssseg=(pfSeg **)&(vol_segset.segs);
     
                                      
    vol_segset.mode=vol_segset.mode|PFTRAV_IS_BCYL;
    pfCylAroundSegs(&dst, ssseg, cursegment);
            
    vol_segset.bound=&dst;
    }
   

This also fails to compile...

onyx2:elkins:/usr/people/elkins/perfsrc/volcol/temp> make
making OPT version of volcol
        cc -xansi -D__STvolcol__ -I.. -I.. -I/usr/src/Performer/include -I/usr/include/Performer -O -c ../volcol.c
cfe: Warning 709: ../volcol.c, line 51: Incompatible pointer type assignment
     pfCylAroundSegs(&dst, ssseg, cursegment);
 --------------------------^

What am I missing? Probably something horribly simple in the typecasting,
but I'm at a loss to see it at the moment.

System particulars: IRIX 5.2, Performer 1.2, Onyx
I eoe1 03/05/94 IRIX Execution Environment 1, 5.2
I eoe2 10/14/94 IRIX Execution Environment 2, 5.2
I performer_dev 10/14/94 IRIS Performer1.2/Irix5 Development
                                    Software
I c_dev 10/14/94 C, 3.18

Thanks in advance for any pointers....

Les Elkins

----------------------------------------------------------------------
lelkins++at++relay.nswc.navy.mil The views expressed herein do not
                                   represent those of NSWC, the Navy,
Les Elkins or the federal government.
Naval Surface Warfare Center
Dahlgren Division (And anybody who says otherwise is
Silver Spring, MD itching for a fight...)


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:45 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.