AcPointCloudEngineAPI.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. //
  2. //////////////////////////////////////////////////////////////////////////////
  3. //
  4. // Copyright 2015 Autodesk, Inc. All rights reserved.
  5. //
  6. // Use of this software is subject to the terms of the Autodesk license
  7. // agreement provided at the time of installation or download, or which
  8. // otherwise accompanies this software in either electronic or hard copy form.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11. //
  12. #pragma once
  13. #include "acdbport.h"
  14. /// <summary>
  15. /// Implement this interface to define the volume of interest within the point cloud
  16. /// when this volume of interest is more complex than a view frustum.
  17. /// Efficiency of the implementation of this interface can critically affect
  18. /// performance of the point cloud access queries.
  19. /// </summary>
  20. class ACDB_PORT IPointCloudFilter
  21. {
  22. public:
  23. /// <summary>
  24. /// This method should check whether the cell, i.e. a box aligned with xyz axes,
  25. /// is inside, outside or on the border of the volume of interest.
  26. /// </summary>
  27. /// <param name="minX">Min X coordinate value of the test cell</param>
  28. /// <param name="minY">Min Y coordinate value of the test cell</param>
  29. /// <param name="minZ">Min Z coordinate value of the test cell</param>
  30. /// <param name="maxX">Max X coordinate value of the test cell</param>
  31. /// <param name="maxY">Max Y coordinate value of the test cell</param>
  32. /// <param name="maxZ">Max Z coordinate value of the test cell</param>
  33. ///
  34. /// <returns>
  35. /// Expected return values are -1, 0, or 1:
  36. /// -1 -- the box is rejected (outside the volume of interest)
  37. /// 1 -- the box is fully accepted (entire box is inside the volume of interest)
  38. /// 0 -- the box partially belongs to the volume of interest.
  39. /// </returns>
  40. ///
  41. /// <remarks>
  42. /// Note: If your filter does not support individual point filtering, you
  43. /// should only return -1 or 1 here.
  44. /// </remarks>
  45. virtual int testCell(double minX, double minY, double minZ,
  46. double maxX, double maxY, double maxZ) const = 0;
  47. /// <summary>
  48. /// Test if the point is inside the volume of interest
  49. /// </summary>
  50. /// <param name="x">X coordinate value of the test point</param>
  51. /// <param name="y">Y coordinate value of the test point</param>
  52. /// <param name="z">Z coordinate value of the test point</param>
  53. ///
  54. /// <returns>
  55. /// 'true' -- if it is accepted.
  56. /// 'false' -- if it is rejected.
  57. ///</returns>
  58. ///
  59. /// <remarks>
  60. /// Note: This function will be called once for every point in the cells that
  61. /// are intersected (testCell() returned 0) so it needs to be very fast.
  62. /// </remarks>
  63. virtual bool testPoint(float x, float y, float z) const = 0;
  64. /// <summary>
  65. /// This is an optimization hook that the implementer may ignore.
  66. /// The engine calls this method to promise to the IPointCloudFilter object that
  67. /// all following testCell() and acceptPoint() queries will be for cells and points
  68. /// within the (min, max) box specified here.
  69. /// This is until the next call to prepareForCell().
  70. /// </summary>
  71. /// <param name="minX">Min X coordinate value of the test cell</param>
  72. /// <param name="minY">Min Y coordinate value of the test cell</param>
  73. /// <param name="minZ">Min Z coordinate value of the test cell</param>
  74. /// <param name="maxX">Max X coordinate value of the test cell</param>
  75. /// <param name="maxY">Max Y coordinate value of the test cell</param>
  76. /// <param name="maxZ">Max Z coordinate value of the test cell</param>
  77. /// <param name="numTests">approximate number of testPoint() calls that the engine
  78. /// is going to make before the next such call</param>
  79. virtual void prepareForCell(double& minX, double& minY, double& minZ,
  80. double& maxX, double& maxY, double& maxZ,
  81. long numTests)
  82. {
  83. UNREFERENCED_PARAMETER(minX);
  84. UNREFERENCED_PARAMETER(minY);
  85. UNREFERENCED_PARAMETER(minZ);
  86. UNREFERENCED_PARAMETER(maxX);
  87. UNREFERENCED_PARAMETER(maxY);
  88. UNREFERENCED_PARAMETER(maxZ);
  89. UNREFERENCED_PARAMETER(numTests);
  90. };
  91. /// <summmary>
  92. /// This function creates a clone of the filter and returns a pointer to the clone
  93. /// The filter will always be cloned before it's used.
  94. /// The filter may be cloned multiple times if multithreaded filtering is enabled.
  95. /// </summmary>
  96. ///
  97. /// <returns>
  98. /// Return a copy of the filter.
  99. /// </returns>
  100. virtual IPointCloudFilter* clone() const = 0;
  101. /// <summmary>
  102. /// The engine will call this when it is done with a filter.
  103. /// This should delete the filter.
  104. /// Typically this would be implemented using 'delete this;'.
  105. /// </summmary>
  106. virtual void freeObject(void) = 0;
  107. /// <summmary>
  108. /// Returns a bool value indicating whether the filter is inverted.
  109. /// The default value is false.
  110. /// </summmary>
  111. ///
  112. /// <returns>ture if the filter is inverted</returns>
  113. virtual bool isInverted() const
  114. {
  115. return false;
  116. }
  117. /// <summmary>
  118. /// Set the filter as inverted or not, then we can get opposite result of original filter
  119. /// </summmary>
  120. /// <param name="bInverted">a bool value indicating whether the filter is inverted</param>
  121. virtual void setIsInverted(bool bInverted)
  122. {
  123. UNREFERENCED_PARAMETER(bInverted);
  124. }
  125. };
  126. /// <summary>
  127. /// Extend the interface IPointCloudFilter
  128. /// it supports transform by specifying a matrix
  129. /// </summary>
  130. class ACDB_PORT IPointCloudFilter2 : public IPointCloudFilter
  131. {
  132. public:
  133. /// <summmary>
  134. /// This function creates a new filter which is generated by current filter multiply the specified matrix
  135. /// </summmary>
  136. /// <param name="transform4x4">the transform matrix</param>
  137. /// <returns>
  138. /// Return a transformed filter.
  139. /// </returns>
  140. virtual IPointCloudFilter2* transformFilter(const double* transform4x4) const = 0;
  141. /// <summmary>
  142. /// Checks to see if the given point is inside, or outside of filter
  143. /// in IPointCloudFilter we have testPoint method whose parameter is float
  144. /// here the parameter is double
  145. /// </summmary>
  146. /// <param name="pointData">the specified point</param>
  147. /// <returns>
  148. /// -1 -- the point is rejected (outside the volume of interest)
  149. /// 1 -- the point is fully accepted (inside the volume of interest)
  150. /// </returns>
  151. virtual int testPoint(const double* pointData) const = 0;
  152. virtual ~IPointCloudFilter2() {};
  153. };