IDS peak ICV v1.3.0
Loading...
Searching...
No Matches
PointCloudWriter.cs
Go to the documentation of this file.
1using System.Runtime.InteropServices;
4
6
12public class PointCloudWriter
13{
45 public void Write(string filePath, PointCloud pointCloud)
46 {
47 if (string.IsNullOrWhiteSpace(filePath))
48 {
49 throw new IcvIOException("File path must not be null or empty.");
50 }
51
52 var finalPath = filePath.EndsWith(".ply", StringComparison.OrdinalIgnoreCase)
53 ? filePath
54 : filePath + ".ply";
55
56 var saveOptions = new Backend.Types.peak_icv_point_cloud_save_options();
57
58 DllHelper.ExecuteAndMapReturnCodes(() =>
59 CInterface.peak_icv_PointCloud_SaveToFile(pointCloud._handle, Utils.ToUtf8(finalPath), saveOptions));
60 }
61
62 private static class CInterface
63 {
64 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
65 public static extern Backend.Types.peak_icv_status peak_icv_PointCloud_SaveToFile(
66 PointCloud.Handle pointCloud,
67 byte[] filePath,
68 Backend.Types.peak_icv_point_cloud_save_options options);
69 }
70}
Provides functionality to write point clouds to file.
void Write(string filePath, PointCloud pointCloud)
Saves the specified point cloud to a PLY file.
Occurs when a file operation fails (e.g., missing file, insufficient permissions, or inaccessible dir...
Definition Exception.cs:167
Represents the base for all point clouds.
Definition PointCloud.cs:12