12 #include "edge/BgEdge.h"
13 #define PI 3.1415926535
28 if (nPoints_>0)
delete [] edge_;
29 if (isGradSet_)
delete [] grad_;
30 if (isMarkSet_)
delete [] mark_;
33 void BgEdge::SetPoints(
float* points,
int npoints)
35 if (nPoints_>0)
delete [] edge_;
37 edge_=
new int[npoints*2];
43 for (
int i=0; i<2*npoints; i++)
44 *(itd++) = (int) *(its++);
47 void BgEdge::SetPoints(
int* points,
int npoints)
49 if (nPoints_>0)
delete [] edge_;
51 edge_=
new int[npoints*2];
57 for (
int i=0; i<2*npoints; i++)
61 void BgEdge::SetGradient(
float* grx,
float* gry,
float* mark,
int ncol)
63 if (isGradSet_ && nPoints_>0)
delete [] grad_;
65 grad_ =
new double[nPoints_];
73 for (i=0; i<nPoints_;i++)
82 if (*(mark+(y+gNb8[j][1])*ncol+gNb8[j][0]+x) == 1)
84 gx += *(grx+(y+gNb8[j][1])*ncol+gNb8[j][0]+x);
85 gy += *(gry+(y+gNb8[j][1])*ncol+gNb8[j][0]+x);
89 alpha = (alpha<0) ? alpha+PI : alpha;