danielv Posted November 1, 2014 Share Posted November 1, 2014 Hello everyone! First post! I have been playing around with bablyon (you can guess, I am not a pro graphics programmer) and the first issue I bumped into is: is there a simple way to get the normal of a surface? If not, I was thinking on using the following to calculate the normal of a plane.P---Q| |R---TTake (P-T) × (Q-R). Basically have the cross product of the plane's diagonals. Is it at all a good solution? Is there a better or simpler way to do this? Thanks Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 3, 2014 Share Posted November 3, 2014 Welcome You are right. Just do the following:var v1v2 = Q.subtract(P);var v2v3 = T.subtract(Q);var normal = BABYLON.Vector3.Cross(v1v2, v2v3); Quote Link to comment Share on other sites More sharing options...
dsman Posted May 3, 2015 Share Posted May 3, 2015 So I have exact four corner points of plane mesh. (Not just any point on plane mesh . But real corner points) . Assume P,Q,R,T Resulting normal from both of follow code block A and code block B is different. Why is it so ? CODE BLOCK A : var v1v2 = P.subtract(T);var v2v3 = Q.subtract(R);var normal = BABYLON.Vector3.Cross(v1v2, v2v3);CODE BLOCK B : var v1v2 = Q.subtract(P);var v2v3 = T.subtract(R);var normal = BABYLON.Vector3.Cross(v1v2, v2v3);In case of BLOCK B I get normal = (0,0,0) Am I being dumb here ? Quote Link to comment Share on other sites More sharing options...
jerome Posted May 3, 2015 Share Posted May 3, 2015 Cross product of two collinear (parallel) vectors is null.Check your vector (or points) order. JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.