Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting the normal from a point on a surface #55

Open
oveddan opened this issue Dec 16, 2016 · 2 comments
Open

Getting the normal from a point on a surface #55

oveddan opened this issue Dec 16, 2016 · 2 comments

Comments

@oveddan
Copy link

oveddan commented Dec 16, 2016

Lets say you have a single point on a surface, and you want to get its normal. The surface is generated procedurally.

What would be the proper way to get the normal of a point if you can sample nearby positions and get their position on the surface?

@oveddan oveddan changed the title Getting a normal from a point Getting a normal from a point on a surface Dec 16, 2016
@oveddan oveddan changed the title Getting a normal from a point on a surface Getting the normal from a point on a surface Dec 16, 2016
@danielepanozzo
Copy link
Owner

  1. If your surface is defined explicitly with a C1 function f(u,v) -> x,y,z you can simply take the cross product of its 2 two partial derivatives (df/dx cross df/dy)

  2. If 1 does not apply, you can sample a few nearby points, fit a plane in the least square (http://stackoverflow.com/questions/1400213/3d-least-squares-plane) and then use the normal of the plane. In this case, you have to be careful to always pick a consistent orientation for all your normals.

@oveddan
Copy link
Author

oveddan commented Dec 18, 2016

thank you, that helped!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants