Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <basegfx/polygon/b3dpolypolygontools.hxx>
30 : : #include <basegfx/range/b3drange.hxx>
31 : : #include <basegfx/polygon/b3dpolypolygon.hxx>
32 : : #include <basegfx/polygon/b3dpolygon.hxx>
33 : : #include <basegfx/polygon/b3dpolygontools.hxx>
34 : : #include <numeric>
35 : : #include <basegfx/matrix/b3dhommatrix.hxx>
36 : : #include <basegfx/numeric/ftools.hxx>
37 : : #include <osl/mutex.hxx>
38 : :
39 : : //////////////////////////////////////////////////////////////////////////////
40 : :
41 : : namespace basegfx
42 : : {
43 : : namespace tools
44 : : {
45 : : // B3DPolyPolygon tools
46 : 33271 : B3DRange getRange(const B3DPolyPolygon& rCandidate)
47 : : {
48 : 33271 : B3DRange aRetval;
49 : 33271 : const sal_uInt32 nPolygonCount(rCandidate.count());
50 : :
51 [ + + ]: 66542 : for(sal_uInt32 a(0L); a < nPolygonCount; a++)
52 : : {
53 [ + - ]: 33271 : B3DPolygon aCandidate = rCandidate.getB3DPolygon(a);
54 [ + - ][ + - ]: 33271 : aRetval.expand(getRange(aCandidate));
55 [ + - ]: 33271 : }
56 : :
57 : 33271 : return aRetval;
58 : : }
59 : :
60 : 0 : B3DPolyPolygon createUnitCubePolyPolygon()
61 : : {
62 [ # # ][ # # ]: 0 : static B3DPolyPolygon aRetval;
[ # # ][ # # ]
63 [ # # ]: 0 : ::osl::Mutex m_mutex;
64 : :
65 [ # # ][ # # ]: 0 : if(!aRetval.count())
66 : : {
67 [ # # ]: 0 : B3DPolygon aTemp;
68 [ # # ]: 0 : aTemp.append(B3DPoint(0.0, 0.0, 1.0));
69 [ # # ]: 0 : aTemp.append(B3DPoint(0.0, 1.0, 1.0));
70 [ # # ]: 0 : aTemp.append(B3DPoint(1.0, 1.0, 1.0));
71 [ # # ]: 0 : aTemp.append(B3DPoint(1.0, 0.0, 1.0));
72 [ # # ]: 0 : aTemp.setClosed(true);
73 [ # # ]: 0 : aRetval.append(aTemp);
74 : :
75 [ # # ]: 0 : aTemp.clear();
76 [ # # ]: 0 : aTemp.append(B3DPoint(0.0, 0.0, 0.0));
77 [ # # ]: 0 : aTemp.append(B3DPoint(0.0, 1.0, 0.0));
78 [ # # ]: 0 : aTemp.append(B3DPoint(1.0, 1.0, 0.0));
79 [ # # ]: 0 : aTemp.append(B3DPoint(1.0, 0.0, 0.0));
80 [ # # ]: 0 : aTemp.setClosed(true);
81 [ # # ]: 0 : aRetval.append(aTemp);
82 : :
83 [ # # ]: 0 : aTemp.clear();
84 [ # # ]: 0 : aTemp.append(B3DPoint(0.0, 0.0, 0.0));
85 [ # # ]: 0 : aTemp.append(B3DPoint(0.0, 0.0, 1.0));
86 [ # # ]: 0 : aRetval.append(aTemp);
87 : :
88 [ # # ]: 0 : aTemp.clear();
89 [ # # ]: 0 : aTemp.append(B3DPoint(0.0, 1.0, 0.0));
90 [ # # ]: 0 : aTemp.append(B3DPoint(0.0, 1.0, 1.0));
91 [ # # ]: 0 : aRetval.append(aTemp);
92 : :
93 [ # # ]: 0 : aTemp.clear();
94 [ # # ]: 0 : aTemp.append(B3DPoint(1.0, 1.0, 0.0));
95 [ # # ]: 0 : aTemp.append(B3DPoint(1.0, 1.0, 1.0));
96 [ # # ]: 0 : aRetval.append(aTemp);
97 : :
98 [ # # ]: 0 : aTemp.clear();
99 [ # # ]: 0 : aTemp.append(B3DPoint(1.0, 0.0, 0.0));
100 [ # # ]: 0 : aTemp.append(B3DPoint(1.0, 0.0, 1.0));
101 [ # # ][ # # ]: 0 : aRetval.append(aTemp);
102 : : }
103 : :
104 [ # # ][ # # ]: 0 : return aRetval;
105 : : }
106 : :
107 : 0 : B3DPolyPolygon createUnitCubeFillPolyPolygon()
108 : : {
109 [ # # ][ # # ]: 0 : static B3DPolyPolygon aRetval;
[ # # ][ # # ]
110 [ # # ]: 0 : ::osl::Mutex m_mutex;
111 : :
112 [ # # ][ # # ]: 0 : if(!aRetval.count())
113 : : {
114 [ # # ]: 0 : B3DPolygon aTemp;
115 : :
116 : : // all points
117 : 0 : const B3DPoint A(0.0, 0.0, 0.0);
118 : 0 : const B3DPoint B(0.0, 1.0, 0.0);
119 : 0 : const B3DPoint C(1.0, 1.0, 0.0);
120 : 0 : const B3DPoint D(1.0, 0.0, 0.0);
121 : 0 : const B3DPoint E(0.0, 0.0, 1.0);
122 : 0 : const B3DPoint F(0.0, 1.0, 1.0);
123 : 0 : const B3DPoint G(1.0, 1.0, 1.0);
124 : 0 : const B3DPoint H(1.0, 0.0, 1.0);
125 : :
126 : : // create bottom
127 [ # # ]: 0 : aTemp.append(D);
128 [ # # ]: 0 : aTemp.append(A);
129 [ # # ]: 0 : aTemp.append(E);
130 [ # # ]: 0 : aTemp.append(H);
131 [ # # ]: 0 : aTemp.setClosed(true);
132 [ # # ]: 0 : aRetval.append(aTemp);
133 : :
134 : : // create front
135 [ # # ]: 0 : aTemp.clear();
136 [ # # ]: 0 : aTemp.append(B);
137 [ # # ]: 0 : aTemp.append(A);
138 [ # # ]: 0 : aTemp.append(D);
139 [ # # ]: 0 : aTemp.append(C);
140 [ # # ]: 0 : aTemp.setClosed(true);
141 [ # # ]: 0 : aRetval.append(aTemp);
142 : :
143 : : // create left
144 [ # # ]: 0 : aTemp.clear();
145 [ # # ]: 0 : aTemp.append(E);
146 [ # # ]: 0 : aTemp.append(A);
147 [ # # ]: 0 : aTemp.append(B);
148 [ # # ]: 0 : aTemp.append(F);
149 [ # # ]: 0 : aTemp.setClosed(true);
150 [ # # ]: 0 : aRetval.append(aTemp);
151 : :
152 : : // create top
153 [ # # ]: 0 : aTemp.clear();
154 [ # # ]: 0 : aTemp.append(C);
155 [ # # ]: 0 : aTemp.append(G);
156 [ # # ]: 0 : aTemp.append(F);
157 [ # # ]: 0 : aTemp.append(B);
158 [ # # ]: 0 : aTemp.setClosed(true);
159 [ # # ]: 0 : aRetval.append(aTemp);
160 : :
161 : : // create right
162 [ # # ]: 0 : aTemp.clear();
163 [ # # ]: 0 : aTemp.append(H);
164 [ # # ]: 0 : aTemp.append(G);
165 [ # # ]: 0 : aTemp.append(C);
166 [ # # ]: 0 : aTemp.append(D);
167 [ # # ]: 0 : aTemp.setClosed(true);
168 [ # # ]: 0 : aRetval.append(aTemp);
169 : :
170 : : // create back
171 [ # # ]: 0 : aTemp.clear();
172 [ # # ]: 0 : aTemp.append(F);
173 [ # # ]: 0 : aTemp.append(G);
174 [ # # ]: 0 : aTemp.append(H);
175 [ # # ]: 0 : aTemp.append(E);
176 [ # # ]: 0 : aTemp.setClosed(true);
177 [ # # ][ # # ]: 0 : aRetval.append(aTemp);
178 : : }
179 : :
180 [ # # ][ # # ]: 0 : return aRetval;
181 : : }
182 : :
183 : 0 : B3DPolyPolygon createCubePolyPolygonFromB3DRange( const B3DRange& rRange)
184 : : {
185 : 0 : B3DPolyPolygon aRetval;
186 : :
187 [ # # ][ # # ]: 0 : if(!rRange.isEmpty())
188 : : {
189 [ # # ][ # # ]: 0 : aRetval = createUnitCubePolyPolygon();
[ # # ]
190 [ # # ]: 0 : B3DHomMatrix aTrans;
191 [ # # ][ # # ]: 0 : aTrans.scale(rRange.getWidth(), rRange.getHeight(), rRange.getDepth());
[ # # ][ # # ]
192 [ # # ][ # # ]: 0 : aTrans.translate(rRange.getMinX(), rRange.getMinY(), rRange.getMinZ());
[ # # ][ # # ]
193 [ # # ]: 0 : aRetval.transform(aTrans);
194 [ # # ][ # # ]: 0 : aRetval.removeDoublePoints();
195 : : }
196 : :
197 : 0 : return aRetval;
198 : : }
199 : :
200 : 0 : B3DPolyPolygon createCubeFillPolyPolygonFromB3DRange( const B3DRange& rRange)
201 : : {
202 : 0 : B3DPolyPolygon aRetval;
203 : :
204 [ # # ][ # # ]: 0 : if(!rRange.isEmpty())
205 : : {
206 [ # # ][ # # ]: 0 : aRetval = createUnitCubeFillPolyPolygon();
[ # # ]
207 [ # # ]: 0 : B3DHomMatrix aTrans;
208 [ # # ][ # # ]: 0 : aTrans.scale(rRange.getWidth(), rRange.getHeight(), rRange.getDepth());
[ # # ][ # # ]
209 [ # # ][ # # ]: 0 : aTrans.translate(rRange.getMinX(), rRange.getMinY(), rRange.getMinZ());
[ # # ][ # # ]
210 [ # # ]: 0 : aRetval.transform(aTrans);
211 [ # # ][ # # ]: 0 : aRetval.removeDoublePoints();
212 : : }
213 : :
214 : 0 : return aRetval;
215 : : }
216 : :
217 : : // helper for getting the 3D Point from given cartesian coordiantes. fVer is defined from
218 : : // [F_PI2 .. -F_PI2], fHor from [0.0 .. F_2PI]
219 : 0 : inline B3DPoint getPointFromCartesian(double fVer, double fHor)
220 : : {
221 : 0 : const double fCosHor(cos(fHor));
222 : 0 : return B3DPoint(fCosHor * cos(fVer), sin(fHor), fCosHor * -sin(fVer));
223 : : }
224 : :
225 : 0 : B3DPolyPolygon createUnitSpherePolyPolygon(
226 : : sal_uInt32 nHorSeg, sal_uInt32 nVerSeg,
227 : : double fVerStart, double fVerStop,
228 : : double fHorStart, double fHorStop)
229 : : {
230 : 0 : B3DPolyPolygon aRetval;
231 : : sal_uInt32 a, b;
232 : :
233 [ # # ]: 0 : if(!nHorSeg)
234 : : {
235 : 0 : nHorSeg = fround(fabs(fHorStop - fHorStart) / (F_2PI / 24.0));
236 : : }
237 : :
238 [ # # ]: 0 : if(!nHorSeg)
239 : : {
240 : 0 : nHorSeg = 1L;
241 : : }
242 : :
243 [ # # ]: 0 : if(!nVerSeg)
244 : : {
245 : 0 : nVerSeg = fround(fabs(fVerStop - fVerStart) / (F_2PI / 24.0));
246 : : }
247 : :
248 [ # # ]: 0 : if(!nVerSeg)
249 : : {
250 : 0 : nVerSeg = 1L;
251 : : }
252 : :
253 : : // create constants
254 : 0 : const double fVerDiffPerStep((fVerStop - fVerStart) / (double)nVerSeg);
255 : 0 : const double fHorDiffPerStep((fHorStop - fHorStart) / (double)nHorSeg);
256 : 0 : bool bHorClosed(fTools::equal(fHorStop - fHorStart, F_2PI));
257 : 0 : bool bVerFromTop(fTools::equal(fVerStart, F_PI2));
258 : 0 : bool bVerToBottom(fTools::equal(fVerStop, -F_PI2));
259 : :
260 : : // create horizontal rings
261 [ # # ]: 0 : const sal_uInt32 nLoopVerInit(bVerFromTop ? 1L : 0L);
262 [ # # ]: 0 : const sal_uInt32 nLoopVerLimit(bVerToBottom ? nVerSeg : nVerSeg + 1L);
263 [ # # ]: 0 : const sal_uInt32 nLoopHorLimit(bHorClosed ? nHorSeg : nHorSeg + 1L);
264 : :
265 [ # # ]: 0 : for(a = nLoopVerInit; a < nLoopVerLimit; a++)
266 : : {
267 : 0 : const double fVer(fVerStart + ((double)(a) * fVerDiffPerStep));
268 [ # # ]: 0 : B3DPolygon aNew;
269 : :
270 [ # # ]: 0 : for(b = 0L; b < nLoopHorLimit; b++)
271 : : {
272 : 0 : const double fHor(fHorStart + ((double)(b) * fHorDiffPerStep));
273 [ # # ]: 0 : aNew.append(getPointFromCartesian(fHor, fVer));
274 : : }
275 : :
276 [ # # ]: 0 : aNew.setClosed(bHorClosed);
277 [ # # ]: 0 : aRetval.append(aNew);
278 [ # # ]: 0 : }
279 : :
280 : : // create vertical half-rings
281 [ # # ]: 0 : for(a = 0L; a < nLoopHorLimit; a++)
282 : : {
283 : 0 : const double fHor(fHorStart + ((double)(a) * fHorDiffPerStep));
284 [ # # ]: 0 : B3DPolygon aNew;
285 : :
286 [ # # ]: 0 : if(bVerFromTop)
287 : : {
288 [ # # ]: 0 : aNew.append(B3DPoint(0.0, 1.0, 0.0));
289 : : }
290 : :
291 [ # # ]: 0 : for(b = nLoopVerInit; b < nLoopVerLimit; b++)
292 : : {
293 : 0 : const double fVer(fVerStart + ((double)(b) * fVerDiffPerStep));
294 [ # # ]: 0 : aNew.append(getPointFromCartesian(fHor, fVer));
295 : : }
296 : :
297 [ # # ]: 0 : if(bVerToBottom)
298 : : {
299 [ # # ]: 0 : aNew.append(B3DPoint(0.0, -1.0, 0.0));
300 : : }
301 : :
302 [ # # ]: 0 : aRetval.append(aNew);
303 [ # # ]: 0 : }
304 : :
305 : 0 : return aRetval;
306 : : }
307 : :
308 : 0 : B3DPolyPolygon createSpherePolyPolygonFromB3DRange( const B3DRange& rRange,
309 : : sal_uInt32 nHorSeg, sal_uInt32 nVerSeg,
310 : : double fVerStart, double fVerStop,
311 : : double fHorStart, double fHorStop)
312 : : {
313 : 0 : B3DPolyPolygon aRetval(createUnitSpherePolyPolygon(nHorSeg, nVerSeg, fVerStart, fVerStop, fHorStart, fHorStop));
314 : :
315 [ # # ][ # # ]: 0 : if(aRetval.count())
316 : : {
317 : : // move and scale whole construct which is now in [-1.0 .. 1.0] in all directions
318 [ # # ]: 0 : B3DHomMatrix aTrans;
319 [ # # ]: 0 : aTrans.translate(1.0, 1.0, 1.0);
320 [ # # ][ # # ]: 0 : aTrans.scale(rRange.getWidth() / 2.0, rRange.getHeight() / 2.0, rRange.getDepth() / 2.0);
[ # # ][ # # ]
321 [ # # ][ # # ]: 0 : aTrans.translate(rRange.getMinX(), rRange.getMinY(), rRange.getMinZ());
[ # # ][ # # ]
322 [ # # ][ # # ]: 0 : aRetval.transform(aTrans);
323 : : }
324 : :
325 : 0 : return aRetval;
326 : : }
327 : :
328 : 0 : B3DPolyPolygon createUnitSphereFillPolyPolygon(
329 : : sal_uInt32 nHorSeg, sal_uInt32 nVerSeg,
330 : : bool bNormals,
331 : : double fVerStart, double fVerStop,
332 : : double fHorStart, double fHorStop)
333 : : {
334 : 0 : B3DPolyPolygon aRetval;
335 : :
336 [ # # ]: 0 : if(!nHorSeg)
337 : : {
338 : 0 : nHorSeg = fround(fabs(fHorStop - fHorStart) / (F_2PI / 24.0));
339 : : }
340 : :
341 [ # # ]: 0 : if(!nHorSeg)
342 : : {
343 : 0 : nHorSeg = 1L;
344 : : }
345 : :
346 [ # # ]: 0 : if(!nVerSeg)
347 : : {
348 : 0 : nVerSeg = fround(fabs(fVerStop - fVerStart) / (F_2PI / 24.0));
349 : : }
350 : :
351 [ # # ]: 0 : if(!nVerSeg)
352 : : {
353 : 0 : nVerSeg = 1L;
354 : : }
355 : :
356 : : // vertical loop
357 [ # # ]: 0 : for(sal_uInt32 a(0L); a < nVerSeg; a++)
358 : : {
359 : 0 : const double fVer(fVerStart + (((fVerStop - fVerStart) * a) / nVerSeg));
360 : 0 : const double fVer2(fVerStart + (((fVerStop - fVerStart) * (a + 1)) / nVerSeg));
361 : :
362 : : // horizontal loop
363 [ # # ]: 0 : for(sal_uInt32 b(0L); b < nHorSeg; b++)
364 : : {
365 : 0 : const double fHor(fHorStart + (((fHorStop - fHorStart) * b) / nHorSeg));
366 : 0 : const double fHor2(fHorStart + (((fHorStop - fHorStart) * (b + 1)) / nHorSeg));
367 [ # # ]: 0 : B3DPolygon aNew;
368 : :
369 [ # # ]: 0 : aNew.append(getPointFromCartesian(fHor, fVer));
370 [ # # ]: 0 : aNew.append(getPointFromCartesian(fHor2, fVer));
371 [ # # ]: 0 : aNew.append(getPointFromCartesian(fHor2, fVer2));
372 [ # # ]: 0 : aNew.append(getPointFromCartesian(fHor, fVer2));
373 : :
374 [ # # ]: 0 : if(bNormals)
375 : : {
376 [ # # ][ # # ]: 0 : for(sal_uInt32 c(0L); c < aNew.count(); c++)
377 : : {
378 [ # # ][ # # ]: 0 : aNew.setNormal(c, ::basegfx::B3DVector(aNew.getB3DPoint(c)));
379 : : }
380 : : }
381 : :
382 [ # # ]: 0 : aNew.setClosed(true);
383 [ # # ]: 0 : aRetval.append(aNew);
384 [ # # ]: 0 : }
385 : : }
386 : :
387 : 0 : return aRetval;
388 : : }
389 : :
390 : 0 : B3DPolyPolygon createSphereFillPolyPolygonFromB3DRange( const B3DRange& rRange,
391 : : sal_uInt32 nHorSeg, sal_uInt32 nVerSeg,
392 : : bool bNormals,
393 : : double fVerStart, double fVerStop,
394 : : double fHorStart, double fHorStop)
395 : : {
396 : 0 : B3DPolyPolygon aRetval(createUnitSphereFillPolyPolygon(nHorSeg, nVerSeg, bNormals, fVerStart, fVerStop, fHorStart, fHorStop));
397 : :
398 [ # # ][ # # ]: 0 : if(aRetval.count())
399 : : {
400 : : // move and scale whole construct which is now in [-1.0 .. 1.0] in all directions
401 [ # # ]: 0 : B3DHomMatrix aTrans;
402 [ # # ]: 0 : aTrans.translate(1.0, 1.0, 1.0);
403 [ # # ][ # # ]: 0 : aTrans.scale(rRange.getWidth() / 2.0, rRange.getHeight() / 2.0, rRange.getDepth() / 2.0);
[ # # ][ # # ]
404 [ # # ][ # # ]: 0 : aTrans.translate(rRange.getMinX(), rRange.getMinY(), rRange.getMinZ());
[ # # ][ # # ]
405 [ # # ][ # # ]: 0 : aRetval.transform(aTrans);
406 : : }
407 : :
408 : 0 : return aRetval;
409 : : }
410 : :
411 : 0 : B3DPolyPolygon applyDefaultNormalsSphere( const B3DPolyPolygon& rCandidate, const B3DPoint& rCenter)
412 : : {
413 : 0 : B3DPolyPolygon aRetval;
414 : :
415 [ # # ][ # # ]: 0 : for(sal_uInt32 a(0L); a < rCandidate.count(); a++)
416 : : {
417 [ # # ][ # # ]: 0 : aRetval.append(applyDefaultNormalsSphere(rCandidate.getB3DPolygon(a), rCenter));
[ # # ][ # # ]
[ # # ]
418 : : }
419 : :
420 : 0 : return aRetval;
421 : : }
422 : :
423 : 0 : B3DPolyPolygon invertNormals( const B3DPolyPolygon& rCandidate)
424 : : {
425 : 0 : B3DPolyPolygon aRetval;
426 : :
427 [ # # ][ # # ]: 0 : for(sal_uInt32 a(0L); a < rCandidate.count(); a++)
428 : : {
429 [ # # ][ # # ]: 0 : aRetval.append(invertNormals(rCandidate.getB3DPolygon(a)));
[ # # ][ # # ]
[ # # ]
430 : : }
431 : :
432 : 0 : return aRetval;
433 : : }
434 : :
435 : 144 : B3DPolyPolygon applyDefaultTextureCoordinatesParallel( const B3DPolyPolygon& rCandidate, const B3DRange& rRange, bool bChangeX, bool bChangeY)
436 : : {
437 : 144 : B3DPolyPolygon aRetval;
438 : :
439 [ + - ][ + + ]: 288 : for(sal_uInt32 a(0L); a < rCandidate.count(); a++)
440 : : {
441 [ + - ][ + - ]: 144 : aRetval.append(applyDefaultTextureCoordinatesParallel(rCandidate.getB3DPolygon(a), rRange, bChangeX, bChangeY));
[ + - ][ + - ]
[ + - ]
442 : : }
443 : :
444 : 144 : return aRetval;
445 : : }
446 : :
447 : 0 : B3DPolyPolygon applyDefaultTextureCoordinatesSphere( const B3DPolyPolygon& rCandidate, const B3DPoint& rCenter, bool bChangeX, bool bChangeY)
448 : : {
449 : 0 : B3DPolyPolygon aRetval;
450 : :
451 [ # # ][ # # ]: 0 : for(sal_uInt32 a(0L); a < rCandidate.count(); a++)
452 : : {
453 [ # # ][ # # ]: 0 : aRetval.append(applyDefaultTextureCoordinatesSphere(rCandidate.getB3DPolygon(a), rCenter, bChangeX, bChangeY));
[ # # ][ # # ]
[ # # ]
454 : : }
455 : :
456 : 0 : return aRetval;
457 : : }
458 : :
459 : 0 : bool isInside(const B3DPolyPolygon& rCandidate, const B3DPoint& rPoint, bool bWithBorder)
460 : : {
461 : 0 : const sal_uInt32 nPolygonCount(rCandidate.count());
462 : :
463 [ # # ]: 0 : if(1L == nPolygonCount)
464 : : {
465 [ # # ]: 0 : return isInside(rCandidate.getB3DPolygon(0), rPoint, bWithBorder);
466 : : }
467 : : else
468 : : {
469 : 0 : sal_Int32 nInsideCount(0);
470 : :
471 [ # # ]: 0 : for(sal_uInt32 a(0); a < nPolygonCount; a++)
472 : : {
473 [ # # ]: 0 : const B3DPolygon aPolygon(rCandidate.getB3DPolygon(a));
474 [ # # ]: 0 : const bool bInside(isInside(aPolygon, rPoint, bWithBorder));
475 : :
476 [ # # ]: 0 : if(bInside)
477 : : {
478 : 0 : nInsideCount++;
479 : : }
480 [ # # ]: 0 : }
481 : :
482 : 0 : return (nInsideCount % 2L);
483 : : }
484 : : }
485 : :
486 : : } // end of namespace tools
487 : : } // end of namespace basegfx
488 : :
489 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|