For those interested: https://www.scratchapixel.com/lessons/3d-basic-rendering/ray-tracing-rendering-a-triangle/moller-trumbore-ray-triangle-intersection

gavinmak

How is the cost compared across divisions, multiplications, and additions? i.e. is there a single value that could be calculated to determine how fast it would be without actually running the algorithm? Would that depend on the computer used to calculate the algorithm?

ABSchloss

Different operations are sometimes different speeds, depending on the implementation for that language. You can determine asymptotic speeds based of input sizes if you look at different algorithms used. Such as https://en.wikipedia.org/wiki/Karatsuba_algorithm, which speeds up multiplication from n^2 to n^(log_2(3)).

frgalvan

so if 0 <= b1 <= 1 && 0 <= b2 <= 1 && b1 + b2 <= 1,
its safe to say the point lies inside the triangle? it This exhaustive? or does it require some sort of near by (epsilon) factor for accuracy?

frgalvan

so I just implemented what I was asking about. Can Confirm

Chengjie-Z

I think using the formula in this slide can compute t, b_1 and b_2. Then we need to determine whether they are in proper scope.

For those interested: https://www.scratchapixel.com/lessons/3d-basic-rendering/ray-tracing-rendering-a-triangle/moller-trumbore-ray-triangle-intersection

How is the cost compared across divisions, multiplications, and additions? i.e. is there a single value that could be calculated to determine how fast it would be without actually running the algorithm? Would that depend on the computer used to calculate the algorithm?

Different operations are sometimes different speeds, depending on the implementation for that language. You can determine asymptotic speeds based of input sizes if you look at different algorithms used. Such as https://en.wikipedia.org/wiki/Karatsuba_algorithm, which speeds up multiplication from n^2 to n^(log_2(3)).

so if 0 <= b1 <= 1 && 0 <= b2 <= 1 && b1 + b2 <= 1, its safe to say the point lies inside the triangle? it This exhaustive? or does it require some sort of near by (epsilon) factor for accuracy?

so I just implemented what I was asking about. Can Confirm

I think using the formula in this slide can compute t, b_1 and b_2. Then we need to determine whether they are in proper scope.