/// <summary> /// Compute the principal curvature scalar values at a given vertex. /// </summary> /// <param name="vertex">Vertex to compute the curvature.</param> /// <returns>Returns an array of 2 values {k1, k2}.</returns> public static double[] PrincipalCurvatures(MeshVertex vertex) { var a = CircumcentricDualArea(vertex); var h = ScalarMeanCurvature(vertex) / a; var k = AngleDefect(vertex) / a; var discriminant = h * h - k; if (discriminant > 0) { discriminant = Math.Sqrt(discriminant); } else { discriminant = 0; } var k1 = h - discriminant; var k2 = h + discriminant; return(new[] { k1, k2 }); }
/// <summary> /// Compute the principal curvature scalar values at a given vertes. /// </summary> /// <param name="vertex">Vertex to compute the curvature.</param> /// <returns>Returns an array of 2 values {k1, k2}.</returns> public static double[] PrincipalCurvatures(MeshVertex vertex) { double a = CircumcentricDualarea(vertex); double h = ScalarMeanCurvature(vertex) / a; double k = AngleDefect(vertex) / a; double discriminant = (h * h) - k; if (discriminant > 0) { discriminant = Math.Sqrt(discriminant); } else { discriminant = 0; } double k1 = h - discriminant; double k2 = h + discriminant; return(new double[] { k1, k2 }); }
/// <summary> /// Compute the Gaussian curvature at the given vertex. /// </summary> /// <param name="vertex">Vertex to compute Gaussian curvature.</param> /// <returns>Number representing the gaussian curvature at that vertex.</returns> public static double ScalarGaussCurvature(MeshVertex vertex) => AngleDefect(vertex) / CircumcentricDualArea(vertex);
/// <summary> /// Compute the Gaussian curvature at the given vertex. /// </summary> /// <param name="vertex">Vertex to compute Gaussian curvature.</param> /// <returns>Number representing the gaussian curvature at that vertex.</returns> public static double ScalarGaussCurvature(MeshVertex vertex) { return(AngleDefect(vertex) / MeshGeometry.CircumcentricDualarea(vertex)); }