views:

92

answers:

1

This is just a LARGE generalized question regarding rays (and/or line segments or edges etc) and their place in a software rendered 3d engine that is/not performing raytracing operations. I'm learning the basics and I'm the first to admit that I don't know much about this stuff so please be kind. :)

OK, I wondered why a parametrized line is not used instead of a ray(or are they??). I have looked around at a few cpp files around the internet and seen a couple of resources define a Ray.cpp object, one with a vertex and a vector, another used a point and a vector. I'm also new to the math behind lines and line segments, so please bare with me. I'm pretty sure that you can define an infinate line with only a normal or a vector and then define intersecting points along that line to create a line segment as a subset of that infinate line. Are there any current engines implementing lines in this way, or is there a better way to go about this?

To add further complication (or simplicity?) Wikipedia says that in vector space, the end points of a line segment are often vectors, notably u -> u + v, which makes alot of sence if defining a line by vectors in space rather than intersecting an already defined, infinate line, but I cannot find any implimentation of this either which makes me wonder about the validity of my thoughts when applying this in a 3d engine and even further complication is created when looking at the Flash 3D engine, Papervision, I looked at the Ray class and it takes 6 individual number values as it's parameters and then returns them as 2 different Number3D, (the Papervision equivalent of a Vector), data types?!?

Anyway, I'd be very interested to see an implementation of something which actually uses the CORRECT way of implementing these low level parts as per their true definitions. Any help, source or some good dialog about of this kind of thing would be great. :D

+1  A: 

I'm pretty sure that you can define an infinate line with only a normal or a vector

No, you can't. A vector would define a direction of the line, but all the parallel lines share the same direction, so to pick one, you need to pin it down using a specific point that the line passes through.

Lines are typically defined in Origin + Direction*K form, where K would take any real value, because that form is easy for other math. You could as well use two points on the line.

Andrew
Thanks for replying to this :) Yes, sorry, I did mean from an origin (not very well explained..sorry). ok, perhaps if I state why I'm asking about this, take the 8 vertices of a cube, for example, if they were able to slide those points along the x, y, z lines that they were intersecting, this would equate to the cube sliding along the x, y, or z axis right? Would that be the same way of thinking about it with your implementation? In your example, would making 'K' slighlty negative make your line intersect your origin point? Many thanks
Gary Paluk
I'm not sure if I get the questions right :)If you move all points (aka vertexes) of the figure (eg. cube) then the entire figure moves.And setting K to any specific value does not change the line. Instead, it picks a specific point on the line.The line is a set that consists of an infinite amount of points. In Origin+Dir*K notation, for any given point P on the line there is a specific value of K such that P=Origin+Dir*K. And vice versa, put any given value of K into the equation, and the point is on the line.
Andrew
ah, ok..yeah, I think that's what I meant. Ok, so that creates the ability to move the point along the line, so lets say that the dir vector is normalized, and "K" is zero we will be on the origin location but what has actually been defined here in 3d graphics terms? A point, a vertex, *a line*? hahaha It's throwing me because now I can't figure out if another point would be added to that, or a seperate (whatever that is) be created with the same dir and a new origin, in order to connect them together to create an edge. lolCheers for the feedback :D
Gary Paluk