AcDbPointCloudApi.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2015 Autodesk, Inc. All rights reserved.
  4. //
  5. // Use of this software is subject to the terms of the Autodesk license
  6. // agreement provided at the time of installation or download, or which
  7. // otherwise accompanies this software in either electronic or hard copy form.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. #pragma once
  11. #include "gepnt3d.h"
  12. #include "gevec3d.h"
  13. /// <summary>
  14. /// A data buffer that collects point data for a point cloud.
  15. /// </summary>
  16. class __declspec(novtable) IAcDbPointCloudDataBuffer
  17. {
  18. public:
  19. enum DataType
  20. {
  21. kIntensity = 0x00000001,
  22. kClassification = 0x00000002,
  23. kColor = 0x00000004,
  24. kNormal = 0x00000008,
  25. };
  26. typedef Adesk::UInt8 RGBA[4];
  27. virtual ~IAcDbPointCloudDataBuffer() = 0 {};
  28. /// <summary>
  29. /// Returns the number of points in this buffer
  30. /// </summary>
  31. virtual Adesk::UInt64 numPoints() const = 0;
  32. /// <summary>
  33. /// Returns a pointer to the array of points
  34. /// </summary>
  35. virtual const AcGePoint3d* points() const = 0;
  36. /// <summary>
  37. /// Returns a pointer to the array of point normals, or NULL if not available
  38. /// </summary>
  39. virtual const AcGeVector3d* normals() const = 0;
  40. /// <summary>
  41. /// Returns the pointer to the array of point colors, or NULL if not available.
  42. /// Note that RGB corresponds to red, green, blue color values. The "A" value is reserved for internal usage.
  43. /// </summary>
  44. virtual const RGBA* colors() const = 0;
  45. /// <summary>
  46. /// Returns the pointer to the array of point intensities, or NULL if not available
  47. /// </summary>
  48. virtual const Adesk::UInt8* intensity() const = 0;
  49. /// <summary>
  50. /// Returns the pointer to the array of point classifications, or NULL if not available
  51. /// </summary>
  52. virtual const Adesk::UInt8* classifications() const = 0;
  53. /// <summary>
  54. /// Gives the matrix that transforms this buffer's points from its local coordinate system to WCS.
  55. /// </summary>
  56. virtual const AcGeMatrix3d& transform() const = 0;
  57. /// <summary>
  58. /// Releases this buffer's allocated memory.
  59. /// </summary>
  60. virtual void freeObject() = 0;
  61. /// <summary>
  62. /// Reserved for internal use. Do not call this method.
  63. /// </summary>
  64. virtual void* getBuffer() const = 0;
  65. };
  66. /// <summary>
  67. /// Implement this interface to filter points based on point's coordinate.
  68. /// Efficiency of the implementation of this interface can affect
  69. /// performance of the point cloud rendering.
  70. /// </summary>
  71. class __declspec(novtable) IAcDbPointCloudSpatialFilter
  72. {
  73. public:
  74. /// <summmary>
  75. /// Represents whether a given point is inside, outside, or in the edge of a filter.
  76. /// </summmary>
  77. enum FilterResult { FILTER_INSIDE = 0, FILTER_OUTSIDE, FILTER_INTERSECTS };
  78. /// <summmary>
  79. /// Destructor
  80. /// </summmary>
  81. virtual ~IAcDbPointCloudSpatialFilter() = 0 {};
  82. /// <summary>
  83. /// Tests whether an axis-aligned box is inside, outside or on the border of the volume of interest.
  84. /// </summary>
  85. /// <param name="min">Min coordinate value of the cell</param>
  86. /// <param name="max">Max coordinate value of the cell</param>
  87. ///
  88. /// <returns>
  89. /// FILTER_OUTSIDE -- the box is fully rejected (outside the volume of interest)
  90. /// FILTER_INSIDE -- the box is fully accepted (entire box is inside the volume of interest)
  91. /// FILTER_INTERSECTS -- the box partially belongs to the volume of interest.
  92. /// </returns>
  93. ///
  94. /// <remarks>
  95. /// Note: If your filter does not support individual point filtering, you
  96. /// should only returns FILTER_OUTSIDE or FILTER_OUTSIDE here.
  97. /// </remarks>
  98. virtual FilterResult testCell(const AcGePoint3d& min, const AcGePoint3d& max) const = 0;
  99. /// <summary>
  100. /// Tests if the point is inside the volume of interest
  101. /// </summary>
  102. /// <param name="point">coordinate value of the test point</param>
  103. ///
  104. /// <returns>
  105. /// FILTER_INSIDE -- if it is accepted because it is inside the volume of interest.
  106. /// FILTER_OUTSIDE -- if it is rejected because it is outside the volume of interest.
  107. ///</returns>
  108. ///
  109. /// <remarks>
  110. /// Note: This function will be called once for every point in the cells that
  111. /// are intersected (testCell() returned FILTER_INTERSECTS) so it needs to be very fast.
  112. /// </remarks>
  113. virtual FilterResult testPoint(const AcGePoint3d& point) const = 0;
  114. /// <summmary>
  115. /// Creates a copy of this filter that represents the current filter's volume of interest
  116. /// after being transformed by the given transformation matrix.
  117. /// </summmary>
  118. /// <param name="mat">the transform matrix</param>
  119. /// <returns>
  120. /// Returns a transformed filter.
  121. /// </returns>
  122. virtual IAcDbPointCloudSpatialFilter* transformFilter(const AcGeMatrix3d& mat) const = 0;
  123. /// <summmary>
  124. /// Creates a clone of the filter and returns a pointer to the clone.
  125. /// The filter will always be cloned before it's used.
  126. /// The filter may be cloned multiple times if multithreaded filtering is enabled.
  127. /// cloned filters will be released by freeObject()
  128. /// </summmary>
  129. ///
  130. /// <returns>
  131. /// Returns a copy of the filter.
  132. /// </returns>
  133. virtual IAcDbPointCloudSpatialFilter* clone() const = 0;
  134. /// <summmary>
  135. /// Deletes the filter itself.
  136. /// Typically this would be implemented using 'delete this;'.
  137. /// </summmary>
  138. virtual void freeObject() = 0;
  139. };
  140. /// <summary>
  141. /// This interface filters points based on point's attribute
  142. /// The attributes include color, intensity, normal and classification.
  143. /// Note that not all attributes may be available. The default value for these attributes are zero
  144. /// Efficiency of the implementation of this interface can critically affect
  145. /// performance of the point cloud access queries.
  146. /// </summary>
  147. class __declspec(novtable) IAcDbPointCloudAttributeFilter
  148. {
  149. public:
  150. virtual ~IAcDbPointCloudAttributeFilter() = 0 {};
  151. /// <summmary>
  152. /// Checks if a point passes this filter.
  153. /// </summmary>
  154. /// <param name="rgba">The color. Note that only the RGB values are valid. The last A value is for internal use only</param>
  155. /// <param name="intensity">The intensity. Note that this value is not defined if the corresponding scan does not have intensity</param>
  156. /// <param name="normal">The surface normal. Note that normal value is not in WCS.</param>
  157. /// <param name="classification">The classification. If the corresponding scan does not have classification then this value is zero</param>
  158. virtual bool testPoint(const Adesk::UInt8 rgba[4], Adesk::UInt8 intensity, const float normal[3], Adesk::UInt8 classification) const = 0;
  159. /// <summmary>
  160. /// Creates a clone of the filter and returns a pointer to the clone.
  161. /// The filter will always be cloned before it's used.
  162. /// The filter may be cloned multiple times if multithreaded filtering is enabled.
  163. /// User should call freeObject() to release the memory when the cloned object is no longer needed.
  164. /// </summmary>
  165. ///
  166. /// <returns>
  167. /// Returns a copy of the filter.
  168. /// </returns>
  169. virtual IAcDbPointCloudAttributeFilter* clone() const = 0;
  170. /// <summmary>
  171. /// Creates a copy of this filter that represents the current filter's volume of interest
  172. /// after being transformed by the given transformation matrix.
  173. /// </summmary>
  174. /// <param name="mat">the transform matrix</param>
  175. /// <returns>
  176. /// Returns a transformed filter.
  177. /// </returns>
  178. virtual IAcDbPointCloudAttributeFilter* transformFilter(const AcGeMatrix3d& mat) const = 0;
  179. /// <summmary>
  180. /// Deletes the filter itself.
  181. /// Typically this would be implemented using 'delete this;'.
  182. /// </summmary>
  183. virtual void freeObject() = 0;
  184. };
  185. /// <summary>
  186. /// This interface processes all point data inside of a point cloud.
  187. /// </summary>
  188. class __declspec(novtable) IAcDbPointCloudPointProcessor
  189. {
  190. public:
  191. enum ProcessSate
  192. {
  193. Abort,
  194. Continue
  195. };
  196. virtual ~IAcDbPointCloudPointProcessor() = 0 {};
  197. /// <description>
  198. /// Processes the point data inside the data buffer.
  199. /// </description>
  200. /// <param name="buffer">Data buffer containing the point data. Do NOT release the buffer.</param>
  201. /// <returns>
  202. /// Abort -- cancel the current processing.
  203. /// Continue -- continue to the next buffer.
  204. /// </returns>
  205. virtual ProcessSate process(const IAcDbPointCloudDataBuffer* buffer) = 0;
  206. };