Skip to content

Commit

Permalink
Eliminated some C compiler warnings related to pointer casts
Browse files Browse the repository at this point in the history
  • Loading branch information
ndemaio committed May 2, 2024
1 parent 1e66128 commit d81edfa
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions package/src/RcompGeomete.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,26 @@ void print_summary(qhT *qh)
*/
double *calculateradill(double *point0, double *voronoiVertices)
{
int j, k = 0;
int row = nrows(point0);
int colD = ncols(point0);
int int2strbufsize = 12;
char int2strbuf[int2strbufsize];

int j, k = 0;
int row = nrows((SEXP)point0);
int colD = ncols((SEXP)point0);
double *circumRadii = (double *)R_alloc(row, sizeof(double));
Rprintf("num of row");
Rprintf(row);

Rprintf("num of rows");
snprintf(int2strbuf, int2strbufsize, "%d", row);
Rprintf(int2strbuf);

for (j = 0; j < row; j++)
{
double pointSumDiff = 0.0;
// get the point value using the trigulation index

for (int i = 1; i < colD; i++)
{
pointSumDiff += (double)pow((REAL(voronoiVertices)[j + row * i] - REAL(point0)[j + row * i]), 2);
pointSumDiff += (double)pow((REAL((SEXP)voronoiVertices)[j + row * i] - REAL((SEXP)point0)[j + row * i]), 2);
}
circumRadii[k] = sqrt(pointSumDiff);

Expand Down

0 comments on commit d81edfa

Please sign in to comment.