OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Functions
ossimDblGrid.cpp File Reference
#include <ossim/base/ossimDblGrid.h>
#include <ossim/base/ossimDrect.h>
#include <ossim/base/ossimNotify.h>
#include <ossim/base/ossimTrace.h>
#include <climits>
#include <cstring>
#include <iostream>
#include <vector>

Go to the source code of this file.

Functions

bool isBlocked (bool *blocked, int x, int y)
 
void blockDirection (bool *blocked, int x, int y)
 
ostream & operator<< (ostream &os, const ossimDblGrid &grid)
 

Function Documentation

◆ blockDirection()

void blockDirection ( bool *  blocked,
int  x,
int  y 
)

Definition at line 865 of file ossimDblGrid.cpp.

References x, and y.

866 {
867  if (y == 0)
868  {
869  if (x > 0) blocked[4] = true;
870  else blocked[12] = true;
871  return;
872  }
873 
874  double r = x/y;
875  int c = 0;
876  int i;
877  if (x < 0.0) c = 8;
878 
879  //***
880  // Test the tangent value instead of computing angle:
881  //***
882  if (r > 5.02734) i = 12 + c;
883  else if (r > 1.49660) i = 13 + c;
884  else if (r > 0.66818) i = 14 + c;
885  else if (r > 0.19891) i = 15 + c;
886  else if (r > -0.19891) i = 0 + c;
887  else if (r > -0.66818) i = 1 + c;
888  else if (r > -1.49660) i = 2 + c;
889  else if (r > -5.02734) i = 3 + c;
890  else i = 4 + c;
891 
892  if (i > 15) i -= 16; // modulo 16
893  blocked[i] = true;
894 
895  return;
896 }
ossim_uint32 x
ossim_uint32 y

◆ isBlocked()

bool isBlocked ( bool *  blocked,
int  x,
int  y 
)

Definition at line 823 of file ossimDblGrid.cpp.

References x, and y.

824 {
825  if (y == 0)
826  {
827  if (x > 0) return blocked[4];
828  return blocked[12];
829  }
830 
831  double r = x/y;
832  int c = 0;
833  int i;
834  if (x < 0.0) c = 8;
835 
836  //***
837  // Test the tangent value instead of computing angle:
838  //***
839  if (r > 5.02734) i = 12 + c;
840  else if (r > 1.49660) i = 13 + c;
841  else if (r > 0.66818) i = 14 + c;
842  else if (r > 0.19891) i = 15 + c;
843  else if (r > -0.19891) i = 0 + c;
844  else if (r > -0.66818) i = 1 + c;
845  else if (r > -1.49660) i = 2 + c;
846  else if (r > -5.02734) i = 3 + c;
847  else i = 4 + c;
848 
849  if (i > 15) i -= 16; // modulo 16
850 
851  return blocked[i];
852 }
ossim_uint32 x
ossim_uint32 y

◆ operator<<()

ostream& operator<< ( ostream &  os,
const ossimDblGrid grid 
)

Definition at line 1212 of file ossimDblGrid.cpp.

References ossimDblGrid::getNode(), ossimDblGrid::theDeviation, ossimDblGrid::theGridData, ossimDblGrid::theMaxValue, ossimDblGrid::theMeanIsComputed, ossimDblGrid::theMeanValue, ossimDblGrid::theMinValue, ossimDblGrid::theNullValue, ossimDblGrid::theOrigin, ossimDblGrid::theSize, ossimDblGrid::theSpacing, ossimIpt::x, x, ossimIpt::y, and y.

1213 {
1214  os << "\nDump of ossimDblGrid at " << (void*) &grid
1215  << "\n theSize: " << grid.theSize
1216  << "\n theOrigin: " << grid.theOrigin
1217  << "\n theSpacing: " << grid.theSpacing
1218  << "\n theMinValue: " << grid.theMinValue
1219  << "\n theMaxValue: " << grid.theMaxValue
1220  << "\n theNullValue: " << grid.theNullValue
1221  << "\n theMeanValue: " << grid.theMeanValue
1222  << "\n theDeviation: " << grid.theDeviation
1223  << "\n theMeanIsComputed: " << grid.theMeanIsComputed
1224  << "\n";
1225 
1226  if(grid.theGridData)
1227  {
1228 
1229  for (int y=0; y<grid.theSize.y; y++)
1230  {
1231  for (int x=0; x<grid.theSize.x; x++)
1232  {
1233  os << "\n node(" << x << ", " << y << "): " << grid.getNode(x,y);
1234  }
1235  }
1236  }
1237 
1238  return os;
1239 }
ossim_uint32 x
ossimDpt theOrigin
Definition: ossimDblGrid.h:219
ossimDpt theSpacing
Definition: ossimDblGrid.h:220
bool theMeanIsComputed
Definition: ossimDblGrid.h:226
double theDeviation
Definition: ossimDblGrid.h:225
ossim_uint32 y
double theMeanValue
Definition: ossimDblGrid.h:224
double * theGridData
Definition: ossimDblGrid.h:217
double theNullValue
Definition: ossimDblGrid.h:223
double getNode(const ossimIpt &p) const
Definition: ossimDblGrid.h:111
ossimIpt theSize
Definition: ossimDblGrid.h:218
ossim_int32 y
Definition: ossimIpt.h:142
ossim_int32 x
Definition: ossimIpt.h:141
double theMinValue
Definition: ossimDblGrid.h:221
double theMaxValue
Definition: ossimDblGrid.h:222