Skip to content

Commit ece2319

Browse files
committed
[pal] Remove more unused functions
1 parent 3a44e29 commit ece2319

File tree

2 files changed

+0
-212
lines changed

2 files changed

+0
-212
lines changed

src/core/pal/geomfunction.cpp

Lines changed: 0 additions & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -145,159 +145,6 @@ namespace pal
145145
&& cross_product( x3, y3, x4, y4, x1, y1 ) * cross_product( x3, y3, x4, y4, x2, y2 ) < 0 );
146146
}
147147

148-
149-
150-
151-
/*
152-
*/
153-
154-
bool computeSegIntersectionExt( double x1, double y1, double x2, double y2, double xs1, double ys1, // 1st (segment)
155-
double x3, double y3, double x4, double y4, double xs2, double ys2, // 2nd segment
156-
double *x, double *y )
157-
{
158-
double cp1, cp2, cp3, cp4;
159-
cp1 = cross_product( x1, y1, x2, y2, x3, y3 );
160-
cp2 = cross_product( x1, y1, x2, y2, x4, y4 );
161-
cp3 = cross_product( x3, y3, x4, y4, x1, y1 );
162-
cp4 = cross_product( x3, y3, x4, y4, x2, y2 );
163-
164-
165-
if ( cp1 == 0 && cp2 == 0 && cp3 == 0 && cp4 == 0 )
166-
{
167-
#ifdef _DEBUG_FULL_
168-
std::cout << "coolineaire..." << std::endl;
169-
#endif
170-
return false;
171-
}
172-
173-
// 1 ter
174-
if ( cp1 == 0 && cp3 == 0 )
175-
{
176-
#ifdef _DEBUG_FULL_
177-
std::cout << "cp1 = cp3 = 0 => ignoring..." << std::endl;
178-
#endif
179-
return false;
180-
}
181-
182-
// 1 bis
183-
if ( cp1 == 0 && cp4 == 0 )
184-
{
185-
#ifdef _DEBUG_FULL_
186-
std::cout << "cp1 = cp4 = 0 => ignoring..." << std::endl;
187-
#endif
188-
return false;
189-
}
190-
191-
// 1 bis
192-
if ( cp2 == 0 && cp3 == 0 )
193-
{
194-
#ifdef _DEBUG_FULL_
195-
std::cout << "cp2 = cp3 = 0 => ignoring..." << std::endl;
196-
#endif
197-
return false;
198-
}
199-
200-
// 2bis and 3bis
201-
if ( cp1 == 0 || cp3 == 0 )
202-
{
203-
#ifdef _DEBUG_FULL_
204-
std::cout << "skip..." << std::endl;
205-
#endif
206-
return false;
207-
}
208-
209-
// case 3
210-
if ( cp4 == 0 && cp1 * cp1 < 0 )
211-
{
212-
if ( cross_product( x3, y3, x4, y4, xs1, ys1 ) * cp3 < 0 )
213-
{
214-
*x = x2;
215-
*y = y2;
216-
return true;
217-
}
218-
else
219-
return false;
220-
}
221-
222-
// case 2
223-
if ( cp2 == 0 && cp3 * cp4 < 0 )
224-
{
225-
if ( cross_product( x1, y1, x2, y2, xs2, ys2 ) * cp1 < 0 )
226-
{
227-
*x = x4;
228-
*y = y4;
229-
return true;
230-
}
231-
else
232-
return false;
233-
}
234-
235-
// case 1
236-
if ( cp2 == 0 && cp4 == 0 )
237-
{
238-
double distance[4];
239-
double cx, cy;
240-
double dx, dy;
241-
double nx[4], ny[4];
242-
double toDist;
243-
double ratio;
244-
int i;
245-
246-
cx = x2;
247-
cy = y2;
248-
249-
nx[0] = x1;
250-
ny[0] = y1;
251-
252-
nx[1] = xs1;
253-
ny[1] = ys1;
254-
255-
nx[2] = x3;
256-
ny[2] = y3;
257-
258-
nx[3] = xs2;
259-
ny[3] = ys2;
260-
261-
distance[0] = dist_euc2d( cx, cy, x1, y1 ); // i
262-
toDist = distance[0];
263-
264-
distance[1] = dist_euc2d( cx, cy, xs1, ys1 );// j2
265-
toDist = qMax( toDist, distance[1] );
266-
267-
distance[2] = dist_euc2d( cx, cy, x3, y3 );// k
268-
toDist = qMax( toDist, distance[2] );
269-
270-
distance[3] = dist_euc2d( cx, cy, xs2, ys2 ); // l2
271-
toDist = qMax( toDist, distance[3] );
272-
273-
for ( i = 0; i < 4; i++ )
274-
{
275-
dx = nx[i] - cx;
276-
dy = ny[i] - cy;
277-
278-
ratio = toDist / distance[i];
279-
280-
nx[i] = cx + dx * ratio;
281-
ny[i] = cy + dy * ratio;
282-
}
283-
284-
bool return_val = computeSegIntersection( nx[0], ny[0], nx[1], ny[1], nx[2], ny[2], nx[3], ny[3], x, y );
285-
286-
return return_val;
287-
}
288-
289-
if ( cp1 * cp2 <= 0
290-
&& cp3 *cp4 <= 0 )
291-
{
292-
return computeLineIntersection( x1, y1, x2, y2, x3, y3, x4, y4, x, y );
293-
}
294-
295-
return false;
296-
}
297-
298-
299-
300-
301148
/*
302149
* \brief Intersection bw a line and a segment
303150
* \return true if the point exist false otherwise
@@ -316,30 +163,6 @@ namespace pal
316163
return false;
317164
}
318165

319-
320-
321-
/*
322-
* \brief compute the point wherre two segment intersects
323-
* \return true if the point exist false otherwise
324-
*/
325-
326-
bool computeSegIntersection( double x1, double y1, double x2, double y2, // 1st (segment)
327-
double x3, double y3, double x4, double y4, // 2nd segment
328-
double *x, double *y )
329-
{
330-
double cp1, cp2, cp3, cp4;
331-
cp1 = cross_product( x1, y1, x2, y2, x3, y3 );
332-
cp2 = cross_product( x1, y1, x2, y2, x4, y4 );
333-
cp3 = cross_product( x3, y3, x4, y4, x1, y1 );
334-
cp4 = cross_product( x3, y3, x4, y4, x2, y2 );
335-
336-
if ( cp1 * cp2 <= 0
337-
&& cp3 *cp4 <= 0 )
338-
return computeLineIntersection( x1, y1, x2, y2, x3, y3, x4, y4, x, y );
339-
340-
return false;
341-
}
342-
343166
/*
344167
* \brief compute the point wherre two lines intersects
345168
* \return true if the ok false if line are parallel

src/core/pal/geomfunction.h

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -60,41 +60,17 @@ namespace pal
6060
}
6161

6262
bool isPointInPolygon( int npol, double *xp, double *yp, double x, double y );
63-
/*
64-
// code from Randolph Franklin (found at http://local.wasp.uwa.edu.au/~pbourke/geometry/insidepoly/)
65-
int i, j;
66-
bool c = false;
67-
68-
for (i = 0, j = npol-1; i < npol; j = i++){
69-
if ((( (yp[i] <= y) && (y < yp[j])) ||
70-
((yp[j] <= y) && (y < yp[i])))
71-
&& (x < (xp[j] - xp[i]) * (y - yp[i]) / (yp[j] - yp[i]) + xp[i])){
72-
c = !c;
73-
}
74-
}
75-
return c;
76-
}*/
77-
78-
7963

