Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prioritize mesh selection over export filter #68

Open
github-actions bot opened this issue Jan 2, 2024 · 0 comments
Open

prioritize mesh selection over export filter #68

github-actions bot opened this issue Jan 2, 2024 · 0 comments
Assignees
Labels

Comments

@github-actions
Copy link

github-actions bot commented Jan 2, 2024

println!("initial cloud size: {}", cloud.len());

cloud = (0..cloud.len())

.filter(|&idx| {

is_point_in_transformed_sphere(

cloud.position(idx),

)

})

.map(|idx| cloud.gaussian(idx))

.collect();

println!("filtered position cloud size: {}", cloud.len());

// TODO: prioritize mesh selection over export filter

    let file = std::fs::File::open(&filename).expect("failed to open file");
    let mut reader = std::io::BufReader::new(file);

    let mut cloud = GaussianCloud::from_gaussians(
        parse_ply(&mut reader).expect("failed to parse ply file"),
    );

    // TODO: prioritize mesh selection over export filter
    // println!("initial cloud size: {}", cloud.len());
    // cloud = (0..cloud.len())
    //     .filter(|&idx| {
    //         is_point_in_transformed_sphere(
    //             cloud.position(idx),
    //         )
    //     })
    //     .map(|idx| cloud.gaussian(idx))
    //     .collect();
    // println!("filtered position cloud size: {}", cloud.len());

    #[cfg(feature = "query_sparse")]
    {
        let sparse_selection = SparseSelect::default().select(&cloud).invert(cloud.len());

        cloud = sparse_selection.indicies.iter()
            .map(|idx| cloud.gaussian(*idx))
            .collect();
        println!("sparsity filtered cloud size: {}", cloud.len());
    }

    let base_filename = filename.split('.').next().expect("no extension").to_string();
    let gcloud_filename = base_filename + ".gcloud";

    write_gaussian_cloud_to_file(&cloud, &gcloud_filename);

    let post_encode_bytes = Byte::from_u64(std::fs::metadata(&gcloud_filename).expect("failed to get metadata").len());
    println!("output file size: {}", post_encode_bytes.get_appropriate_unit(UnitType::Decimal));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant