Skip to content

Commit

Permalink
Hotfix: earcut-rs utils3d API changes (#286)
Browse files Browse the repository at this point in the history
  • Loading branch information
ciscorn authored Feb 16, 2024
1 parent 9ce23fc commit f3e2bb0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions nusamai-geometry/examples/citygml_polygons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ end_header
// comment crs: GEOGCRS["JGD2011",DATUM["Japanese Geodetic Datum 2011",ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["Japan - onshore and offshore."],BBOX[17.09,122.38,46.05,157.65]],ID["EPSG",6668]]

fn write_features(mpolys: &[MultiPolygon3], mu_lng: f64, mu_lat: f64) {
use earcut_rs::{utils_3d::project3d_to_2d, Earcut};
use earcut_rs::{utils3d::project3d_to_2d, Earcut};
let mut earcutter = Earcut::new();
let mut buf3d: Vec<f64> = Vec::new();
let mut buf2d: Vec<f64> = Vec::new();
Expand All @@ -240,7 +240,7 @@ fn write_features(mpolys: &[MultiPolygon3], mu_lng: f64, mu_lat: f64) {
]
}));

if project3d_to_2d(&buf3d, num_outer, &mut buf2d) {
if project3d_to_2d(&buf3d, num_outer, 3, &mut buf2d) {
// earcut
earcutter.earcut(&buf2d, poly.hole_indices(), 2, &mut triangles_out);
// indices and vertices
Expand Down
4 changes: 2 additions & 2 deletions nusamai-gltf/examples/geometry_to_gltf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

use byteorder::{LittleEndian, WriteBytesExt};
use clap::Parser;
use earcut_rs::{utils_3d::project3d_to_2d, Earcut};
use earcut_rs::{utils3d::project3d_to_2d, Earcut};
use indexmap::IndexSet;
use nusamai_geometry::MultiPolygon3;
use nusamai_gltf_json::*;
Expand Down Expand Up @@ -252,7 +252,7 @@ fn tessellate(
]
}));

if project3d_to_2d(&buf3d, num_outer, &mut buf2d) {
if project3d_to_2d(&buf3d, num_outer, 3, &mut buf2d) {
// earcut
earcutter.earcut(&buf2d, poly.hole_indices(), 2, &mut triangles_out);
// indices and vertices
Expand Down
4 changes: 2 additions & 2 deletions nusamai/src/sink/cesiumtiles/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::path::{Path, PathBuf};
use std::sync::{mpsc, Arc, Mutex};

use ahash::RandomState;
use earcut_rs::utils_3d::project3d_to_2d;
use earcut_rs::utils3d::project3d_to_2d;
use earcut_rs::Earcut;
use ext_sort::{buffer::mem::MemoryLimitedBufferBuilder, ExternalSorter, ExternalSorterBuilder};
use indexmap::IndexSet;
Expand Down Expand Up @@ -267,7 +267,7 @@ fn tile_writing_stage(
buf3d.clear();
buf3d.extend(poly.coords());

if project3d_to_2d(&buf3d, num_outer, &mut buf2d) {
if project3d_to_2d(&buf3d, num_outer, 3, &mut buf2d) {
// earcut
earcutter.earcut(&buf2d, poly.hole_indices(), 2, &mut triangles_buf);
triangles.extend(triangles_buf.iter().map(|idx| {
Expand Down
4 changes: 2 additions & 2 deletions nusamai/src/sink/gltf_poc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::path::{Path, PathBuf};

use ahash::RandomState;
use byteorder::{ByteOrder, LittleEndian};
use earcut_rs::utils_3d::project3d_to_2d;
use earcut_rs::utils3d::project3d_to_2d;
use earcut_rs::Earcut;
use indexmap::IndexSet;
use nusamai_gltf_json::extensions::mesh::ext_mesh_features::FeatureId;
Expand Down Expand Up @@ -178,7 +178,7 @@ impl DataSink for GltfPocSink {
buf3d.clear();
buf3d.extend(poly.coords());

if project3d_to_2d(&buf3d, num_outer, &mut buf2d) {
if project3d_to_2d(&buf3d, num_outer, 3, &mut buf2d) {
// earcut
earcutter.earcut(
&buf2d,
Expand Down
4 changes: 2 additions & 2 deletions nusamai/src/sink/ply/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::path::PathBuf;

use ahash::RandomState;
use byteorder::{ByteOrder, LittleEndian, WriteBytesExt};
use earcut_rs::{utils_3d::project3d_to_2d, Earcut};
use earcut_rs::{utils3d::project3d_to_2d, Earcut};
use indexmap::IndexSet;
use nusamai_citygml::{schema::Schema, GeometryType};

Expand Down Expand Up @@ -136,7 +136,7 @@ impl DataSink for StanfordPlySink {
buf3d.clear();
buf3d.extend(poly.coords());

if project3d_to_2d(&buf3d, num_outer, &mut buf2d) {
if project3d_to_2d(&buf3d, num_outer, 3, &mut buf2d) {
// earcut
earcutter.earcut(
&buf2d,
Expand Down

0 comments on commit f3e2bb0

Please sign in to comment.