8064
void findLineCircleIntersection( double cx, double cy, double radius,
8165
double x1, double y1, double x2, double y2,
8266
double& xRes, double& yRes );
8367

8468

85-
int convexHull( int *id, const double* const x, const double* const y, int n );
86-
87-
8869
int convexHullId( int *id, const double* const x, const double* const y, int n, int *&cHull );
8970

9071
bool isSegIntersects( double x1, double y1, double x2, double y2, // 1st segment
9172
double x3, double y3, double x4, double y4 ); // 2nd segment
9273

93-
bool computeSegIntersectionExt( double x1, double y1, double x2, double y2, double xs1, double ys1, // 1st (segment)
94-
double x3, double y3, double x4, double y4, double xs2, double ys2, // 2nd segment
95-
double *x, double *y );
96-
97-
9874
/*
9975
* \brief Intersection bw a line and a segment
10076
* \return true if the point exist false otherwise
@@ -103,17 +79,6 @@ namespace pal
10379
double x3, double y3, double x4, double y4, // 2nd segment
10480
double *x, double *y );
10581

106-
107-
108-
/*
109-
* \brief compute the point wherre two segmentss intersects
110-
* \return true if the point exists
111-
*/
112-
bool computeSegIntersection( double x1, double y1, double x2, double y2, // 1st line (segment)
113-
double x3, double y3, double x4, double y4, // 2nd line segment
114-
double *x, double *y );
115-
116-
11782
/*
11883
* \brief compute the point wherre two lines intersects
11984
* \return true if the ok false if line are parallel

0 commit comments

Comments
 (0)