sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [Solved] What's a ray?

    Scheduled Pinned Locked Moved Developers' Forum
    10 Posts 7 Posters 818 Views 7 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      Scienthsine
      last edited by Scienthsine

      The 'View' class has a method called 'pickray', which returns 'a ray'. I can't find anything that actually tells me what this ray is. I print it out, and it seems to be an array with a position and a vector, but I'm new to all of this, and would like to know for sure. πŸ˜›

      So, any imformation, or conformation would be cool.

      1 Reply Last reply Reply Quote 0
      • RayOchoaR Offline
        RayOchoa
        last edited by

        Whats a ray? Well me of course lol πŸ˜„ πŸ˜†

        CaR DeSiGnS bY mE
        http://ray-ochoa.com

        1 Reply Last reply Reply Quote 0
        • PixeroP Offline
          Pixero
          last edited by

          LOL 🀣

          1 Reply Last reply Reply Quote 0
          • plot-parisP Offline
            plot-paris
            last edited by

            I have no idea about ruby. but wasn't the ray-test a method to shoot a ray through the model and get the first point, where this ray intersects with the model? (if I am right, Didier uses this command with the terrain-reshaper ruby)

            1 Reply Last reply Reply Quote 0
            • david_hD Offline
              david_h
              last edited by

              I stay away from rays. . .especially after what happened to that Steve Irwin guy.

              If I make it look easy...It is probably easy

              1 Reply Last reply Reply Quote 0
              • S Offline
                Scienthsine
                last edited by

                Lol... poor ray.... πŸ˜›

                plot-paris> Yes, this is what rays are used for most commonly in 3d, I think. Infact, it's what they're used for in Sketchup. I don't need to 'pick' something that this ray intersects, I need to use it for other purposes...

                I'll create some lines later tonight and test, but from the numbers, I believe that this function: http://download.sketchup.com/OnlineDoc/gsu6_ruby/Docs/ruby-view.html#pickray returns a point where a ray from the camera eye intersects the square in 3d space that is our viewport, at our cursor location, and a vector which is the difference from the eye position to said intersection... extended to some huge number. (Maybe the far clipping plane?) This would make sense, and is how I expect it to work... I just like to be completely sure of everything before I go coding around it. I'm just a bit annoyed that the documentation simply says it 'returns a ray', and never defines -exactly- what the data represents or more accurately what format we can expect it in. Now... by definition a ray is a point and a vector, which the data seems to be also... but it's just a simple array. It's never used in any other part of the documentation as far as I can tell, which is probley why it's a simple array and doesn't have it's own class.

                Idk, probley making too much of a big deal about it. I guess I'd be happy if they just added something telling us that 'a ray' is an array in the form of (xPos,yPos,zPos)(xVec,yVec,zVec).

                Blah... just rambling... what do you all think?

                1 Reply Last reply Reply Quote 0
                • plot-parisP Offline
                  plot-paris
                  last edited by

                  well, you seem to know more than anyone else about this topic.

                  my thoughts drifted off half way through your explanation πŸ˜„

                  but they drifted off in a very interesting direction; an idea for a ruby that surves no purpose at all, except fun. shouldn't be too difficult to code either (if you know how ruby works - which I don't πŸ˜‰ )

                  let me explain, what I thought of:
                  if you have seen the movie "Minority Report" then you are familiar with the 3D holographic screen, which John Anderton (Tom Cruise) uses to watch video of his dead son Shaun. When the camera moves sideways, you see, that the recorded 3D video only shows geometry that is facing the camera.

                  I would like to have a ruby, that shoots rays from the camera point of view towards the view-port in an array, remembers the firt intersection points and creates a surface that is a perfect representation of the model only from this camera point. if you move sideways however, you see that all the backfaces are missing...

                  damn, that is difficult to explain. did you understand what I mean?

                  sorry, that was utterly off topic 😳

                  1 Reply Last reply Reply Quote 0
                  • R Offline
                    RickW
                    last edited by

                    In Geometry, a line is an infinitely long entity defined by a linear function [such as f(x)=2x, or y=2x], and a ray is like half a line, in that it is infinite in one direction, but has a specific start point [such as f(x)=2x where x>5].

                    In SketchUp, (as explained) a ray is an array consisting of the start point and the direction (a Point3d object and a Vector3d object), which corresponds to the Geometric ray.

                    http://groups.google.com/group/SketchUp-Plugins-Dev/web/Ruby-Model.html#raytest has an explanation of the ray as used in SketchUp ruby.

                    RickW
                    [www.smustard.com](http://www.smustard.com)

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      Scienthsine
                      last edited by

                      @unknownuser said:

                      Comments

                      A ray is a two element array containing a point and a vector [Geom::Point3d(), Geom::Vector3d()]. The point defines the start point of the ray and the vector defines the direction.

                      This is what I was looking for, guess my google search tags didn't work...

                      Would be nice if they put that explanation on the View->pickray documentation also, would have avoided this whole mess πŸ˜›

                      Ok, got the info I needed, thanks again πŸ˜„

                      1 Reply Last reply Reply Quote 0
                      • david_hD Offline
                        david_h
                        last edited by

                        the one and only Ray. . . .ray.jpg

                        πŸ˜† everybody sing along. . .

                        Hit the Road Jack. . .doncha come back no more, no more, no more , NO MORE. . .

                        If I make it look easy...It is probably easy

                        1 Reply Last reply Reply Quote 0
                        • 1 / 1
                        • First post
                          Last post
                        Buy SketchPlus
                        Buy SUbD
                        Buy WrapR
                        Buy eBook
                        Buy Modelur
                        Buy Vertex Tools
                        Buy SketchCuisine
                        Buy FormFonts

                        Advertisement