Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="TV"></typeparam>
        /// <typeparam name="TE"></typeparam>
        public static void WriteToJson(HeGraph3d graph, string path)
        {
            WriteToJson <HeGraph3d.Vertex, HeGraph3d.Halfedge, double[], double[]>(graph, path, ToJson);

            double[] ToJson(HeGraph3d.Vertex vertex)
            {
                var p = vertex.Position;
                var n = vertex.Normal;

                return(new double[] { p.X, p.Y, p.Z, n.X, n.Y, n.Z });
            }
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="path"></param>
        /// <param name="graph"></param>
        /// <param name="setVertexAttributes"></param>
        /// <param name="setHedgeAttributes"></param>
        public static void ReadFromJson(string path, HeGraph3d graph)
        {
            ReadFromJson <HeGraph3d.Vertex, HeGraph3d.Halfedge, double[], double[]>(path, graph, FromJson);

            void FromJson(HeGraph3d.Vertex vertex, double[] values)
            {
                vertex.Position = new Vec3d(
                    values[0],
                    values[1],
                    values[2]);

                vertex.Normal = new Vec3d(
                    values[3],
                    values[4],
                    values[5]);
            }
        }