Skip to content

Commit 81126b1

Browse files
authored
Merge pull request #16 from ViRGIS-Team/mesh-changes
Add face data to the C API and update C# Pinvoke examples
2 parents f9ff0a3 + 6977af8 commit 81126b1

File tree

15 files changed

+345
-68
lines changed

15 files changed

+345
-68
lines changed

.github/workflows/linux_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
uses: actions/checkout@v2
1212

1313
- name: Install Conda
14-
uses: conda-incubator/setup-miniconda@v1.7.0
14+
uses: conda-incubator/setup-miniconda@v2
1515

1616
- name: Install PDAL
1717
shell: bash -l {0}

.github/workflows/osx_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
uses: actions/checkout@v2
1212

1313
- name: Install Conda
14-
uses: conda-incubator/setup-miniconda@v1.7.0
14+
uses: conda-incubator/setup-miniconda@v2
1515

1616
- name: Install PDAL
1717
shell: bash -l {0}

.github/workflows/update_docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
> Doxyfile
3030
3131
- name: Run Doxygen
32-
uses: mattnotmitt/doxygen-action@v1.2.0
32+
uses: mattnotmitt/doxygen-action@v1.3.0
3333
with:
3434
doxyfile-path: 'docs/Doxyfile'
3535

.github/workflows/windows_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
uses: actions/checkout@v2
1212

1313
- name: Install Conda
14-
uses: conda-incubator/setup-miniconda@v1.7.0
14+
uses: conda-incubator/setup-miniconda@v2
1515

1616
- name: Install PDAL
1717
shell: pwsh

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ tests/pdal/test_pdalc_*.c
1818
.DS_Store
1919
# Build directory
2020
/build
21+
bin/
22+
obj/
2123

2224
# Prerequisites
2325
*.d
@@ -28,6 +30,7 @@ tests/pdal/test_pdalc_*.c
2830
*.o
2931
*.obj
3032
*.elf
33+
*.sln
3134

3235
# Linker output
3336
*.ilk
@@ -72,4 +75,4 @@ Data/
7275
Doxyfile
7376
*.tcl
7477

75-
Testing/
78+
Testing/

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Version 2.1.0
2+
3+
This version adds
4+
5+
- Access to face data in PDAL using the `GetMeshSize` and `getAllTriangles` methods,
6+
- Updates the sample C# P/Invoke scripts to add the Mesh functions and remove depedencies on Unity. Asdded .csproj files and improved some signatures
7+
- added more examples to readme.
8+
9+
# Version 2.0.0
10+
11+
This was the first version released through conda.

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,74 @@ An example of the use of the API is given in the `csharp` folder which contains
4141

4242
NOTE - these scripts are provided for information only as examples and are not supported in any way!
4343

