yutannihilation commented on code in PR #504:
URL: https://github.com/apache/sedona-db/pull/504#discussion_r2686688400


##########
rust/sedona-geometry/src/transform.rs:
##########
@@ -58,13 +58,27 @@ pub trait CrsEngine: Debug {
 /// Trait for transforming coordinates in a geometry from one CRS to another.
 pub trait CrsTransform: std::fmt::Debug {
     fn transform_coord(&self, coord: &mut (f64, f64)) -> Result<(), 
SedonaGeometryError>;
+
+    // CrsTransform can optionally handle 3D coordinates. If this method is 
not implemented,
+    // the Z coordinate is simply ignored.
+    fn transform_coord_3d(&self, coord: &mut (f64, f64, f64)) -> Result<(), 
SedonaGeometryError> {
+        let mut coord_2d = (coord.0, coord.1);
+        self.transform_coord(&mut coord_2d)?;
+        coord.0 = coord_2d.0;
+        coord.1 = coord_2d.1;

Review Comment:
   I'm wondering if I should change the signature to this so that we don't need 
to copy the values here. But, as it would affect several other functions, I 
think I should not do this in this pull request anyway.
   
   ```rs
   fn transform_coord(&self, x: &mut f64, y: &mut f64) -> Result<(), 
SedonaGeometryError>;
   fn transform_coord_3d(&self, x: &mut f64, y: &mut f64, z: &mut f64) -> 
Result<(), SedonaGeometryError>;
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to