示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="path"></param>
        private void ExportTetrahedra()
        {
            var tetraPts = GetTetrahedraCoords();

            CoreIO.SerializeBinary(tetraPts, _exportPath);
            Debug.Log($"Tetrahedra exported to {_exportPath}");
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="path"></param>
        /// <param name="graph"></param>
        /// <param name="setVertexAttributes"></param>
        /// <param name="setHedgeAttributes"></param>
        public static void ReadFromJson <V, E, VA, EA>(string path, HeGraph <V, E> graph, Action <V, VA> setVertexAttributes = null, Action <E, EA> setHedgeAttributes = null)
            where V : HeGraph <V, E> .Vertex
            where E : HeGraph <V, E> .Halfedge
        {
            var buffer = CoreIO.DeserializeJson <HeGraphJsonBuffer <VA, EA> >(path);

            buffer.ReadTo(graph, setVertexAttributes, setHedgeAttributes);
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="path"></param>
        /// <param name="graph"></param>
        /// <param name="setVertexAttributes"></param>
        /// <param name="setHedgeAttributes"></param>
        public static void ReadFromJson <TV, TE>(string path, HeGraphBase <TV, TE> graph, Action <TV, object[]> setVertexAttributes = null, Action <TE, object[]> setHedgeAttributes = null)
            where TV : HeGraphBase <TV, TE> .Vertex
            where TE : HeGraphBase <TV, TE> .Halfedge
        {
            var buffer = CoreIO.DeserializeJson <HeJsonBuffer>(path);

            buffer.ReadTo(graph, setVertexAttributes, setHedgeAttributes);
        }
示例#4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="path"></param>
        /// <param name="graph"></param>
        /// <param name="setVertexAttributes"></param>
        /// <param name="setHedgeAttributes"></param>
        public static void ReadFromJson <V, E, F, VA, EA, FA>(string path, HeMesh <V, E, F> mesh, Action <V, VA> setVertexAttributes = null, Action <E, EA> setHedgeAttributes = null, Action <F, FA> setFaceAttributes = null)
            where V : HeMesh <V, E, F> .Vertex
            where E : HeMesh <V, E, F> .Halfedge
            where F : HeMesh <V, E, F> .Face
        {
            var buffer = CoreIO.DeserializeJson <HeMeshJsonBuffer <VA, EA, FA> >(path);

            buffer.ReadTo(mesh, setVertexAttributes, setHedgeAttributes, setFaceAttributes);
        }
示例#5
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="V"></typeparam>
        /// <typeparam name="E"></typeparam>
        public static void WriteToJson <V, E, VA, EA>(HeGraph <V, E> graph, string path, Func <V, VA> getVertexAttributes = null, Func <E, EA> getHedgeAttributes = null)
            where V : HeGraph <V, E> .Vertex
            where E : HeGraph <V, E> .Halfedge
        {
            var buffer = new HeGraphJsonBuffer <VA, EA>();

            buffer.WriteFrom(graph, getVertexAttributes, getHedgeAttributes);
            CoreIO.SerializeJson(buffer, path);
        }
示例#6
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="TV"></typeparam>
        /// <typeparam name="TE"></typeparam>
        public static void WriteToJson <TV, TE>(HeGraphBase <TV, TE> graph, string path, Func <TV, IEnumerable <object> > getVertexAttributes = null, Func <TE, IEnumerable <object> > getHedgeAttributes = null)
            where TV : HeGraphBase <TV, TE> .Vertex
            where TE : HeGraphBase <TV, TE> .Halfedge
        {
            var buffer = new HeJsonBuffer();

            buffer.WriteFrom(graph, getVertexAttributes, getHedgeAttributes);
            CoreIO.SerializeJson(buffer, path);
        }
示例#7
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="V"></typeparam>
        /// <typeparam name="E"></typeparam>
        public static void WriteToJson <V, E, F, VA, EA, FA>(HeMesh <V, E, F> mesh, string path, Func <V, VA> getVertexAttributes = null, Func <E, EA> getHedgeAttributes = null, Func <F, FA> getFaceAttributes = null)
            where V : HeMesh <V, E, F> .Vertex
            where E : HeMesh <V, E, F> .Halfedge
            where F : HeMesh <V, E, F> .Face
        {
            var buffer = new HeMeshJsonBuffer <VA, EA, FA>();

            buffer.WriteFrom(mesh, getVertexAttributes, getHedgeAttributes, getFaceAttributes);
            CoreIO.SerializeJson(buffer, path);
        }
示例#8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="path"></param>
        /// <param name="graph"></param>
        /// <param name="setVertexAttributes"></param>
        /// <param name="setHedgeAttributes"></param>
        public static void ReadFromJson <TV, TE, TF>(string path, HeMeshBase <TV, TE, TF> mesh, Action <TV, object[]> setVertexAttributes = null, Action <TE, object[]> setHedgeAttributes = null, Action <TF, object[]> setFaceAttributes = null)
            where TV : HeMeshBase <TV, TE, TF> .Vertex
            where TE : HeMeshBase <TV, TE, TF> .Halfedge
            where TF : HeMeshBase <TV, TE, TF> .Face
        {
            //var buffer = CoreIO.DeserializeJson<HeMeshJsonBuffer>(path);
            var buffer = CoreIO.DeserializeJson <HeJsonBuffer>(path);

            buffer.ReadTo(mesh, setVertexAttributes, setHedgeAttributes, setFaceAttributes);
        }