Is it the best way to calculate normal?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Wodzu
Posts: 27
Joined: Wed May 07, 2014 5:41 pm

Is it the best way to calculate normal?

Post by Wodzu »

Hi,

I just want to make sure that there is no other way in Irrlicht for calculating normal other than this?

Code: Select all

 
core::plane3df(vertex[2],vertex[1],vertex[0]).Normal
 
I mean creating an object (plane3df) for calculating a normal seems a bit heavy for me. I know I could just write my own function but I wonder if there is such function by default in Irrlicht?

Thanks for your time.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Is it the best way to calculate normal?

Post by CuteAlien »

core::triangle3df has also a getNormal. Or you just copy the implementation: (pointB - pointA).crossProduct(pointC - pointA);

edit: (but stack objects are not expensive anyway, so don't worry too much)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Wodzu
Posts: 27
Joined: Wed May 07, 2014 5:41 pm

Re: Is it the best way to calculate normal?

Post by Wodzu »

Thanks for a quicky reply!

I just like to know all my possibilities:)

Thanks again.
Post Reply