Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Gaming > Development Programming Algorithms > More on computa...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 644 of 670
Post > Topic >>

More on computational geometry and tracing objects.

by rsprawls <rsprawls@[EMAIL PROTECTED] > Aug 30, 2007 at 03:25 PM

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?




 1 Posts in Topic:
More on computational geometry and tracing objects.
rsprawls <rsprawls@[EM  2007-08-30 15:25:33 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon May 12 5:02:52 CDT 2008.