General Category > General Anim8or Forum
WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
Thanos:
--- Quote from: cooldude234 ---Though I must ask what is with the Boolean variable rti? It's defined just to define floating point values. Why not just define the floating point values?
--- End quote ---
DUH!! It's not a variable! rti() is the complete function ready - made. You don't have to edit it! :P
rti() returns if the point is inside the triangle. I've already made it! see below for an example.
Example of use.
suppose we have, a triangle with points (1,2,3), (2,3,4), (3,4,5).
and a ray line from points (3,2,1), (2,0,1).
Rename rti.cpp to rti.h (should have done this myself - sorry)
And in your main program:
#include "rti.h"
...
float xi, yi, zi;
...
inTri = rti(1,2,3,2,3,4,3,4,5,3,2,1,2,0,1,&xi,&yi,&zi);
if (inTri == true)
{
// The point is in the triangle.
// The point is (xi,yi,zi) - do something with it!
}
else
{
// The point is not in the triangle.
}
cooldude234:
whoops I read it totally wrong. But it didn't really matter I added the code into my own function anyway
But it still didn't work
Raxx:
Doesn't Thanos's function work standalone? If it does then it's a problem with the input, and you need to recheck how you are using it.
Thanos:
I might make a small example application as well, just to make sure it works standalone.
You know, I shouldn't be sure about anything:
Programmer's rule #1: "Thou shalt not expect thy code bug free."
EDIT: Uhh :-[ :-X it seems it needs just a tad of debugging, I'm sorry cooldude234!!
cooldude234:
--- Quote from: Raxx on February 12, 2013, 03:09:39 pm ---Doesn't Thanos's function work standalone? If it does then it's a problem with the input, and you need to recheck how you are using it.
--- End quote ---
--- Quote from: Thanos on February 12, 2013, 04:20:58 pm ---I might make a small example application as well, just to make sure it works standalone.
You know, I shouldn't be sure about anything:
Programmer's rule #1: "Thou shalt not expect thy code bug free."
EDIT: Uhh :-[ :-X it seems it needs just a tad of debugging, I'm sorry cooldude234!!
--- End quote ---
Yea, it would really help if I understood the math to this whole thing. I can't tell if it's something wrong with my code, the code I based my code off of, or thanos's code or if the universe just like messing with me :S
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version