vector - Ray-tracer in C, Ray-plane intersection -



vector - Ray-tracer in C, Ray-plane intersection -

im working on raytracer in c. trying figure out math ray-plane intersection. have

d = ((po-lo) (dot) n) / (l (dot) n)

now if correct...

n - planes normal ray po = single point on plane l = vector represents ray shooting lo = point on line

i confused how works. point on line (lo) need land on plane if going pixel pixel? if true couldn't represent point direction vector of ray (l) casting?

i sense on complicating utterly lost on how working in code.

edit:

d = scalar in real world domain.

so d needs equal 0 in order plane , ray (at point i'm looking at) intersect? , can utilize direction vector coordinates represent point on line>

for point p on plane, equation true:

dot(po-p,n) = 0

for point p on line, equation true:

p = lo+l*d

if point going both on plane , on line (the intersection), both must true. hence can substitute:

dot(po-(lo+l*d),n) = 0

by doing algebra, can solve d:

dot((po-lo)-l*d),n) = 0 dot(po-lo,n) - dot(l*d,n) = 0 dot(po-lo,n) - d*dot(l,n) = 0 dot(po-lo,n) = d*dot(l,n) d = dot(po-lo,n)/dot(l,n)

c vector intersection

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -