Re: Intersections with lines and points under Performer?

New Message Reply Date view Thread view Subject view Author view

Kim Michael Fairchild (fair++at++iss.nus.sg)
Mon, 30 Oct 1995 14:54:50 +0800


Hi,

I am a bit embarressed to contribute to this deep subject on complex
intersections because I am having trouble getting a VERY simple one to
work.

I can pick anything as long as I don't put it under a switch. I am
using the standard pick code.

The pick code and the scene graph follow. Sorry that the scenegraph
even for a simple scene with one switch is a bit long. Just search for
the word "switch".

thanks, Kim.

pfNode *DoPick(Pick *P, long mousex,long mousey)
{
    long pick_count = 0;
    static pfHit **ipicked[10];

    pfNodePickSetup(P->scene);
    pfuCalcNormalizedChanXY(&P->pickX, &P->pickY, *P->chan, mousex, mousey);

    printf("scene: %x %s\n", P->scene, pfGetNodeName(P->scene));
    if ((*P->chan != NULL) && (P->scene != NULL))
      pick_count = pfChanPick(*P->chan, P->traverse, P->pickX, P->pickY, 0.0f, ipicked);
    printf("pick: %d\n", pick_count);

    if (pick_count > 0)
    {
        pfQueryHit(*ipicked[0], PFQHIT_NODE, &P->picked);
        pfQueryHit(*ipicked[0], PFQHIT_PATH, &P->path);
        MakePathString(P->pathname, P->path);
        pfNotify(PFNFY_INFO, PFNFY_PRINT,
                "Picking.c - Picked path is:\n%s", P->pathname);
    }
    else
        P->picked = NULL;

    return P->picked;
}

And this is my scenegraph.

