add command line tool for converting scans without server
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PointCloudWeb.Server\PointCloudWeb.Server.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,49 @@
|
||||
using PointCloudWeb.Server.Models;
|
||||
using PointCloudWeb.Server.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace PointCloudWeb.Server.ScanConverter
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
var scanPoints = File.ReadAllLines("C:\\Users\\timwu\\Desktop\\Scans\\0yGrad-edited-scan.csv")
|
||||
.Select(v => ScanDataPointFromCsv(v))
|
||||
.Where(scan => scan.DistanceMM > 0)
|
||||
.ToList();
|
||||
|
||||
var result = new List<Point>();
|
||||
var converter = new ScanConverterService();
|
||||
|
||||
foreach (var scan in scanPoints)
|
||||
{
|
||||
result.Add(converter.Transform(scan));
|
||||
//Console.WriteLine(result.Count + ":: " + scan.ToString() + " => " + result[result.Count - 1].ToString());
|
||||
}
|
||||
|
||||
result.RemoveAll(point => point.X == 0 && point.Y == 0 & point.Z == 0);
|
||||
|
||||
string csv = String.Join("\n", result.Select(point => point.X + ", " + point.Y + ", " + point.Z).ToArray());
|
||||
|
||||
File.WriteAllText("C:\\Users\\timwu\\Desktop\\Scans\\0yGrad-pc.csv", csv);
|
||||
|
||||
Console.WriteLine("Convert finished");
|
||||
Console.ReadLine();
|
||||
}
|
||||
|
||||
private static ScanDataPoint ScanDataPointFromCsv(string csvLine)
|
||||
{
|
||||
string[] values = csvLine.Split(',');
|
||||
return new ScanDataPoint(
|
||||
ray: Convert.ToDouble(values[0], CultureInfo.InvariantCulture),
|
||||
rax: Convert.ToDouble(values[1], CultureInfo.InvariantCulture),
|
||||
distanceMM: Convert.ToInt32(values[2], CultureInfo.InvariantCulture)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PointCloudWeb.Server", "Poi
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PointCloudWeb.Server.Tests", "PointCloudWeb.Server.Tests\PointCloudWeb.Server.Tests.csproj", "{A2493168-0373-460F-8F1D-48F62ED804BA}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PointCloudWeb.Server.ScanConverter", "PointCloudWeb.Server.ScanConverter\PointCloudWeb.Server.ScanConverter.csproj", "{BC69BBF4-FA13-44F4-97C3-2D49E4951087}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{BD246537-F063-4A5A-8957-AF25E021132D} = {BD246537-F063-4A5A-8957-AF25E021132D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -21,6 +26,10 @@ Global
|
||||
{A2493168-0373-460F-8F1D-48F62ED804BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A2493168-0373-460F-8F1D-48F62ED804BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A2493168-0373-460F-8F1D-48F62ED804BA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BC69BBF4-FA13-44F4-97C3-2D49E4951087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BC69BBF4-FA13-44F4-97C3-2D49E4951087}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BC69BBF4-FA13-44F4-97C3-2D49E4951087}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BC69BBF4-FA13-44F4-97C3-2D49E4951087}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
Reference in New Issue
Block a user