LibreOffice Module basegfx (master) 1
b3dpolypolygontools.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
27#include <com/sun/star/drawing/DoubleSequence.hpp>
28#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
29
30// predefines
31#define nMinSegments sal_uInt32(1)
32#define nMaxSegments sal_uInt32(512)
33
34namespace basegfx::utils
35{
36 // B3DPolyPolygon tools
37 B3DRange getRange(const B3DPolyPolygon& rCandidate)
38 {
39 B3DRange aRetval;
40
41 for(const auto& rPolygon : rCandidate )
42 {
43 aRetval.expand(getRange(rPolygon));
44 }
45
46 return aRetval;
47 }
48
50 {
51 static auto const singleton = [] {
52 B3DPolyPolygon aRetval;
53 B3DPolygon aTemp;
54 aTemp.append(B3DPoint(0.0, 0.0, 1.0));
55 aTemp.append(B3DPoint(0.0, 1.0, 1.0));
56 aTemp.append(B3DPoint(1.0, 1.0, 1.0));
57 aTemp.append(B3DPoint(1.0, 0.0, 1.0));
58 aTemp.setClosed(true);
59 aRetval.append(aTemp);
60
61 aTemp.clear();
62 aTemp.append(B3DPoint(0.0, 0.0, 0.0));
63 aTemp.append(B3DPoint(0.0, 1.0, 0.0));
64 aTemp.append(B3DPoint(1.0, 1.0, 0.0));
65 aTemp.append(B3DPoint(1.0, 0.0, 0.0));
66 aTemp.setClosed(true);
67 aRetval.append(aTemp);
68
69 aTemp.clear();
70 aTemp.append(B3DPoint(0.0, 0.0, 0.0));
71 aTemp.append(B3DPoint(0.0, 0.0, 1.0));
72 aRetval.append(aTemp);
73
74 aTemp.clear();
75 aTemp.append(B3DPoint(0.0, 1.0, 0.0));
76 aTemp.append(B3DPoint(0.0, 1.0, 1.0));
77 aRetval.append(aTemp);
78
79 aTemp.clear();
80 aTemp.append(B3DPoint(1.0, 1.0, 0.0));
81 aTemp.append(B3DPoint(1.0, 1.0, 1.0));
82 aRetval.append(aTemp);
83
84 aTemp.clear();
85 aTemp.append(B3DPoint(1.0, 0.0, 0.0));
86 aTemp.append(B3DPoint(1.0, 0.0, 1.0));
87 aRetval.append(aTemp);
88 return aRetval;
89 }();
90 return singleton;
91 }
92
94 {
95 static auto const singleton = [] {
96 B3DPolyPolygon aRetval;
97 B3DPolygon aTemp;
98
99 // all points
100 const B3DPoint A(0.0, 0.0, 0.0);
101 const B3DPoint B(0.0, 1.0, 0.0);
102 const B3DPoint C(1.0, 1.0, 0.0);
103 const B3DPoint D(1.0, 0.0, 0.0);
104 const B3DPoint E(0.0, 0.0, 1.0);
105 const B3DPoint F(0.0, 1.0, 1.0);
106 const B3DPoint G(1.0, 1.0, 1.0);
107 const B3DPoint H(1.0, 0.0, 1.0);
108
109 // create bottom
110 aTemp.append(D);
111 aTemp.append(A);
112 aTemp.append(E);
113 aTemp.append(H);
114 aTemp.setClosed(true);
115 aRetval.append(aTemp);
116
117 // create front
118 aTemp.clear();
119 aTemp.append(B);
120 aTemp.append(A);
121 aTemp.append(D);
122 aTemp.append(C);
123 aTemp.setClosed(true);
124 aRetval.append(aTemp);
125
126 // create left
127 aTemp.clear();
128 aTemp.append(E);
129 aTemp.append(A);
130 aTemp.append(B);
131 aTemp.append(F);
132 aTemp.setClosed(true);
133 aRetval.append(aTemp);
134
135 // create top
136 aTemp.clear();
137 aTemp.append(C);
138 aTemp.append(G);
139 aTemp.append(F);
140 aTemp.append(B);
141 aTemp.setClosed(true);
142 aRetval.append(aTemp);
143
144 // create right
145 aTemp.clear();
146 aTemp.append(H);
147 aTemp.append(G);
148 aTemp.append(C);
149 aTemp.append(D);
150 aTemp.setClosed(true);
151 aRetval.append(aTemp);
152
153 // create back
154 aTemp.clear();
155 aTemp.append(F);
156 aTemp.append(G);
157 aTemp.append(H);
158 aTemp.append(E);
159 aTemp.setClosed(true);
160 aRetval.append(aTemp);
161 return aRetval;
162 }();
163 return singleton;
164 }
165
167 {
168 B3DPolyPolygon aRetval;
169
170 if(!rRange.isEmpty())
171 {
172 aRetval = createUnitCubePolyPolygon();
173 B3DHomMatrix aTrans;
174 aTrans.scale(rRange.getWidth(), rRange.getHeight(), rRange.getDepth());
175 aTrans.translate(rRange.getMinX(), rRange.getMinY(), rRange.getMinZ());
176 aRetval.transform(aTrans);
177 aRetval.removeDoublePoints();
178 }
179
180 return aRetval;
181 }
182
184 {
185 B3DPolyPolygon aRetval;
186
187 if(!rRange.isEmpty())
188 {
190 B3DHomMatrix aTrans;
191 aTrans.scale(rRange.getWidth(), rRange.getHeight(), rRange.getDepth());
192 aTrans.translate(rRange.getMinX(), rRange.getMinY(), rRange.getMinZ());
193 aRetval.transform(aTrans);
194 aRetval.removeDoublePoints();
195 }
196
197 return aRetval;
198 }
199
200 // helper for getting the 3D Point from given cartesian coordinates. fHor is defined from
201 // [M_PI_2 .. -M_PI_2], fVer from [0.0 .. 2PI]
202 static B3DPoint getPointFromCartesian(double fHor, double fVer)
203 {
204 const double fCosVer(cos(fVer));
205 return B3DPoint(fCosVer * cos(fHor), sin(fVer), fCosVer * -sin(fHor));
206 }
207
209 sal_uInt32 nHorSeg, sal_uInt32 nVerSeg,
210 double fVerStart, double fVerStop,
211 double fHorStart, double fHorStop)
212 {
213 B3DPolyPolygon aRetval;
214 sal_uInt32 a, b;
215
216 if(!nHorSeg)
217 {
218 nHorSeg = fround(fabs(fHorStop - fHorStart) / (M_PI / 12.0));
219 }
220
221 // min/max limitations
222 nHorSeg = std::clamp(nHorSeg, nMinSegments, nMaxSegments);
223
224 if(!nVerSeg)
225 {
226 nVerSeg = fround(fabs(fVerStop - fVerStart) / (M_PI / 12.0));
227 }
228
229 // min/max limitations
230 nVerSeg = std::clamp(nVerSeg, nMinSegments, nMaxSegments);
231
232 // create constants
233 const double fVerDiffPerStep((fVerStop - fVerStart) / static_cast<double>(nVerSeg));
234 const double fHorDiffPerStep((fHorStop - fHorStart) / static_cast<double>(nHorSeg));
235 bool bHorClosed(fTools::equal(fHorStop - fHorStart, 2 * M_PI));
236 bool bVerFromTop(fTools::equal(fVerStart, M_PI_2));
237 bool bVerToBottom(fTools::equal(fVerStop, -M_PI_2));
238
239 // create horizontal rings
240 const sal_uInt32 nLoopVerInit(bVerFromTop ? 1 : 0);
241 const sal_uInt32 nLoopVerLimit(bVerToBottom ? nVerSeg : nVerSeg + 1);
242 const sal_uInt32 nLoopHorLimit(bHorClosed ? nHorSeg : nHorSeg + 1);
243
244 for(a = nLoopVerInit; a < nLoopVerLimit; a++)
245 {
246 const double fVer(fVerStart + (static_cast<double>(a) * fVerDiffPerStep));
247 B3DPolygon aNew;
248
249 for(b = 0; b < nLoopHorLimit; b++)
250 {
251 const double fHor(fHorStart + (static_cast<double>(b) * fHorDiffPerStep));
252 aNew.append(getPointFromCartesian(fHor, fVer));
253 }
254
255 aNew.setClosed(bHorClosed);
256 aRetval.append(aNew);
257 }
258
259 // create vertical half-rings
260 for(a = 0; a < nLoopHorLimit; a++)
261 {
262 const double fHor(fHorStart + (static_cast<double>(a) * fHorDiffPerStep));
263 B3DPolygon aNew;
264
265 if(bVerFromTop)
266 {
267 aNew.append(B3DPoint(0.0, 1.0, 0.0));
268 }
269
270 for(b = nLoopVerInit; b < nLoopVerLimit; b++)
271 {
272 const double fVer(fVerStart + (static_cast<double>(b) * fVerDiffPerStep));
273 aNew.append(getPointFromCartesian(fHor, fVer));
274 }
275
276 if(bVerToBottom)
277 {
278 aNew.append(B3DPoint(0.0, -1.0, 0.0));
279 }
280
281 aRetval.append(aNew);
282 }
283
284 return aRetval;
285 }
286
288 sal_uInt32 nHorSeg, sal_uInt32 nVerSeg,
289 double fVerStart, double fVerStop,
290 double fHorStart, double fHorStop)
291 {
292 B3DPolyPolygon aRetval(createUnitSpherePolyPolygon(nHorSeg, nVerSeg, fVerStart, fVerStop, fHorStart, fHorStop));
293
294 if(aRetval.count())
295 {
296 // move and scale whole construct which is now in [-1.0 .. 1.0] in all directions
297 B3DHomMatrix aTrans;
298 aTrans.translate(1.0, 1.0, 1.0);
299 aTrans.scale(rRange.getWidth() / 2.0, rRange.getHeight() / 2.0, rRange.getDepth() / 2.0);
300 aTrans.translate(rRange.getMinX(), rRange.getMinY(), rRange.getMinZ());
301 aRetval.transform(aTrans);
302 }
303
304 return aRetval;
305 }
306
308 sal_uInt32 nHorSeg, sal_uInt32 nVerSeg,
309 bool bNormals,
310 double fVerStart, double fVerStop,
311 double fHorStart, double fHorStop)
312 {
313 B3DPolyPolygon aRetval;
314
315 if(!nHorSeg)
316 {
317 nHorSeg = fround(fabs(fHorStop - fHorStart) / (M_PI / 12.0));
318 }
319
320 // min/max limitations
321 nHorSeg = std::clamp(nHorSeg, nMinSegments, nMaxSegments);
322
323 if(!nVerSeg)
324 {
325 nVerSeg = fround(fabs(fVerStop - fVerStart) / (M_PI / 12.0));
326 }
327
328 // min/max limitations
329 nVerSeg = std::clamp(nVerSeg, nMinSegments, nMaxSegments);
330
331 // vertical loop
332 for(sal_uInt32 a(0); a < nVerSeg; a++)
333 {
334 const double fVer1(fVerStart + (((fVerStop - fVerStart) * a) / nVerSeg));
335 const double fVer2(fVerStart + (((fVerStop - fVerStart) * (a + 1)) / nVerSeg));
336
337 // horizontal loop
338 for(sal_uInt32 b(0); b < nHorSeg; b++)
339 {
340 const double fHor1(fHorStart + (((fHorStop - fHorStart) * b) / nHorSeg));
341 const double fHor2(fHorStart + (((fHorStop - fHorStart) * (b + 1)) / nHorSeg));
342 B3DPolygon aNew;
343
344 aNew.append(getPointFromCartesian(fHor1, fVer1));
345 aNew.append(getPointFromCartesian(fHor2, fVer1));
346 aNew.append(getPointFromCartesian(fHor2, fVer2));
347 aNew.append(getPointFromCartesian(fHor1, fVer2));
348
349 if(bNormals)
350 {
351 for(sal_uInt32 c(0); c < aNew.count(); c++)
352 {
354 }
355 }
356
357 aNew.setClosed(true);
358 aRetval.append(aNew);
359 }
360 }
361
362 return aRetval;
363 }
364
366 sal_uInt32 nHorSeg, sal_uInt32 nVerSeg,
367 bool bNormals,
368 double fVerStart, double fVerStop,
369 double fHorStart, double fHorStop)
370 {
371 B3DPolyPolygon aRetval(createUnitSphereFillPolyPolygon(nHorSeg, nVerSeg, bNormals, fVerStart, fVerStop, fHorStart, fHorStop));
372
373 if(aRetval.count())
374 {
375 // move and scale whole construct which is now in [-1.0 .. 1.0] in all directions
376 B3DHomMatrix aTrans;
377 aTrans.translate(1.0, 1.0, 1.0);
378 aTrans.scale(rRange.getWidth() / 2.0, rRange.getHeight() / 2.0, rRange.getDepth() / 2.0);
379 aTrans.translate(rRange.getMinX(), rRange.getMinY(), rRange.getMinZ());
380 aRetval.transform(aTrans);
381 }
382
383 return aRetval;
384 }
385
387 {
388 B3DPolyPolygon aRetval;
389
390 for( const auto& rB3DPolygon : rCandidate)
391 {
392 aRetval.append(applyDefaultNormalsSphere(rB3DPolygon, rCenter));
393 }
394
395 return aRetval;
396 }
397
399 {
400 B3DPolyPolygon aRetval;
401
402 for( const auto& rB3DPolygon : rCandidate )
403 {
404 aRetval.append(invertNormals(rB3DPolygon));
405 }
406
407 return aRetval;
408 }
409
410 B3DPolyPolygon applyDefaultTextureCoordinatesParallel( const B3DPolyPolygon& rCandidate, const B3DRange& rRange, bool bChangeX, bool bChangeY)
411 {
412 B3DPolyPolygon aRetval;
413
414 for( const auto& rB3DPolygon : rCandidate)
415 {
416 aRetval.append(applyDefaultTextureCoordinatesParallel(rB3DPolygon, rRange, bChangeX, bChangeY));
417 }
418
419 return aRetval;
420 }
421
422 B3DPolyPolygon applyDefaultTextureCoordinatesSphere( const B3DPolyPolygon& rCandidate, const B3DPoint& rCenter, bool bChangeX, bool bChangeY)
423 {
424 B3DPolyPolygon aRetval;
425
426 for( const auto& rB3DPolygon : rCandidate )
427 {
428 aRetval.append(applyDefaultTextureCoordinatesSphere(rB3DPolygon, rCenter, bChangeX, bChangeY));
429 }
430
431 return aRetval;
432 }
433
434 bool isInside(const B3DPolyPolygon& rCandidate, const B3DPoint& rPoint)
435 {
436 const sal_uInt32 nPolygonCount(rCandidate.count());
437
438 if(nPolygonCount == 1)
439 {
440 return isInside(rCandidate.getB3DPolygon(0), rPoint, false/*bWithBorder*/);
441 }
442 else
443 {
444 sal_Int32 nInsideCount(0);
445
446 for(const auto& rPolygon : rCandidate )
447 {
448 const bool bInside(isInside(rPolygon, rPoint, false/*bWithBorder*/));
449
450 if(bInside)
451 {
452 nInsideCount++;
453 }
454 }
455
456 return (nInsideCount % 2);
457 }
458 }
459
462 const css::drawing::PolyPolygonShape3D& rPolyPolygonShape3DSource)
463 {
464 B3DPolyPolygon aRetval;
465 const sal_Int32 nOuterSequenceCount(rPolyPolygonShape3DSource.SequenceX.getLength());
466
467 if(nOuterSequenceCount)
468 {
469 assert(nOuterSequenceCount == rPolyPolygonShape3DSource.SequenceY.getLength()
470 && nOuterSequenceCount
471 == rPolyPolygonShape3DSource.SequenceZ.getLength()&&
472 "UnoPolyPolygonShape3DToB3DPolygon: Not all double sequences have the same "
473 "length (!)" );
474
475 const css::drawing::DoubleSequence* pInnerSequenceX = rPolyPolygonShape3DSource.SequenceX.getConstArray();
476 const css::drawing::DoubleSequence* pInnerSequenceY = rPolyPolygonShape3DSource.SequenceY.getConstArray();
477 const css::drawing::DoubleSequence* pInnerSequenceZ = rPolyPolygonShape3DSource.SequenceZ.getConstArray();
478
479 for(sal_Int32 a(0); a < nOuterSequenceCount; a++)
480 {
481 basegfx::B3DPolygon aNewPolygon;
482 const sal_Int32 nInnerSequenceCount(pInnerSequenceX->getLength());
483 assert(nInnerSequenceCount == pInnerSequenceY->getLength()
484 && nInnerSequenceCount == pInnerSequenceZ->getLength()
485 && "UnoPolyPolygonShape3DToB3DPolygon: Not all double sequences have "
486 "the same length (!)");
487
488 const double* pArrayX = pInnerSequenceX->getConstArray();
489 const double* pArrayY = pInnerSequenceY->getConstArray();
490 const double* pArrayZ = pInnerSequenceZ->getConstArray();
491
492 for(sal_Int32 b(0); b < nInnerSequenceCount; b++)
493 {
494 aNewPolygon.append(basegfx::B3DPoint(*pArrayX++,*pArrayY++,*pArrayZ++));
495 }
496
497 pInnerSequenceX++;
498 pInnerSequenceY++;
499 pInnerSequenceZ++;
500
501 // #i101520# correction is needed for imported polygons of old format,
502 // see callers
503 basegfx::utils::checkClosed(aNewPolygon);
504
505 aRetval.append(aNewPolygon);
506 }
507 }
508
509 return aRetval;
510 }
511
513 const B3DPolyPolygon& rPolyPolygonSource,
514 css::drawing::PolyPolygonShape3D& rPolyPolygonShape3DRetval)
515 {
516 const sal_uInt32 nPolygonCount(rPolyPolygonSource.count());
517
518 if(nPolygonCount)
519 {
520 rPolyPolygonShape3DRetval.SequenceX.realloc(nPolygonCount);
521 rPolyPolygonShape3DRetval.SequenceY.realloc(nPolygonCount);
522 rPolyPolygonShape3DRetval.SequenceZ.realloc(nPolygonCount);
523
524 css::drawing::DoubleSequence* pOuterSequenceX = rPolyPolygonShape3DRetval.SequenceX.getArray();
525 css::drawing::DoubleSequence* pOuterSequenceY = rPolyPolygonShape3DRetval.SequenceY.getArray();
526 css::drawing::DoubleSequence* pOuterSequenceZ = rPolyPolygonShape3DRetval.SequenceZ.getArray();
527
528 for(sal_uInt32 a(0); a < nPolygonCount; a++)
529 {
530 const basegfx::B3DPolygon& aPoly(rPolyPolygonSource.getB3DPolygon(a));
531 const sal_uInt32 nPointCount(aPoly.count());
532
533 if(nPointCount)
534 {
535 const bool bIsClosed(aPoly.isClosed());
536 const sal_uInt32 nTargetCount(bIsClosed ? nPointCount + 1 : nPointCount);
537 pOuterSequenceX->realloc(nTargetCount);
538 pOuterSequenceY->realloc(nTargetCount);
539 pOuterSequenceZ->realloc(nTargetCount);
540
541 double* pInnerSequenceX = pOuterSequenceX->getArray();
542 double* pInnerSequenceY = pOuterSequenceY->getArray();
543 double* pInnerSequenceZ = pOuterSequenceZ->getArray();
544
545 for(sal_uInt32 b(0); b < nPointCount; b++)
546 {
547 const basegfx::B3DPoint aPoint(aPoly.getB3DPoint(b));
548
549 *pInnerSequenceX++ = aPoint.getX();
550 *pInnerSequenceY++ = aPoint.getY();
551 *pInnerSequenceZ++ = aPoint.getZ();
552 }
553
554 if(bIsClosed)
555 {
556 const basegfx::B3DPoint aPoint(aPoly.getB3DPoint(0));
557
558 *pInnerSequenceX++ = aPoint.getX();
559 *pInnerSequenceY++ = aPoint.getY();
560 *pInnerSequenceZ++ = aPoint.getZ();
561 }
562 }
563 else
564 {
565 pOuterSequenceX->realloc(0);
566 pOuterSequenceY->realloc(0);
567 pOuterSequenceZ->realloc(0);
568 }
569
570 pOuterSequenceX++;
571 pOuterSequenceY++;
572 pOuterSequenceZ++;
573 }
574 }
575 else
576 {
577 rPolyPolygonShape3DRetval.SequenceX.realloc(0);
578 rPolyPolygonShape3DRetval.SequenceY.realloc(0);
579 rPolyPolygonShape3DRetval.SequenceZ.realloc(0);
580 }
581 }
582
583} // end of namespace
584
585/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define nMinSegments
#define nMaxSegments
void translate(double fX, double fY, double fZ)
Translation.
void scale(double fX, double fY, double fZ)
Scaling.
Base Point class with three double values.
Definition: b3dpoint.hxx:38
sal_uInt32 count() const
void transform(const basegfx::B3DHomMatrix &rMatrix)
void append(const B3DPolygon &rPolygon, sal_uInt32 nCount=1)
B3DPolygon const & getB3DPolygon(sal_uInt32 nIndex) const
bool isClosed() const
void append(const B3DPoint &rPoint, sal_uInt32 nCount=1)
B3DPoint const & getB3DPoint(sal_uInt32 nIndex) const
sal_uInt32 count() const
void setNormal(sal_uInt32 nIndex, const B3DVector &rValue)
void setClosed(bool bNew)
double getMinZ() const
Definition: b3drange.hxx:114
double getHeight() const
Definition: b3drange.hxx:139
double getMinX() const
Definition: b3drange.hxx:104
bool isEmpty() const
Definition: b3drange.hxx:74
void expand(const B3DTuple &rTuple)
Definition: b3drange.hxx:176
double getDepth() const
Definition: b3drange.hxx:144
double getWidth() const
Definition: b3drange.hxx:134
double getMinY() const
Definition: b3drange.hxx:109
Base Point class with three double values.
Definition: b3dvector.hxx:38
TYPE getX() const
Get X-Coordinate of 3D Tuple.
Definition: Tuple3D.hxx:57
TYPE getZ() const
Get Z-Coordinate of 3D Tuple.
Definition: Tuple3D.hxx:63
TYPE getY() const
Get Y-Coordinate of 3D Tuple.
Definition: Tuple3D.hxx:60
uno_Any a
bool equal(T const &rfValA, T const &rfValB)
Definition: ftools.hxx:169
B3DPolyPolygon createCubePolyPolygonFromB3DRange(const B3DRange &rRange)
Create a 3D line polyPolygon from a B3DRange which defines a cube.
B3DPolygon applyDefaultTextureCoordinatesSphere(const B3DPolygon &rCandidate, const B3DPoint &rCenter, bool bChangeX, bool bChangeY)
Create/replace texture coordinates for given 3d geometry with spherical one rCenter: the centre of th...
B3DPolyPolygon createSphereFillPolyPolygonFromB3DRange(const B3DRange &rRange, sal_uInt32 nHorSeg, sal_uInt32 nVerSeg, bool bNormals, double fVerStart, double fVerStop, double fHorStart, double fHorStop)
same as createSpherePolyPolygonFromB3DRange, but creates filled polygons (closed and oriented) There ...
static B3DPoint getPointFromCartesian(double fHor, double fVer)
B3DPolyPolygon createCubeFillPolyPolygonFromB3DRange(const B3DRange &rRange)
Create a 3D fill polyPolygon from a B3DRange which defines a cube.
bool isInside(const B2DPolygon &rCandidate, const B2DPoint &rPoint, bool bWithBorder)
B3DPolygon applyDefaultNormalsSphere(const B3DPolygon &rCandidate, const B3DPoint &rCenter)
Create/replace normals for given 3d geometry with default normals from given center to outside.
B3DPolyPolygon createSpherePolyPolygonFromB3DRange(const B3DRange &rRange, sal_uInt32 nHorSeg, sal_uInt32 nVerSeg, double fVerStart, double fVerStop, double fHorStart, double fHorStop)
Create a 3D line polyPolygon from a B3DRange which defines a sphere with the given count of hor and v...
void B3DPolyPolygonToUnoPolyPolygonShape3D(const B3DPolyPolygon &rPolyPolygonSource, css::drawing::PolyPolygonShape3D &rPolyPolygonShape3DRetval)
B3DPolyPolygon const & createUnitCubeFillPolyPolygon()
Create a unit 3D fill polyPolygon which defines a cube.
B3DPolyPolygon createUnitSphereFillPolyPolygon(sal_uInt32 nHorSeg, sal_uInt32 nVerSeg, bool bNormals, double fVerStart, double fVerStop, double fHorStart, double fHorStop)
same as createUnitSpherePolyPolygon, but creates filled polygons (closed and oriented) There is one e...
B3DPolyPolygon UnoPolyPolygonShape3DToB3DPolyPolygon(const css::drawing::PolyPolygonShape3D &rPolyPolygonShape3DSource)
converters for css::drawing::PolyPolygonShape3D
B3DPolyPolygon const & createUnitCubePolyPolygon()
Create a unit 3D line polyPolygon which defines a cube.
B3DPolygon invertNormals(const B3DPolygon &rCandidate)
invert normals for given 3d geometry.
B3DPolygon applyDefaultTextureCoordinatesParallel(const B3DPolygon &rCandidate, const B3DRange &rRange, bool bChangeX, bool bChangeY)
Create/replace texture coordinates for given 3d geometry with parallel projected one rRange: the full...
B3DPolyPolygon createUnitSpherePolyPolygon(sal_uInt32 nHorSeg, sal_uInt32 nVerSeg, double fVerStart, double fVerStop, double fHorStart, double fHorStop)
Create a unit 3D line polyPolygon which defines a sphere with the given count of hor and ver segments...
void checkClosed(B2DPolygon &rCandidate)
Check if given polygon is closed.
B2DRange getRange(const B2DPolygon &rCandidate)
Get the range of a polygon.
B2IRange fround(const B2DRange &rRange)
Round double to nearest integer for 2D range.
Definition: b2drange.cxx:64
const sal_uInt8 A
#define C