bsp tree falls at the first hurdle

Started by
11 comments, last by playmesumch00ns 22 years, 5 months ago
shouldn''t it be:

result = dotProduct(direction, *(plane->normal)) - plane->distance;

and the 0.001 in if(result ) be 0.0

and you pass the actual postion as the first param to dotproduct, not the direction...


well, that''s what works for me, anyways...
Advertisement
First of all thanks to everyone who answered my dumb post.

Turns out Mr Anonymous Poster was right - despite checking again and again I didn''t realise that I''d mixed up the + and * in my dot product function!
That''s nothing compared to the fun I had my my ray-plane intersect function but *touch wood* it''s all working now and my splitPoly function actually splits a triangle into 3 (after some major fudging - wonder what happens when I chuck a 20k game level at it =] )

VolkerG:

Ooops, yes, you''re right, I was wrong.

DotProdutct IS distributive, even crossproduct is,
if you keep the order of the variables.

I remembered wrong. I thought I heard the voice of my
ex- math teacher shouting: "don''t do that!", and connected
it to the vector dot-prod.

10 Minutes after posting, and reading some emails, I`ve
tried it out on paper, and realized I erred.
But 1st, I had to go(no internet at home, at the moment),
and 2nd, I''was sure that there were
enough people on the net, who soon will correct my mistake
... ;-)
(and so it was)

And maybe it wasn''t the plane equation, what the questioner
thought about. The new vector produced from the subtraction
is 90 degrees against the normal, if point is within the
plane, and the dotproduct, of course, changes its sign, depending on smaller/greater angle than 90 degs,
BUT I just didn''t see that, when I looked at the code,
and gave a quick response.


(
Well, as my friends know, somtimes I answer while running the last two thinking steps... maybe I should finish thinking first... ;-) It''s a bad habit..
)

This topic is closed to new replies.

Advertisement