face
and append it as 3 floats to seq
Resulting normals are not normalized.
# Compute the normal of `face` and append it as 3 floats to `seq`
#
# Resulting normals are not normalized.
fun compute_and_append_normal(seq: Sequence[Float], face: ObjFace)
do
var i1 = face.vertices[0].vertex_point_index
var i2 = face.vertices[1].vertex_point_index
var i3 = face.vertices[2].vertex_point_index
var v1 = obj_def.vertex_points[i1-1]
var v2 = obj_def.vertex_points[i2-1]
var v3 = obj_def.vertex_points[i3-1]
var vx = v2.x - v1.x
var vy = v2.y - v1.y
var vz = v2.z - v1.z
var wx = v3.x - v1.x
var wy = v3.y - v1.y
var wz = v3.z - v1.z
var nx = (vy*wz) - (vz*wy)
var ny = (vz*wx) - (vx*wz)
var nz = (vx*wy) - (vy*wx)
# Append to `seq`
seq.add nx
seq.add ny
seq.add nz
end
lib/gamnit/depth/more_models.nit:376,2--404,4