Alright, some possible dilemmas have come up while programming and I
need to bounce some ideas off this group...
One such dilemma is the starting point of tracing. Essentially, I'm
using an algorithm like so (roughly):
for each x from x_min to x_max
Get a list all polys that intrude on the sampling space
for each y from y_min to y_max
make a list from the x intrusions of all polys that intrude on
the y sampling space.
for each poly in the xy list
for each xy extent in the sampling box
calculate the intersection between the xy ray of the samp box
and the plane defined by xy.poly
Now, the coordinate mins and maxs are the absolute minimum maximum
coordinates defined by the vertices that define the geometry. I loop
through the x and y dimensions, but I'm scanning/tracing/spanning
along the z dimension.
I'm using the parametric equations outlined in "3D Math Primer for
Graphics and Game Development"
p{t} = p0 + tdv (note, in the book, the d is boldfaced to denote a
vector, but I can't bold text here)
p dot n = ds (ds is a scalar d in the book, but I need to
differentiate between the vector and the scalar).
That means, it's possible that the sampling box space may start with
it's trailing extent on a poly and that the leading extent may hit a
poly and max z extent at the same time, so I don't have an early bail
if it reaches the max z extent w/o hitting a poly. In either case, it
would require some special work to determine these cases.
By subbing and commutative rules, we solve for t:
(p0 + tdv) dot n = ds
p0 dot n + tdv dot n = ds
tdv dot n = ds - (p0 dot n)
t = (ds-(p0 dot n)) / (dv dot n)
So, t could equal 1.0 and I'd still have to check via some other means
for a ray/plane intersection.
I'm thinking I could resolve this quite easily by simply increasing
the bounding box for the geometry by 10% or by 2.5x the samp space
dimensions. Doing this would assert two inarguable conclusions:
1. We would always start outside the geometry.
2. If we reach 1.0 for t, we have hit a bounding limit w/o hitting a
plane or poly whatsoever.
Sound good/reasonable?
I would also like to ask a math question or two since I have your
attention.
dv dot n will tell us the direction from which dv approaches the
plane:
< 0 from the backside
> 0 from the frontside
== 0 parallel to the plane
That helps in bailing early because if dv dot n == 0, then we won't
have a ray/plane intersection
What can p0 dot n tell me?


|