Skip to main content

read_xyz

Function read_xyz 

Source
pub fn read_xyz(
    text: &str,
    columns: Option<&[XyzColumn]>,
) -> OgeomResult<PointCloud>
Expand description

Read an XYZ text cloud.

A row per point; blank lines and lines opening with # or // are passed over, but for the first such line before the data when it names the columns, x y z first: nx ny nz are a normal, r g b (or red green blue) a colour from 0 to 255, and any other word a scalar of that name. columns, when given, names them instead. Unnamed, the column count decides:

columnsread as
3x y z
4x y z, then a scalar intensity
6x y z, then a colour if every value of the last three is an integer from 0 to 255 and one is past 1, a normal otherwise
7x y z, intensity, then a colour, as PTS lays them out
9x y z, then a colour and a normal, the colour being whichever triple reads as one by the rule above

Every other count is refused, as is a nine-column file where neither triple, or both, reads as colour.

ยงErrors

OgeomError::Construction for a field that is not a finite number, rows of differing widths, a colour channel outside 0 to 255, columns naming part of a point, normal or colour, or a layout the rule above leaves open.