Skip to main content
Question

Counting the 3D Points within a sphere?


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.

4 replies

whkarto
Contributor
Forum|alt.badge.img+14
  • Contributor
  • 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
Contributor
Forum|alt.badge.img+19
  • Contributor
  • 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+34
takashi wrote:

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+34
whkarto wrote:

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings