[Solved] What's a ray?
-
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.
-
Whats a ray? Well me of course lol
-
LOL
-
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)
-
I stay away from rays. . .especially after what happened to that Steve Irwin guy.
-
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?
-
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
-
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.
-
@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
-
the one and only Ray. . . .
everybody sing along. . .
Hit the Road Jack. . .doncha come back no more, no more, no more , NO MORE. . .
Advertisement