Jump to content
  • Advertisement
Sign in to follow this  

Calculate normal vectors for 'elliptic' torus

This topic is 1384 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all!


I'm struggling with the calculation of normal vectors for a kind of elliptic torus with the parametric form:

x = (a + r * cos(v)) * cos(u)

y = (b + r * cos(v)) * sin(u)

z = r * sin(v)


If a = b the normal vector is calculated as follows:

nx = x - a * cos(u)
ny = y - b * sin(u)

nz = z


But this does not work for a != b.

Any help is very welcome!


Best Regards









Share this post

Link to post
Share on other sites
You can always compute the partial derivative of (x,y,z) with respect to u and with respect to v, and then take their cross product. You can then scale it by any amount you want. For instance, if you divide by r, I think you get:

nx = cos(u) * cos(v) * (b + r * cos(v))
ny = sin(u) * cos(v) * (a + r * cos(v))
nz = sin(v) * (cos(u)^2 * (b + r * cos(v)) + sin(u)^2 * (a + r * cos(v)))

But perhaps I made a mistake somewhere.

EDIT: I just saw a simplification for nz:
nz = sin(v) * (cos(u)^2 * b + sin(u)^2 * a + r * cos(v)) Edited by Álvaro

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!