Skip to content

Instantly share code, notes, and snippets.

@Makio64
Created September 1, 2017 20:15
Show Gist options
  • Save Makio64/cffcbb652188c43c67c7a12555146857 to your computer and use it in GitHub Desktop.
Save Makio64/cffcbb652188c43c67c7a12555146857 to your computer and use it in GitHub Desktop.
calculate normal
Math.cross :
[a1, a2, a3] and B = [b1, b2, b3] is defined as:
cross(A, B) = [ a2 * b3 - a3 * b2, a3 * b1 - a1 * b3, a1 * b2 - a2 * b1 ]
for 3 points :
vNormal = normalize( cross(pos2.xyz-pos.xyz, pos3.xyz-pos.xyz) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment