コード例 #1
0
        public void ComputeResults(AlgoStep step, string inputPath, string outputPath, string outputPathTxt)
        {
            var hdLog = Program.Path(Subfolder.none, $"result_hausdorff_{ao.name}_{step.qualityStr}", Ext.txt);

            if (File.Exists(hdLog))
            {
                File.Delete(hdLog);
            }

            var hd = MeshlabWorkspace.Instance.RunFilter_HausdorffDistance(inputPath, outputPath, hdLog);

            if (File.Exists(outputPathTxt))
            {
                hd.time = long.Parse(File.ReadAllText(outputPathTxt));
            }

            Results.Result res = new Results.Result()
            {
                path = outputPath,
                step = step,
                hd   = hd
            };

            results.bboxDiag = res.hd.bboxDiag;
            results.AddResult(res);

            if (File.Exists(hdLog))
            {
                File.Delete(hdLog);
            }
        }
コード例 #2
0
 protected override void Run_Impl(AlgoStep step, string inputPath, string outputPath)
 {
     var fileName = Regex.Match(inputPath, @"\w+(?:\.\w+)*$").Value;
     var ofs = GenerateOFS(step.faceCount, fileName, outputPath, openFlipperOptions.type, openFlipperOptions.order);
     var ofsPath = Program.Path(Subfolder.none,"decimator", Ext.ofs);
     File.WriteAllText(ofsPath, ofs);
     Cli.Run($@"–no-splash {inputPath} {ofsPath}", ao.workspace.exePath);
 }
コード例 #3
0
 public void Run(AlgoStep step, string inputPath, string outputPath)
 {
     Run_Impl(step, inputPath, outputPath);
     if (!File.Exists(outputPath))
     {
         throw new Exception("Failed to produce output");
     }
 }
コード例 #4
0
        protected override void Run_Impl(AlgoStep step, string inputPath, string outputPath)
        {
            //path to for (*.m)
            var mFile = Regex.Replace(inputPath, @"\w+$", "m");

            if (!File.Exists(mFile))
            {
                //convert input to (*.m)
                var args   = $"{Program.scripts["objtoMesh.pl"]} {inputPath}";
                var output = PerlWorkspace.Instance.RunWithOutput(args);
                File.WriteAllText(mFile, output);
            }
            //TODO : Assert file exits?
            var tmproot = Regex.Replace(inputPath, @"\.\w+$", "");
            var pm_File = $"{tmproot}.pm";

            if (!File.Exists(pm_File))
            {
                var base_m_File = $"{tmproot}.base.m";
                var prog_File   = $"{tmproot}.prog";

                //reads the original mesh and randomly samples points over its surface,
                //progressively simplifies it by examining point residual distances, while recording changes to a *.prog file, and
                //writes the resulting base mesh.
                Execute("MeshSimplify", base_m_File, $"{mFile} -prog {prog_File} -simplify");

                var rprog_File = $"{tmproot}.rprog";
                //The next step is to reverse the sequence of stored edge collapses, i.e. forming a progressive sequence of vertex splits:
                Execute("reverselines", rprog_File, $"{tmproot}.prog");

                //We construct a concise progressive mesh by encoding the base mesh together with
                //the sequence of vertex splits that exactly recover the original mesh:
                Execute("Filterprog", pm_File, $"-fbase {base_m_File} -fprog {rprog_File} -pm");

                ///view progressive mesh
                //Execute("G3dOGL", $"{tmproot}.txt", $"-pm_mode {pm_File}");
            }
            var output_m = $"{tmproot}_{step.qualityStr}.m";

            Execute("FilterPM", output_m, $"{pm_File} -nf {step.faceCount} -outmesh");

            var argsC     = $"{Program.scripts["Meshtoobj.pl"]} {output_m}";
            var outputObj = PerlWorkspace.Instance.RunWithOutput(argsC);

            File.WriteAllText(outputPath, outputObj);
        }
コード例 #5
0
 protected abstract void Run_Impl(AlgoStep step, string inputPath, string outputPath);
コード例 #6
0
        protected override void Run_Impl(AlgoStep step, string inputPath, string outputPath)
        {
            var args = $@"-P {Program.scripts["decimate.py"]} -- --nfaces {step.faceCount} --inm {inputPath} --outm {outputPath}";

            Cli.Run(args, ao.workspace.exePath);
        }
コード例 #7
0
 protected override void Run_Impl(AlgoStep step, string inputPath, string outputPath)
 {
     Cli.Run($"-f {step.quality.Sanitize()} {inputPath} {outputPath}", ao.workspace.exePath);
 }
コード例 #8
0
 protected override void Run_Impl(AlgoStep step, string inputPath, string outputPath)
 {
     Cli.Run($"{inputPath} {outputPath} -t {step.faceCount}", ao.workspace.exePath);
 }