Hi,
It is indeed the way to do this. Points would be ordered from right to left (counter-clockwise) like in the ros
message:
# in frame frame_id, angles are measured around
# the positive Z axis (counterclockwise, if Z is up)
# with zero angle being forward along the x axis
In general, the points don't need to be ordered for normal use, only specific options require to have them ordered like that.
To know how to convert from polar coordinates, I use
laser_geometry package
to do so.
EDIT: I don't think you need "i++" (replace with "i"), it should already point to first float of the channel.
cheers,
Mathieu