Skip to content
Snippets Groups Projects
Commit 963963cf authored by Oliver Sander's avatar Oliver Sander
Browse files

Remove unused type coord_point and related methods

parent ab0b89d9
No related branches found
No related tags found
1 merge request!225Simplifications and removal of unused code
......@@ -88,86 +88,6 @@ const DOUBLE NS_DIM_PREFIX unit_vec[DIM][DIM]={{1,0,0},{0,1,0},{0,0,1}};
#define MIN_DETERMINANT 0.0001*SMALL_C
/****************************************************************************/
/****************************************************************************/
/****************************************************************************/
/**** ****/
/**** general routines ****/
/**** ****/
/****************************************************************************/
/****************************************************************************/
/****************************************************************************/
/****************************************************************************/
/*D
PointInPolygon - Decide if Point lies in the polygon of Points
SYNOPSIS:
INT PointInPolygon (const COORD_POINT *Points, INT n,
const COORD_POINT Point);
PARAMETERS:
. Points - polygon given by array of 'COORD_POINT' structures
. n - number of corners
. Point - Point in question
STRUCTURES:
.vb
struct coord_point
{
DOUBLE x;
DOUBLE y;
};
.ve
DESCRIPTION:
This function decides if 'Point' lies in the polygon of 'Points'.
The number of corners of the polygon must be less than or equal
than 4 in the current implementation!
RETURN VALUE:
bool
.n false when lies not in the polygon
.n true when lies in the polygon.
D*/
/****************************************************************************/
#define POLYMAX 8
bool NS_DIM_PREFIX PointInPolygon (const COORD_POINT *Points, INT n, COORD_POINT Point)
{
[[maybe_unused]] DOUBLE D[POLYMAX] ,tau[POLYMAX],xa,ya,xe,ye;
int i, left, right;
assert (n<=POLYMAX);
if (n<=2) return false;
xa = Points[0].x;
ya = Points[0].y;
for (i=1; i<=n; i++)
{
xe = Points[i%n].x;
ye = Points[i%n].y;
D[i-1] = (xe-xa)*(xe-xa)+(ye-ya)*(ye-ya);
tau[i-1] = (-(ye-ya)*(Point.x-xa)+(xe-xa)*(Point.y-ya));
xa = xe;
ya = ye;
}
left = right = 0;
for (i=0; i<n; i++)
{
if (tau[i]>=0.0) left++;
if (tau[i]<=0.0) right++;
/* if (tau[i]>=D[i]*SMALL_C) left++;
if (tau[i]<=-D[i]*SMALL_C) right++; */
}
if (left==n || right==n)
return true;
return false;
}
/****************************************************************************/
/****************************************************************************/
/****************************************************************************/
......
......@@ -64,15 +64,6 @@ START_UGDIM_NAMESPACE
#define SQRT(a) sqrt((double)(a))
#define POW(a,b) pow((double)(a),(double)(b))
/* macros for coord points */
#define COPY_SC_TO_SH(p1,p2) (p2).x=(short)((p1).x);(p2).y=(short)((p1).y)
#define CP_SUBTRACT(A,B,C) {(C).x = (A).x - (B).x;\
(C).y = (A).y - (B).y;}
#define CP_LIMCOMB(a,A,b,B,C) {(C).x = (DOUBLE)(a)*(A).x + (DOUBLE)(b)*(B).x;\
(C).y = (DOUBLE)(a)*(A).y + (DOUBLE)(b)*(B).y;}
#define CP_SCALARPRODUCT(A,B,c) (c) = (A).x*(B).x + (A).y*(B).y;
#define CP_EUKLIDNORM(A,b) (b) = (DOUBLE)sqrt((double)((A).x*(A).x+(A).y*(A).y));
/* macros for 1D vector operations */
#define V1_COPY(A,C) {(C)[0] = (A)[0];}
......@@ -233,19 +224,6 @@ START_UGDIM_NAMESPACE
#endif
/****************************************************************************/
/* */
/* typedef of 2d points for screen coordinates */
/* */
/****************************************************************************/
struct coord_point
{
DOUBLE x;
DOUBLE y;
};
typedef struct coord_point COORD_POINT;
/****************************************************************************/
/* */
......@@ -261,9 +239,6 @@ extern const DOUBLE unit_vec[DIM][DIM];
/* */
/****************************************************************************/
/* general routines */
bool PointInPolygon (const COORD_POINT *Points, INT n, COORD_POINT Point);
/* 2D routines */
DOUBLE vp (const DOUBLE x1, const DOUBLE y1, const DOUBLE x2, const DOUBLE y2);
DOUBLE c_tarea (const DOUBLE *x0, const DOUBLE *x1, const DOUBLE *x2);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment