Equations
Postby hazestalker » Thu Feb 06, 2014 1:30 am
solve(y1=3,y2=4,y3=1,x1=8,x2=3,x3=4,z1=7,z2=1,z3=5, nx = ((y1-y2)*(z1-z3))-((z1-z2)*(y1-y3)), nz = ((x1-x2)*(y1-y3))-((y1-y2)*(x1-x3)), ny = ((z1-z2)*(x1-x3))-((x1-x2)*(z1-z3)),nx,ny,nz)
why does not work?
You are trying to ray trace a triangular facet at normal vector angles
Either it's too opaque or your video pix do not have sufficient power for observation.
One of these adjustments might approximate close enough for finer adjustment.
Use appropriate prefix for compute normal (you did not specify)
Also post it in this form, it's easier to read. I almost ignored it as it looked like a snarky post. (I still wonder?)
computing the normal to a triangular facet (~273)
compute_normal(x1, y1, z1, x2, y2, z2, x3, y3, z3):
nx = (z2-z1)*(y3-y2) - (y2-y1)*(x3-x2)
ny = (x2-x1)*(z3-z2) - (z2-z1)*(y3-y2)
nz = (y2-y1)*(z3-z2)- (x2-x1)*(x3-x2)
return (nx,ny,nz)
computing the normal to a triangular facet (~114)
compute_normal(x1, y1, z1, x2, y2, z2, x3, y3, z3):
nx = (y2-y1)*(z3-z2) - (z2-z1)*(y3-y2)
ny = (z2-z1)*(x3-x2) - (x2-x1)*(z3-z2)
nz = (x2-x1)*(y3-y2) - (y2-y1)*(x3-x2)
return (nx,ny,nz)
***********
~~D~~