ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

how to express a empty point?

asked 2014-04-06 06:05:27 -0500

keygeorge gravatar image

HI there! i created a array containing elements of type pcl::pointxyzrgb ,that is"pcl::pointxyzrgb point[160]"in a for loop,i want to check if the element is empty,i use "if (point[n]!=0)" .but when compiling,system warn that 0 is not the type of pcl::pointxyzrgb.so,i want to ask is there a way to express a empty point in pcl::pointxyzrgb format?how to initialize all the array elements with that empty point?thanks a lot!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-04-06 15:49:17 -0500

jbinney gravatar image

A point cannot exactly be "empty" - it always has x,y,z,r,g,b members. You could create a new array without the points you don't want (the new array will be shorter). Or you could set x,y,z to NaN, and check for that in other parts of your code.

edit flag offensive delete link more

Comments

actually i was trying to extract the elements which are not empty from the array,in the for loop,i need to make sure the element is not empty so i can push_back it into another vector.so ,is there a way to initialize the array with empty point?

keygeorge gravatar image keygeorge  ( 2014-04-06 16:00:18 -0500 )edit

I believe its storing them in a vector, so no. Its a vector of points, so each element is a point (not something else like a null pointer).

jbinney gravatar image jbinney  ( 2014-04-06 16:25:57 -0500 )edit

ok,thanks a lot.

keygeorge gravatar image keygeorge  ( 2014-04-06 16:35:12 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-04-06 06:05:27 -0500

Seen: 298 times

Last updated: Apr 06 '14