Jump to content

Getting normal of a plane


danielv
 Share

Recommended Posts

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---T

Take (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

 

 

Link to comment
Share on other sites

  • 5 months later...

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 ?

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...