/// <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); HeMesh3d hem = new HeMesh3d(); }
/// <summary> /// /// </summary> /// <typeparam name="TV"></typeparam> /// <typeparam name="TE"></typeparam> public static void WriteToJson(HeMesh3d mesh, string path) { WriteToJson <HeMesh3d.Vertex, HeMesh3d.Halfedge, HeMesh3d.Face, double[], double[], double[]>(mesh, path, ToJson); double[] ToJson(HeMesh3d.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 }); } }
/// <summary> /// /// </summary> /// <param name="path"></param> /// <param name="mesh"></param> /// <param name="setVertexAttributes"></param> /// <param name="setHedgeAttributes"></param> public static void ReadFromJson(string path, HeMesh3d mesh) { ReadFromJson <HeMesh3d.Vertex, HeMesh3d.Halfedge, HeMesh3d.Face, double[], double[], double[]>(path, mesh, FromJson); void FromJson(HeMesh3d.Vertex vertex, double[] values) { vertex.Position = new Vec3d( values[0], values[1], values[2]); vertex.Normal = new Vec3d( values[3], values[4], values[5]); } }
/// <summary> /// /// </summary> /// <typeparam name="V"></typeparam> /// <typeparam name="E"></typeparam> /// <typeparam name="F"></typeparam> /// <param name="mesh"></param> /// <param name="start"></param> /// <param name="setEdge"></param> public static void Unroll(HeMesh3d mesh, HeMesh3d.Face start, Action <HeMesh3d.Vertex, Vec3d> setUnrolledPosition, Func <HeMesh3d.Halfedge, double> getUnrollFactor = null) { Unroll(mesh, start, HeMesh3d.Vertex.Accessors.Position, setUnrolledPosition, getUnrollFactor); }
/// <summary> /// /// </summary> /// <typeparam name="V"></typeparam> /// <typeparam name="E"></typeparam> /// <typeparam name="F"></typeparam> /// <param name="mesh"></param> /// <param name="start"></param> /// <param name="setEdge"></param> public static void DetachFaceCycles(HeMesh3d mesh, HeMesh3d.Face start) { DetachFaceCycles(mesh, start, Set); }