Skip to content

Commit

Permalink
Add proj_trans_bounds_3D()
Browse files Browse the repository at this point in the history
Fixes #4392

```c++
/** \brief Transform boundary, taking into account 3D coordinates.
 *
 * Transform boundary densifying the edges to account for nonlinear
 * transformations along these edges and extracting the outermost bounds.
 *
 * Note that the current implementation is not "perfect" when the source CRS is
 * geocentric, the target CRS is geographic, and the input bounding box
 * includes the center of the Earth, a pole or the antimeridian. In those
 * circumstances, exact values of the latitude of longitude of discontinuity
 * will not be returned.
 *
 * If one of the source or target CRS of the transformation is not 3D, the
 * values of *out_zmin / *out_zmax may not be significant.
 *
 * For 2D or "2.5D" transformation (that is planar component is
 * geographic/coordinates and 3D axis is elevation), the documentation of
 * proj_trans_bounds() applies.
 *
 * @param context The PJ_CONTEXT object.
 * @param P The PJ object representing the transformation.
 * @param direction The direction of the transformation.
 * @param xmin Minimum bounding coordinate of the first axis in source CRS
 *             (target CRS if direction is inverse).
 * @param ymin Minimum bounding coordinate of the second axis in source CRS.
 *             (target CRS if direction is inverse).
 * @param zmin Minimum bounding coordinate of the third axis in source CRS.
 *             (target CRS if direction is inverse).
 * @param xmax Maximum bounding coordinate of the first axis in source CRS.
 *             (target CRS if direction is inverse).
 * @param ymax Maximum bounding coordinate of the second axis in source CRS.
 *             (target CRS if direction is inverse).
 * @param zmax Maximum bounding coordinate of the third axis in source CRS.
 *             (target CRS if direction is inverse).
 * @param out_xmin Minimum bounding coordinate of the first axis in target CRS
 *             (source CRS if direction is inverse).
 * @param out_ymin Minimum bounding coordinate of the second axis in target CRS.
 *             (source CRS if direction is inverse).
 * @param out_zmin Minimum bounding coordinate of the third axis in target CRS.
 *             (source CRS if direction is inverse).
 * @param out_xmax Maximum bounding coordinate of the first axis in target CRS.
 *             (source CRS if direction is inverse).
 * @param out_ymax Maximum bounding coordinate of the second axis in target CRS.
 *             (source CRS if direction is inverse).
 * @param out_zmax Maximum bounding coordinate of the third axis in target CRS.
 *             (source CRS if direction is inverse).
 * @param densify_pts Recommended to use 21. This is the number of points
 *     to use to densify the bounding polygon in the transformation.
 * @return an integer. 1 if successful. 0 if failures encountered.
 * @SInCE 9.6
 */
```
  • Loading branch information
rouault committed Feb 4, 2025
1 parent 8a85ca6 commit 8a6c085
Show file tree
Hide file tree
Showing 5 changed files with 534 additions and 5 deletions.
3 changes: 3 additions & 0 deletions docs/source/development/reference/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,9 @@ Coordinate transformation
.. doxygenfunction:: proj_trans_bounds
:project: doxygen_api
.. doxygenfunction:: proj_trans_bounds_3D
:project: doxygen_api
Error reporting
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Expand Down
1 change: 1 addition & 0 deletions scripts/reference_exported_symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,7 @@ proj_torad
proj_trans
proj_trans_array
proj_trans_bounds
proj_trans_bounds_3D
proj_trans_generic
proj_trans_get_last_used_operation
proj_unit_list_destroy
Expand Down
10 changes: 10 additions & 0 deletions src/proj.h
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,16 @@ int PROJ_DLL proj_trans_bounds(PJ_CONTEXT *context, PJ *P,
double xmax, double ymax, double *out_xmin,
double *out_ymin, double *out_xmax,
double *out_ymax, int densify_pts);

int PROJ_DLL proj_trans_bounds_3D(PJ_CONTEXT *context, PJ *P,
PJ_DIRECTION direction, const double xmin,
const double ymin, const double zmin,
const double xmax, const double ymax,
const double zmax, double *out_xmin,
double *out_ymin, double *out_zmin,
double *out_xmax, double *out_ymax,
double *out_zmax, const int densify_pts);

/*! @cond Doxygen_Suppress */

/* Initializers */
Expand Down
Loading

0 comments on commit 8a6c085

Please sign in to comment.