Пример #1
0
 /// <summary>
 ///     Computes the circumcentric dual area around a given mesh vertex.
 /// </summary>
 /// <returns>The dual area.</returns>
 /// <param name="vertex">Vertex.</param>
 public static double CircumcentricDualArea(MeshVertex vertex)
 {
     return((from hE in vertex.AdjacentHalfEdges()
             let u2 = Vector(hE.Prev).LengthSquared
                      let v2 = Vector(hE).LengthSquared
                               let cotAlpha = Cotan(hE.Prev)
                                              let cotBeta = Cotan(hE)
                                                            select(u2 * cotAlpha + v2 * cotBeta) / 8).Sum());
 }
Пример #2
0
        /// <summary>
        ///     Compute the Mean curvature at the given vertex.
        /// </summary>
        /// <param name="vertex">Vertex to compute Mean curvature.</param>
        /// <returns>Number representing the Mean curvature at that vertex.</returns>
        public static double ScalarMeanCurvature(MeshVertex vertex)
        {
            var sum = 0.0;

            foreach (var hE in vertex.AdjacentHalfEdges())
            {
                sum += 0.5 * Length(hE.Edge) * DihedralAngle(hE);
            }
            return(sum);
        }
Пример #3
0
        /// <summary>
        ///     Computes the mean curvature weighted normal around the specified vertex.
        /// </summary>
        /// <returns>The normal vector at that vertex.</returns>
        /// <param name="vertex">Vertex.</param>
        public static Vector3d VertexNormalMeanCurvature(MeshVertex vertex)
        {
            var n = new Vector3d();

            foreach (var hE in vertex.AdjacentHalfEdges())
            {
                var weight = 0.5 * Cotan(hE) + Cotan(hE.Twin);
                n -= Vector(hE) * weight;
            }

            return(n.Unit());
        }
Пример #4
0
        /// <summary>
        ///     Computes the gauss curvature weighted normal around the specified vertex.
        /// </summary>
        /// <returns>The normal vector at that vertex.</returns>
        /// <param name="vertex">Vertex.</param>
        public static Vector3d VertexNormalGaussCurvature(MeshVertex vertex)
        {
            var n = new Vector3d();

            foreach (var hE in vertex.AdjacentHalfEdges())
            {
                var weight = 0.5 * DihedralAngle(hE) / Length(hE.Edge);
                n -= Vector(hE) * weight;
            }

            return(n.Unit());
        }
Пример #5
0
        /// <summary>
        /// Computes the circumcentric dual area around a given mesh vertex.
        /// </summary>
        /// <returns>The dualarea.</returns>
        /// <param name="vertex">Vertex.</param>
        public static double CircumcentricDualarea(MeshVertex vertex)
        {
            double area = 0.0;

            foreach (MeshHalfEdge hE in vertex.AdjacentHalfEdges())
            {
                double u2       = Vector(hE.Prev).LengthSquared;
                double v2       = Vector(hE).LengthSquared;
                double cotAlpha = Cotan(hE.Prev);
                double cotBeta  = Cotan(hE);

                area += ((u2 * cotAlpha) + (v2 * cotBeta)) / 8;
            }

            return(area);
        }