[0:0]pfScene pfId=1 0x184e1f80 {
    trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
    bsphere: ctr(-99.181572
[0:0]pfScene pfId=1 0x184e1f80 {
    trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
    bsphere: ctr(-99.181572, 100.000000, 13.005554) rad=3.801727
    Num Children: 2
  [1:0]pfGroup pfId=3 0x184ebd00 {
      trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
      bsphere: ctr(-99.181572, 100.000000, 13.005554) rad=3.801727
      Num Children: 1
    [2:0]pfGroup pfId=2 0x184e2000 {
        trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
        bsphere: ctr(-99.181572, 100.000000, 13.005554) rad=3.801727
        Num Children: 2
      [3:0]pfGroup pfId=7 0x184ec620 {
          path: /world0
          trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
          bsphere: ctr(0.000000, -400.000000, 0.000000) rad=-1.000000
          Num Children: 2
        [4:0]pfDCS pfId=8 0x184ec680 {
            path: /world0/Branch1
            trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
            bsphere: ctr(0.000000, -400.000000, 0.000000) rad=-1.000000
            Matrix: {1.000000 0.000000 0.000000 0.000000
                         0.000000 1.000000 0.000000 0.000000
                         0.000000 0.000000 1.000000 0.000000
                         0.000000 -400.000000 0.000000 1.000000}
            Max Scale: 1.000000
            Num Children: 0
        [4:0]} pfDCS 8 0x184ec680
        [4:1]pfDCS pfId=26 0x185419e0 {
            path: /world0/Branch3
            trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
            bsphere: ctr(-42.740002, -558.609985, 17.059999) rad=-10.000000
            Matrix: {10.000000 0.000000 0.000000 0.000000
                         0.000000 10.000000 0.000000 0.000000
                         0.000000 0.000000 10.000000 0.000000
                         -42.740002 -558.609985 17.059999 1.000000}
            Max Scale: 10.000000
            Num Children: 0
        [4:1]} pfDCS 26 0x185419e0
      [3:0]} pfGroup 7 0x184ec620
      [3:1]pfSwitch pfId=15 0x1851a470 {
          trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
          bsphere: ctr(-99.181572, 100.000000, 13.005554) rad=3.801727
          Num Children: 4
        [4:0]pfGroup pfId=16 0x1851a4e0 {
            path: /<Group 0>
            trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
            bsphere: ctr(-99.181572, 100.000000, 13.005554) rad=3.801727
            Num Children: 1
          [5:0]pfDCS pfId=23 0x1851ab20 {
              path: /<Group 0>/SemArt DCS
              trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
              bsphere: ctr(-99.181572, 100.000000, 13.005554) rad=3.801727
              Matrix: {5.000000 0.000000 0.000000 0.000000
                           0.000000 5.000000 0.000000 0.000000
                           0.000000 0.000000 5.000000 0.000000
                           -99.181572 100.000000 13.005554 1.000000}
            Max Scale: 5.000000
              Num Children: 1
            [6:0]pfGroup pfId=24 0x1851ac50 {
                path: /<Group 0>/SemArt DCS/SemArt: sphere3.bgf
                trav masks: cull=0xffffffff draw=0x1 isect=0xffffffff
                bsphere: ctr(0.000000, 0.000000, 0.000000) rad=0.760345
                Num Children: 1
              [7:0]pfGeode pfId=22 0x1851a880 {
                  trav masks: cull=0xffffffff draw=0x1 isect=0xffffffff
                  bsphere: ctr(0.000000, 0.000000, 0.000000) rad=0.760345
                  Num Children: 1
                [8:0] - pfGeoSet{
                    GeoSet: 0x1851adf0 {
                      Primitive: PFGS_QUADS, NON-INDEXED, pfPrims=3, glPrims=6, verts=12
                        Attribute Bindings:
                            PFGS_COLOR4=PFGS_OFF PFGS_NORMAL3=PFGS_PER_VERTEX PFGS_TEXCOORD2=PFGS_OFF
                    } GeoSet: 0x1851adf0
                [8:0]} pfGeoSet
              [7:0]} pfGeode 22 0x1851a880
            [6:0]} pfGroup 24 0x1851ac50
          [5:0]} pfDCS 23 0x1851ab20
        [4:0]} pfGroup 16 0x1851a4e0
        [4:1]pfGroup pfId=17 0x1851a5d0 {
            path: /<Group 1>
            trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
            bsphere: ctr(0.000000, 0.000000, 0.000000) rad=-1.000000
            Num Children: 0
        [4:1]} pfGroup 17 0x1851a5d0
        [4:2]pfGroup pfId=18 0x1851a630 {
            path: /<Group 2>
            trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
            bsphere: ctr(0.000000, 0.000000, 0.000000) rad=-1.000000
            Num Children: 0
        [4:2]} pfGroup 18 0x1851a630
        [4:3]pfGroup pfId=19 0x1851a690 {
            path: /<Group 3>
            trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
            bsphere: ctr(0.000000, 0.000000, 0.000000) rad=-1.000000
            Num Children: 0
        [4:3]} pfGroup 19 0x1851a690
      [3:1]} pfSwitch 15 0x1851a470
    [2:0]} pfGroup 2 0x184e2000
  [1:0]} pfGroup 3 0x184ebd00
  [1:1]pfLightSource pfId=9 0x184ec800 {
      trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
      bsphere: ctr(0.000000, 0.000000, 0.000000) rad=-1.000000
      pfLight {
      }
  [1:1]} pfLightSource 9 0x184ec800
[0:0]} pfScene 1 0x184e1f80, 100.000000, 13.005554) rad=3.801727
    Num Children: 2
  [1:0]pfGroup pfId=3 0x184ebd00 {
      trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
      bsphere: ctr(-99.181572, 100.000000, 13.005554) rad=3.801727
      Num Children: 1
    [2:0]pfGroup pfId=2 0x184e2000 {
        trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
        bsphere: ctr(-99.181572, 100.000000, 13.005554) rad=3.801727
        Num Children: 2
      [3:0]pfGroup pfId=7 0x184ec620 {
          path: /world0
          trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
          bsphere: ctr(0.000000, -400.000000, 0.000000) rad=-1.000000
          Num Children: 2
        [4:0]pfDCS pfId=8 0x184ec680 {
            path: /world0/Branch1
            trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
            bsphere: ctr(0.000000, -400.000000, 0.000000) rad=-1.000000
            Matrix: {1.000000 0.000000 0.000000 0.000000
                         0.000000 1.000000 0.000000 0.000000
                         0.000000 0.000000 1.000000 0.000000
                         0.000000 -400.000000 0.000000 1.000000}
            Max Scale: 1.000000
            Num Children: 0
        [4:0]} pfDCS 8 0x184ec680
        [4:1]pfDCS pfId=26 0x185419e0 {
            path: /world0/Branch3
            trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
            bsphere: ctr(-42.740002, -558.609985, 17.059999) rad=-10.000000
            Matrix: {10.000000 0.000000 0.000000 0.000000
                         0.000000 10.000000 0.000000 0.000000
                         0.000000 0.000000 10.000000 0.000000
                         -42.740002 -558.609985 17.059999 1.000000}
            Max Scale: 10.000000
            Num Children: 0
        [4:1]} pfDCS 26 0x185419e0

// Here is my switch, why doesn't it pick this??

      [3:0]} pfGroup 7 0x184ec620
      [3:1]pfSwitch pfId=15 0x1851a470 {
          trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
          bsphere: ctr(-99.181572, 100.000000, 13.005554) rad=3.801727
          Num Children: 4
        [4:0]pfGroup pfId=16 0x1851a4e0 {
            path: /<Group 0>
            trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
            bsphere: ctr(-99.181572, 100.000000, 13.005554) rad=3.801727
            Num Children: 1
          [5:0]pfDCS pfId=23 0x1851ab20 {
              path: /<Group 0>/SemArt DCS
              trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
              bsphere: ctr(-99.181572, 100.000000, 13.005554) rad=3.801727
              Matrix: {5.000000 0.000000 0.000000 0.000000
                           0.000000 5.000000 0.000000 0.000000
                           0.000000 0.000000 5.000000 0.000000
                           -99.181572 100.000000 13.005554 1.000000}
            Max Scale: 5.000000
              Num Children: 1
            [6:0]pfGroup pfId=24 0x1851ac50 {
                path: /<Group 0>/SemArt DCS/SemArt: sphere3.bgf
                trav masks: cull=0xffffffff draw=0x1 isect=0xffffffff
                bsphere: ctr(0.000000, 0.000000, 0.000000) rad=0.760345
                Num Children: 1
              [7:0]pfGeode pfId=22 0x1851a880 {
                  trav masks: cull=0xffffffff draw=0x1 isect=0xffffffff
                  bsphere: ctr(0.000000, 0.000000, 0.000000) rad=0.760345
                  Num Children: 1
                [8:0] - pfGeoSet{
                    GeoSet: 0x1851adf0 {
                      Primitive: PFGS_QUADS, NON-INDEXED, pfPrims=3, glPrims=6, verts=12
                        Attribute Bindings:
                            PFGS_COLOR4=PFGS_OFF PFGS_NORMAL3=PFGS_PER_VERTEX PFGS_TEXCOORD2=PFGS_OFF
                    } GeoSet: 0x1851adf0
                [8:0]} pfGeoSet
              [7:0]} pfGeode 22 0x1851a880
            [6:0]} pfGroup 24 0x1851ac50
          [5:0]} pfDCS 23 0x1851ab20
        [4:0]} pfGroup 16 0x1851a4e0
        [4:1]pfGroup pfId=17 0x1851a5d0 {
            path: /<Group 1>
            trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
            bsphere: ctr(0.000000, 0.000000, 0.000000) rad=-1.000000
            Num Children: 0
        [4:1]} pfGroup 17 0x1851a5d0
        [4:2]pfGroup pfId=18 0x1851a630 {
            path: /<Group 2>
            trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
            bsphere: ctr(0.000000, 0.000000, 0.000000) rad=-1.000000
            Num Children: 0
        [4:2]} pfGroup 18 0x1851a630
        [4:3]pfGroup pfId=19 0x1851a690 {
            path: /<Group 3>
            trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
            bsphere: ctr(0.000000, 0.000000, 0.000000) rad=-1.000000
            Num Children: 0
        [4:3]} pfGroup 19 0x1851a690
      [3:1]} pfSwitch 15 0x1851a470
    [2:0]} pfGroup 2 0x184e2000
  [1:0]} pfGroup 3 0x184ebd00
  [1:1]pfLightSource pfId=9 0x184ec800 {
      trav masks: cull=0xffffffff draw=0xffffffff isect=0xffffffff
      bsphere: ctr(0.000000, 0.000000, 0.000000) rad=-1.000000
      pfLight {
      }
  [1:1]} pfLightSource 9 0x184ec800
[0:0]} pfScene 1 0x184e1f80


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:51:59 PDT

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