Skip to content

Commit

Permalink
Allow setting of color limits manually
Browse files Browse the repository at this point in the history
  • Loading branch information
cry-inc committed Oct 21, 2024
1 parent c437f05 commit 7514a9b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/pc_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ use std::collections::VecDeque;
use std::io::{Read, Seek, Write};

/// Creates a new point cloud by taking points and writing them into an E57 file.
/// Bounds for Cartesian and spherical coordinates are extracted automatically.
/// The same is also true for any index bounds.
pub struct PointCloudWriter<'a, T: Read + Write + Seek> {
writer: &'a mut PagedWriter<T>,
pointclouds: &'a mut Vec<PointCloud>,
Expand Down Expand Up @@ -263,6 +265,16 @@ impl<'a, T: Read + Write + Seek> PointCloudWriter<'a, T> {
self.intensity_limits = value;
}

/// Sets the color limits of the point cloud.
/// Only required if the point cloud contains color data.
/// This must represent the full range of all possible color values.
/// The default value is the range extracted from the prototypes color data types.
/// Since the data type range might be different from the actual limits,
/// it is strongly recommended to set this limit manually.
pub fn set_color_limits(&mut self, value: Option<ColorLimits>) {
self.color_limits = value;
}

fn validate_prototype(prototype: &[Record]) -> Result<()> {
// Helpers to check and look up records
let contains = |n: RecordName| prototype.iter().any(|p| p.name == n);
Expand Down Expand Up @@ -473,7 +485,7 @@ impl<'a, T: Read + Write + Seek> PointCloudWriter<'a, T> {
}
}

// Update row/col bounds
// Update index bounds
if p.name == RecordName::RowIndex
|| p.name == RecordName::ColumnIndex
|| p.name == RecordName::ReturnIndex
Expand Down

0 comments on commit 7514a9b

Please sign in to comment.