/// <summary> /// Returns the unitized sum of halfedge normals in the face. /// </summary> /// <returns></returns> public static Vec3d GetNormal <V, E, F>(this HeFace <V, E, F> face, Func <E, Vec3d> getNormal) where V : HeVertex <V, E, F> where E : Halfedge <V, E, F> where F : HeFace <V, E, F> { if (face.IsDegree(3)) { return(getNormal(face.First).Unit); } else { return(face.Halfedges.Sum(getNormal).Unit); } }
/// <summary> /// Returns the unitized sum of halfedge normals in the face. /// </summary> /// <returns></returns> public static Vec3d GetNormal <V, E, F>(this HeFace <V, E, F> face, Func <V, Vec3d> getPosition) where V : HeVertex <V, E, F> where E : Halfedge <V, E, F> where F : HeFace <V, E, F> { if (face.IsDegree(3)) { return(face.First.GetNormal(getPosition).Unit); } else { return(face.Halfedges.Sum(he => he.GetNormal(getPosition)).Unit); } }