MCPcopy Create free account
hub / github.com/Kitware/VTK / proj_trans_generic

Function proj_trans_generic

ThirdParty/libproj/vtklibproj/src/4D_api.cpp:432–580  ·  view source on GitHub ↗

/

Source from the content-addressed store, hash-verified

430
431/*************************************************************************************/
432size_t proj_trans_generic (
433 PJ *P,
434 PJ_DIRECTION direction,
435 double *x, size_t sx, size_t nx,
436 double *y, size_t sy, size_t ny,
437 double *z, size_t sz, size_t nz,
438 double *t, size_t st, size_t nt
439) {
440/**************************************************************************************
441
442 Transform a series of coordinates, where the individual coordinate dimension
443 may be represented by an array that is either
444
445 1. fully populated
446 2. a null pointer and/or a length of zero, which will be treated as a
447 fully populated array of zeroes
448 3. of length one, i.e. a constant, which will be treated as a fully
449 populated array of that constant value
450
451 The strides, sx, sy, sz, st, represent the step length, in bytes, between
452 consecutive elements of the corresponding array. This makes it possible for
453 proj_transform to handle transformation of a large class of application
454 specific data structures, without necessarily understanding the data structure
455 format, as in:
456
457 typedef struct {double x, y; int quality_level; char surveyor_name[134];} XYQS;
458 XYQS survey[345];
459 double height = 23.45;
460 PJ *P = {...};
461 size_t stride = sizeof (XYQS);
462 ...
463 proj_transform (
464 P, PJ_INV, sizeof(XYQS),
465 &(survey[0].x), stride, 345, (* We have 345 eastings *)
466 &(survey[0].y), stride, 345, (* ...and 345 northings. *)
467 &height, 1, (* The height is the constant 23.45 m *)
468 0, 0 (* and the time is the constant 0.00 s *)
469 );
470
471 This is similar to the inner workings of the pj_transform function, but the
472 stride functionality has been generalized to work for any size of basic unit,
473 not just a fixed number of doubles.
474
475 In most cases, the stride will be identical for x, y,z, and t, since they will
476 typically be either individual arrays (stride = sizeof(double)), or strided
477 views into an array of application specific data structures (stride = sizeof (...)).
478
479 But in order to support cases where x, y, z, and t come from heterogeneous
480 sources, individual strides, sx, sy, sz, st, are used.
481
482 Caveat: Since proj_transform does its work *in place*, this means that even the
483 supposedly constants (i.e. length 1 arrays) will return from the call in altered
484 state. Hence, remember to reinitialize between repeated calls.
485
486 Return value: Number of transformations completed.
487
488**************************************************************************************/
489 PJ_COORD coord = {{0,0,0,0}};

Callers 4

reproject_bboxFunction · 0.85

Calls 2

opposite_directionFunction · 0.85
proj_transFunction · 0.85

Tested by

no test coverage detected