Jump to content

pcopen - once again


sanostol

Recommended Posts

Hi, I'm trying to get this working for some time right now, but without succss.

I use the pcopen function, but I want to use the not very well documented "ndot" argument. My goal is to get every point to use a look direction and cone, so that every point has a limited angle of view. only points of the point cloud that are inside this cone are considered, but I don't get it to work.

my function looks like this:

int handle = pcopen(pcFile, pChannel,P, nChannel, N, maxdistance, maxpoints,"ndot", cos(radians(coneangle)) );

how can I achieve this effect?

martin

Link to comment
Share on other sites

You have to do that manually, the pcopen does not support it.

It will make its' selection on all the points facing in the same-ish direction, rather than select the points in the "field of view".

So to do it manually:

*)open a normal pointcloud, big enough to encompass all the points in the sphere of influence (both in radius as well as in amount of points).

*)setup your pointcloud while loop and pcimport the P.

*) calculate the direction vector from current point A to imported point B =>

B-A

(you do not want to normalize this yet as you will want to use the length of this direction vector (effectively the distance to the other point) as a weight - similar to what the pcfilter does )

*) compare the original vector from A with the direction vector to B =>

dot( normalize(A) , normalize( ) 

*) the result of the dot product will be ranging from -1 to 1, a result of 1 means the point is right in front of A, 0 means it is perpendicular (at 90degree angle), -1 is behind A. You can use ramps or fit functions to remap the influence based on this.

*) To make it a bit more user friendly you may want to use degrees instead to specify that angle of influence. From the

dot(A, = |A|.|B|.cos(alpha)

follows (if you are using normalized vector which you should)

alpha = acos(dot(A,)

. Alpha will be returned in radians.

*) Then with an if statement you can reject:

if( alpha > degreesToRadians(60))

Overall it's still pretty fast as you are still using pointclouds to narrow the huge cloud to the sphere of influence.

Edited by pclaes
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...