Skip to main content
Question

Counting the 3D Points within a sphere?

  • March 31, 2020
  • 4 replies
  • 102 views

alfons
Contributor
Forum|alt.badge.img+7

Hello,

I am looking for the possibility to count all points (3D) within a 3D body/sphere. Using the 3D buffer (it was faster than HUB3DBuffer, but less accurate) I have generated a solid body and now I want to check how many 3D points are inside this body. With the Spatial Relator apparently only points in a 2D space are checked. Is there a transformer in FME that does this job?

Thanks a lot.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

whkarto
Contributor
Forum|alt.badge.img+14
  • Contributor
  • 58 replies
  • March 31, 2020

You could convert your points into a pointcloud and clip the pointcloud with your sphere. Maybe you'll have to play around with your shere geometry type to have the ckipper treated it as a solid. The clipped pointcloud can than be counted for the total amount of single points by the PointcloudPropertyExtractor. In case you'd like to have the single inside points user the PointcloudCoercer to convert the Pointcloud feature back into several Point features.


takashi
Celebrity
  • 7843 replies
  • March 31, 2020

Another thought. If you extract coordinates (x, y, z) of the sphere center and every candidate point and also the sphere radius is known, you can mathematically solve this question. That is, calculate 3D distance between the center and each point based on thier coordinates, and determine that a point is within the sphere if the distance is smaller than the radius.


virtualcitymatt
Celebrity
Forum|alt.badge.img+47
  • Celebrity
  • 2000 replies
  • March 31, 2020

Another thought. If you extract coordinates (x, y, z) of the sphere center and every candidate point and also the sphere radius is known, you can mathematically solve this question. That is, calculate 3D distance between the center and each point based on thier coordinates, and determine that a point is within the sphere if the distance is smaller than the radius.

Some python here for it - could be a fun CustomTransformer ;-)

https://www.geeksforgeeks.org/check-whether-a-point-lies-inside-a-sphere-or-not/


virtualcitymatt
Celebrity
Forum|alt.badge.img+47
  • Celebrity
  • 2000 replies
  • March 31, 2020

You could convert your points into a pointcloud and clip the pointcloud with your sphere. Maybe you'll have to play around with your shere geometry type to have the ckipper treated it as a solid. The clipped pointcloud can than be counted for the total amount of single points by the PointcloudPropertyExtractor. In case you'd like to have the single inside points user the PointcloudCoercer to convert the Pointcloud feature back into several Point features.

This should work well for the approximated Solid. Should be fairly quick too