/// <summary> /// Returns the unitized sum of halfedge normals around the vertex. /// </summary> /// <returns></returns> public static Vec3d GetNormal <V, E, F>(this IHeVertex <V, E, F> vertex, Func <V, Vec3d> getPosition) where V : IHeVertex <V, E, F> where E : IHalfedge <V, E, F> where F : IHeFace <V, E, F> { return(vertex.OutgoingHalfedges.Where(he => !he.IsHole).Sum(he => he.GetNormal(getPosition)).Direction); }
/// <summary> /// Returns the unitized sum of halfedge normals around the vertex. /// </summary> /// <returns></returns> public static Vec3d GetNormal <V, E, F>(this IHeVertex <V, E, F> vertex) where V : IHeVertex <V, E, F>, IVertex3d where E : IHalfedge <V, E, F> where F : IHeFace <V, E, F> { return(GetNormal(vertex, IVertex3dStatic <V> .GetPosition)); }
/// <summary> /// Returns the unitized sum of halfedge normals around the vertex. /// </summary> /// <returns></returns> public static Vec3d GetNormal <V, E, F>(this IHeVertex <V, E, F> vertex, Func <E, Vec3d> getNormal) where V : IHeVertex <V, E, F> where E : IHalfedge <V, E, F> where F : IHeFace <V, E, F> { Vec3d result = vertex.OutgoingHalfedges.Sum(getNormal); result.Unitize(); return(result); }