imageprocessing/guidedVectorize.c
void meters2pixels(double xm, double ym, int* pCol, int* pRow)
{

  // revised to use center coordinates and to round to closest row/col
  *pCol = round((xm - centerX)/cellsizeX) + width/2;
  *pRow = round((ym - centerY)/cellsizeY * -1) + height/2;
  
}
/* convert a point in meters to the closest x,y (column/line) pixel position
 * @param     xm               X coord in meters
 * @param     ym               Y coord in meters
 * @param     pCol             pointer to column number (x)
 * @param     pRow             pointer to row number (y)
 * Returns results in passed pointers - truncates any fractional part
 * Uses global origin, cell size and image size data
 */
convert a point in meters to the closest x,y (column/line) pixel position
@param     xm               X coord in meters
@param     ym               Y coord in meters
@param     pCol             pointer to column number (x)
@param     pRow             pointer to row number (y)
Returns results in passed pointers - truncates any fractional part
Uses global origin, cell size and image size data
convert a point in meters to the closest x y ( column / line ) pixel position @param xm X coord in meters @param ym Y coord in meters @param pCol pointer to column number ( x ) @param pRow pointer to row number ( y ) Returns results in passed pointers - truncates any fractional part Uses global origin cell size and image size data
void meters2pixels(double xm, double ym, int* pCol, int* pRow)
{
  *pCol = round((xm - centerX)/cellsizeX) + width/2;
  *pRow = round((ym - centerY)/cellsizeY * -1) + height/2;
}
void meters2pixels ( double xm , double ym , int * pCol , int * pRow ) { * pCol = round ( ( xm - centerX ) / cellsizeX ) + width / 2 ; * pRow = round ( ( ym - centerY ) / cellsizeY * -1 ) + height / 2 ; }
convert a point in meters to the closest x,y (column/line) pixel position
 @param     xm               X coord in meters
 @param     ym               Y coord in meters
 @param     pCol             pointer to column number (x)
 @param     pRow             pointer to row number (y)
 Returns results in passed pointers - truncates any fractional part
 Uses global origin, cell size and image size data
convert a point in meters to the closest x y ( column / line ) pixel position @param xm X coord in meters @param ym Y coord in meters @param pCol pointer to column number ( x ) @param pRow pointer to row number ( y ) Returns results in passed pointers - truncates any fractional part Uses global origin cell size and image size data
// revised to use center coordinates and to round to closest row/col