Quick question about shooting a query ray

Mike Feher
  • Mike Feher

    Mike Feher - 2008-01-10


    I have just a quick question on shooting a query ray - apologies if this is covered somewhere else.

    In MGED (I'm using the WinXP version on my work laptop), I would like to fire a ray exactly down the centerline of a tube I've created (cylinder within a cylinder) to represent the center of a guntube.  I want to do this to see when the muzzle is facing me, what the entry coordinates are when the ray hits the front circular plane of the muzzle.  Thus far I have had to eyeball what looks to be the center, based on zooming my view.  Can anyone provide help on this?  Thanks!


    • David Loman

      David Loman - 2008-01-10

      Hrm, well, if what I understand is correct, you are looking for the center of the ends of the outer cylinder?

      If you use the 'get' command on the cylinder, you will see information like this:

      mged> get test_cyl.s
      tgc V {-4005.3529901025317 -937.53441776803083 2231.9056075342442} H {-11.207931871831679 -82.393565431492647 126.13550646668986} A {24.905105896042464 22.708599699855661 17.046565916306779} B {-28.256234733498236 22.05801402438545 11.897874833171874} C {24.905105896042464 22.708599699855661 17.046565916306779} D {-28.256234733498236 22.05801402438545 11.897874833171874}

      Good info here.

      V is the center point of one end of the cylinder.  H is an un-normalized direction vector used to calculate the other end of the cylinder.  H is, in essence, the height.

      So you can figure out the coords of the end (opposite V) with my example data, is straight math:

      X = -4005.3529901025317 + -11.207931871831679 = -4016.560921974363379
      Y = -937.53441776803083 + -82.393565431492647 = -1019.927983199523477
      Z = 2231.9056075342442 + 126.13550646668986 = 2358.04111400093406

      So, Now I can say that the center point of on enf of my cylinder is V, or {-4005.3529901025317 -937.53441776803083 2231.9056075342442} and the other end is {-4016.560921974363379 -1019.927983199523477 2358.04111400093406}.

      ...That make sense?

      Also, you can use H and plug the values into the -dir aspect of nirt to change nirts ray direction.  -xyz sets ray origin.  Combine the two and you can make nirt fire any direction from anywhere without having to line up your Graphics window.

      • Sean Morrison

        Sean Morrison - 2008-01-10

        And if you just want to know/see the value, I believe I recall making the 'l' command report both "V" and "Top" which is V+H calculated for you.  So you can easily nirt from V in -H dir or Top in H dir to get vectors that start on the centerline of the cylinder and go outward or the other way around, etc.

    • David Loman

      David Loman - 2008-01-10

      Fine... just make it easy. :)


Log in to post a comment.