44+
## Example C# Program
45+
46+
``` c#
47+
using System;
48+
using System.Collections.Generic;
49+
using Pdal;
50+
using Newtonsoft.Json;
51+
using g3;
52+
53+
namespace pdal_mesh
54+
{
55+
class Program
56+
{
57+
static void Main(string[] args)
58+
{
59+
Console.WriteLine("Hello World!");
60+
Config pdal = new Config();
61+
Console.WriteLine(pdal.Version);
62+
63+
List<object> pipe = new List<object>();
64+
pipe.Add(".../CAPI/tests/data/las/1.2-with-color.las");
65+
pipe.Add(new
66+
{
67+
type = "filters.splitter",
68+
length = 1000
69+
});
70+
pipe.Add(new
71+
{
72+
type = "filters.delaunay"
73+
});
74+
75+
string json = JsonConvert.SerializeObject(pipe.ToArray());
76+
77+
Pipeline pl = new Pipeline(json);
78+
79+
long count = pl.Execute();
80+
81+
Console.WriteLine($"Point Count is {count}");
82+
83+
using (PointViewIterator views = pl.Views) {
84+
views.Reset();
85+
86+
while (views.HasNext())
87+
{
88+
PointView view = views.Next;
89+
if (view != null)
90+
{
91+
Console.WriteLine($"Point Count is {view.Size}");
92+
Console.WriteLine($"Triangle Count is {view.MeshSize}");
93+
94+
BpcData pc = view.GetBakedPointCloud();
95+
96+
DMesh3 mesh = view.getMesh();
97+
98+
}
99+
}
100+
}
101+
}
102+
}
103+
}
104+
```
105+
106+
This takes a LAS file, splits the file into tiles and then creates a Delaunay Triangulation (i.e. Mesh) for each one.
107+
108+
This code uses the sample bindings as-is and has a dependency on [Geometry3Sharp](https://github.com/gradientspace/geometry3Sharp) only.
109+
110+
Note that `BcpData` is a custom data structure that holds the Point Cloud in a form suitable to create a [Baked PointCloud](https://medium.com/realities-io/point-cloud-rendering-7bd83c6220c8) suitable for rendering as a VFX graph in Unity. This is an efficient way to display point cloud data in VR and I have used it successfully with point clouds of 10 million points.
111+
44112
# For Developers
45113

46114
## Build on Windows

csharp/Config.cs

Lines changed: 13 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/******************************************************************************
22
* Copyright (c) 2019, Simverge Software LLC. All rights reserved.
33
*
4+
*
45
* Redistribution and use in source and binary forms, with or without
56
* modification, are permitted provided that the following
67
* conditions are met:
@@ -27,10 +28,9 @@ this list of conditions and the following disclaimer in the documentation
2728
* POSSIBILITY OF SUCH DAMAGE.
2829
*****************************************************************************/
2930

30-
using System.IO;
3131
using System.Runtime.InteropServices;
3232
using System.Text;
33-
using UnityEngine;
33+
using System;
3434

3535
namespace Pdal
3636
{
@@ -39,19 +39,17 @@ public class PdalConfiguration
3939
public static void ConfigurePdal()
4040
{
4141
Config config = new Config();
42-
Debug.Log("GDAL Data Path: " + config.GdalData);
43-
Debug.Log("Proj4 Data Path: " + config.Proj4Data);
44-
45-
Debug.Log("PDAL Version Integer: " + config.VersionInteger);
46-
Debug.Log("PDAL Version Major: " + config.VersionMajor);
47-
Debug.Log("PDAL Version Minor: " + config.VersionMinor);
48-
Debug.Log("PDAL Version Patch: " + config.VersionPatch);
49-
50-
Debug.Log("PDAL Full Version: " + config.FullVersion);
51-
Debug.Log("PDAL Version: " + config.Version);
52-
Debug.Log("PDAL SHA1: " + config.Sha1);
53-
Debug.Log("PDAL Debug Info: " + config.DebugInfo);
54-
}
42+
43+
Console.WriteLine("PDAL Version Integer: " + config.VersionInteger);
44+
Console.WriteLine("PDAL Version Major: " + config.VersionMajor);
45+
Console.WriteLine("PDAL Version Minor: " + config.VersionMinor);
46+
Console.WriteLine("PDAL Version Patch: " + config.VersionPatch);
47+
48+
Console.WriteLine("PDAL Full Version: " + config.FullVersion);
49+
Console.WriteLine("PDAL Version: " + config.Version);
50+
Console.WriteLine("PDAL SHA1: " + config.Sha1);
51+
Console.WriteLine("PDAL Debug Info: " + config.DebugInfo);
52+
}
5553
}
5654

5755
/**
@@ -109,39 +107,9 @@ public class Config
109107
*/
110108
public Config()
111109
{
112-
//string cwd = Environment.CurrentDirectory;
113110

114-
string gdalPath = Application.streamingAssetsPath;
115-
GdalData = Path.Combine(gdalPath, "gdal-data");
116-
Proj4Data = Path.Combine(gdalPath, "proj");
117111
}
118112

119-
/// The path to the GDAL data directory
120-
public string GdalData
121-
{
122-
get
123-
{
124-
StringBuilder buffer = new StringBuilder(256);
125-
getGdalDataPath(buffer, (uint) buffer.Capacity);
126-
return buffer.ToString();
127-
}
128-
129-
set { setGdalDataPath(value); }
130-
}
131-
132-
/// The path to the proj4 data directory
133-
public string Proj4Data
134-
{
135-
get
136-
{
137-
StringBuilder buffer = new StringBuilder(256);
138-
getProj4DataPath(buffer, (uint) buffer.Capacity);
139-
return buffer.ToString();
140-
}
141-
142-
set { setProj4DataPath(value); }
143-
}
144-
145113
/// The PDAL full version string with dot-separated major, minor, and patch version numbers and PDAL commit SHA1
146114
public string FullVersion
147115
{

0 commit comments

Comments
 (0)