20#include <osl/diagnose.h>
60 bool operator==(
const CoordinateData3D& rData)
const
62 return (
maPoint == rData.getCoordinate());
71class CoordinateDataArray3D
73 typedef std::vector< CoordinateData3D > CoordinateData3DVector;
75 CoordinateData3DVector maVector;
78 explicit CoordinateDataArray3D(sal_uInt32 nCount)
83 CoordinateDataArray3D(
const CoordinateDataArray3D& rOriginal, sal_uInt32 nIndex, sal_uInt32 nCount)
91 const sal_uInt32 nPointCount(maVector.size());
95 sal_uInt32 nISmallest(0);
103 for(a = 1;
a < nPointCount;
a++)
107 if((rCandidate.
getX() < pSmallest->getX())
108 || (rCandidate.
getX() == pSmallest->getX() && rCandidate.
getY() < pSmallest->getY())
109 || (rCandidate.
getX() == pSmallest->getX() && rCandidate.
getY() == pSmallest->getY() && rCandidate.
getZ() < pSmallest->getZ()))
112 pSmallest = &rCandidate;
117 for(a = (nISmallest + 1) % nPointCount;
a != nISmallest;
a = (
a + 1) % nPointCount)
121 if(!rCandidate.
equal(*pSmallest))
129 for(a = (nISmallest + nPointCount - 1) % nPointCount;
a != nISmallest;
a = (
a + nPointCount - 1) % nPointCount)
133 if(!rCandidate.
equal(*pSmallest))
147 aRetval =
cross(aPrev, aNext);
155 sal_uInt32
count()
const
157 return maVector.size();
160 bool operator==(
const CoordinateDataArray3D& rCandidate)
const
162 return (maVector == rCandidate.maVector);
167 return maVector[
nIndex].getCoordinate();
172 maVector[
nIndex].setCoordinate(rValue);
175 void insert(sal_uInt32 nIndex,
const CoordinateData3D& rValue, sal_uInt32 nCount)
180 CoordinateData3DVector::iterator
aIndex(maVector.begin());
182 maVector.insert(aIndex, nCount, rValue);
186 void insert(sal_uInt32 nIndex,
const CoordinateDataArray3D& rSource)
188 const sal_uInt32
nCount(rSource.maVector.size());
193 CoordinateData3DVector::iterator
aIndex(maVector.begin());
195 CoordinateData3DVector::const_iterator aStart(rSource.maVector.begin());
196 CoordinateData3DVector::const_iterator aEnd(rSource.maVector.end());
197 maVector.insert(aIndex, aStart, aEnd);
201 void remove(sal_uInt32 nIndex, sal_uInt32 nCount)
206 CoordinateData3DVector::iterator aStart(maVector.begin());
208 const CoordinateData3DVector::iterator aEnd(aStart + nCount);
209 maVector.erase(aStart, aEnd);
215 if(maVector.size() <= 1)
218 const sal_uInt32 nHalfSize(maVector.size() >> 1);
219 CoordinateData3DVector::iterator aStart(maVector.begin());
220 CoordinateData3DVector::iterator aEnd(maVector.end() - 1);
222 for(sal_uInt32
a(0);
a < nHalfSize;
a++)
224 std::swap(*aStart, *aEnd);
230 void transform(const ::basegfx::B3DHomMatrix& rMatrix)
232 for (
auto & elem : maVector)
234 elem.transform(rMatrix);
241 typedef std::vector< ::basegfx::BColor > BColorDataVector;
243 BColorDataVector maVector;
244 sal_uInt32 mnUsedEntries;
247 explicit BColorArray(sal_uInt32 nCount)
253 BColorArray(
const BColorArray& rOriginal, sal_uInt32 nIndex, sal_uInt32 nCount)
256 BColorDataVector::const_iterator aStart(rOriginal.maVector.begin());
258 BColorDataVector::const_iterator aEnd(aStart);
259 assert(nCount <= rOriginal.maVector.size());
261 maVector.reserve(nCount);
263 for(; aStart != aEnd; ++aStart)
265 if(!aStart->equalZero())
268 maVector.push_back(*aStart);
272 bool operator==(
const BColorArray& rCandidate)
const
274 return (maVector == rCandidate.maVector);
279 return (mnUsedEntries != 0);
282 const ::basegfx::BColor& getBColor(sal_uInt32 nIndex)
const
287 void setBColor(sal_uInt32 nIndex, const ::basegfx::BColor& rValue)
289 bool bWasUsed(mnUsedEntries && !maVector[nIndex].
equalZero());
290 bool bIsUsed(!rValue.equalZero());
296 maVector[
nIndex] = rValue;
308 maVector[
nIndex] = rValue;
314 void insert(sal_uInt32 nIndex, const ::basegfx::BColor& rValue, sal_uInt32 nCount)
319 BColorDataVector::iterator
aIndex(maVector.begin());
321 maVector.insert(aIndex, nCount, rValue);
323 if(!rValue.equalZero())
328 void insert(sal_uInt32 nIndex,
const BColorArray& rSource)
330 const sal_uInt32
nCount(rSource.maVector.size());
335 BColorDataVector::iterator
aIndex(maVector.begin());
337 BColorDataVector::const_iterator aStart(rSource.maVector.begin());
338 BColorDataVector::const_iterator aEnd(rSource.maVector.end());
339 maVector.insert(aIndex, aStart, aEnd);
341 mnUsedEntries += std::count_if(aStart, aEnd,
342 [](BColorDataVector::const_reference rData) {
return !rData.equalZero(); });
346 void remove(sal_uInt32 nIndex, sal_uInt32 nCount)
350 const BColorDataVector::iterator aDeleteStart(maVector.begin() + nIndex);
351 const BColorDataVector::iterator aDeleteEnd(aDeleteStart + nCount);
353 auto nDeleteUsed = std::count_if(aDeleteStart, aDeleteEnd,
354 [](BColorDataVector::const_reference rData) {
return !rData.equalZero(); });
355 mnUsedEntries -= std::min(mnUsedEntries,
static_cast<sal_uInt32
>(nDeleteUsed));
358 maVector.erase(aDeleteStart, aDeleteEnd);
364 if(maVector.size() <= 1)
367 const sal_uInt32 nHalfSize(maVector.size() >> 1);
368 BColorDataVector::iterator aStart(maVector.begin());
369 BColorDataVector::iterator aEnd(maVector.end() - 1);
371 for(sal_uInt32
a(0);
a < nHalfSize;
a++)
373 std::swap(*aStart, *aEnd);
382 typedef std::vector< ::basegfx::B3DVector > NormalsData3DVector;
384 NormalsData3DVector maVector;
385 sal_uInt32 mnUsedEntries;
388 explicit NormalsArray3D(sal_uInt32 nCount)
394 NormalsArray3D(
const NormalsArray3D& rOriginal, sal_uInt32 nIndex, sal_uInt32 nCount)
397 NormalsData3DVector::const_iterator aStart(rOriginal.maVector.begin());
399 NormalsData3DVector::const_iterator aEnd(aStart);
401 maVector.reserve(nCount);
403 for(; aStart != aEnd; ++aStart)
405 if(!aStart->equalZero())
408 maVector.push_back(*aStart);
412 bool operator==(
const NormalsArray3D& rCandidate)
const
414 return (maVector == rCandidate.maVector);
419 return (mnUsedEntries != 0);
422 const ::basegfx::B3DVector& getNormal(sal_uInt32 nIndex)
const
427 void setNormal(sal_uInt32 nIndex, const ::basegfx::B3DVector& rValue)
429 bool bWasUsed(mnUsedEntries && !maVector[nIndex].
equalZero());
430 bool bIsUsed(!rValue.equalZero());
436 maVector[
nIndex] = rValue;
448 maVector[
nIndex] = rValue;
454 void insert(sal_uInt32 nIndex, const ::basegfx::B3DVector& rValue, sal_uInt32 nCount)
459 NormalsData3DVector::iterator
aIndex(maVector.begin());
461 maVector.insert(aIndex, nCount, rValue);
463 if(!rValue.equalZero())
468 void insert(sal_uInt32 nIndex,
const NormalsArray3D& rSource)
470 const sal_uInt32
nCount(rSource.maVector.size());
475 NormalsData3DVector::iterator
aIndex(maVector.begin());
477 NormalsData3DVector::const_iterator aStart(rSource.maVector.begin());
478 NormalsData3DVector::const_iterator aEnd(rSource.maVector.end());
479 maVector.insert(aIndex, aStart, aEnd);
481 mnUsedEntries += std::count_if(aStart, aEnd,
482 [](NormalsData3DVector::const_reference rData) {
return !rData.equalZero(); });
486 void remove(sal_uInt32 nIndex, sal_uInt32 nCount)
490 const NormalsData3DVector::iterator aDeleteStart(maVector.begin() + nIndex);
491 const NormalsData3DVector::iterator aDeleteEnd(aDeleteStart + nCount);
493 auto nDeleteUsed = std::count_if(aDeleteStart, aDeleteEnd,
494 [](NormalsData3DVector::const_reference rData) {
return !rData.equalZero(); });
495 mnUsedEntries -= std::min(mnUsedEntries,
static_cast<sal_uInt32
>(nDeleteUsed));
498 maVector.erase(aDeleteStart, aDeleteEnd);
504 if(maVector.size() <= 1)
507 const sal_uInt32 nHalfSize(maVector.size() >> 1);
508 NormalsData3DVector::iterator aStart(maVector.begin());
509 NormalsData3DVector::iterator aEnd(maVector.end() - 1);
511 for(sal_uInt32
a(0);
a < nHalfSize;
a++)
513 std::swap(*aStart, *aEnd);
521 for (
auto & elem : maVector)
528class TextureCoordinate2D
530 typedef std::vector< ::basegfx::B2DPoint > TextureData2DVector;
532 TextureData2DVector maVector;
533 sal_uInt32 mnUsedEntries;
536 explicit TextureCoordinate2D(sal_uInt32 nCount)
542 TextureCoordinate2D(
const TextureCoordinate2D& rOriginal, sal_uInt32 nIndex, sal_uInt32 nCount)
545 TextureData2DVector::const_iterator aStart(rOriginal.maVector.begin());
547 TextureData2DVector::const_iterator aEnd(aStart);
549 maVector.reserve(nCount);
551 for(; aStart != aEnd; ++aStart)
553 if(!aStart->equalZero())
556 maVector.push_back(*aStart);
560 bool operator==(
const TextureCoordinate2D& rCandidate)
const
562 return (maVector == rCandidate.maVector);
567 return (mnUsedEntries != 0);
570 const ::basegfx::B2DPoint& getTextureCoordinate(sal_uInt32 nIndex)
const
575 void setTextureCoordinate(sal_uInt32 nIndex, const ::basegfx::B2DPoint& rValue)
577 bool bWasUsed(mnUsedEntries && !maVector[nIndex].
equalZero());
578 bool bIsUsed(!rValue.equalZero());
584 maVector[
nIndex] = rValue;
596 maVector[
nIndex] = rValue;
602 void insert(sal_uInt32 nIndex, const ::basegfx::B2DPoint& rValue, sal_uInt32 nCount)
607 TextureData2DVector::iterator
aIndex(maVector.begin());
609 maVector.insert(aIndex, nCount, rValue);
611 if(!rValue.equalZero())
616 void insert(sal_uInt32 nIndex,
const TextureCoordinate2D& rSource)
618 const sal_uInt32
nCount(rSource.maVector.size());
623 TextureData2DVector::iterator
aIndex(maVector.begin());
625 TextureData2DVector::const_iterator aStart(rSource.maVector.begin());
626 TextureData2DVector::const_iterator aEnd(rSource.maVector.end());
627 maVector.insert(aIndex, aStart, aEnd);
629 mnUsedEntries += std::count_if(aStart, aEnd,
630 [](TextureData2DVector::const_reference rData) {
return !rData.equalZero(); });
634 void remove(sal_uInt32 nIndex, sal_uInt32 nCount)
638 const TextureData2DVector::iterator aDeleteStart(maVector.begin() + nIndex);
639 const TextureData2DVector::iterator aDeleteEnd(aDeleteStart + nCount);
641 auto nDeleteUsed = std::count_if(aDeleteStart, aDeleteEnd,
642 [](TextureData2DVector::const_reference rData) {
return !rData.equalZero(); });
643 mnUsedEntries -= std::min(mnUsedEntries,
static_cast<sal_uInt32
>(nDeleteUsed));
646 maVector.erase(aDeleteStart, aDeleteEnd);
652 if(maVector.size() <= 1)
655 const sal_uInt32 nHalfSize(maVector.size() >> 1);
656 TextureData2DVector::iterator aStart(maVector.begin());
657 TextureData2DVector::iterator aEnd(maVector.end() - 1);
659 for(sal_uInt32
a(0);
a < nHalfSize;
a++)
661 std::swap(*aStart, *aEnd);
667 void transform(const ::basegfx::B2DHomMatrix& rMatrix)
669 for (
auto & elem : maVector)
807 bool bBColorsAreEqual(
true);
826 bBColorsAreEqual = !rCandidate.
mpBColors->isUsed();
830 return bBColorsAreEqual;
835 bool bNormalsAreEqual(
true);
854 bNormalsAreEqual = !rCandidate.
mpNormals->isUsed();
858 return bNormalsAreEqual;
863 bool bTextureCoordinatesAreEqual(
true);
886 return bTextureCoordinatesAreEqual;
911 const ::basegfx::B3DPoint&
getPoint(sal_uInt32 nIndex)
const
916 void setPoint(sal_uInt32 nIndex, const ::basegfx::B3DPoint& rValue)
922 void insert(sal_uInt32 nIndex, const ::basegfx::B3DPoint& rPoint, sal_uInt32 nCount)
927 CoordinateData3D aCoordinate(rPoint);
947 const ::basegfx::BColor&
getBColor(sal_uInt32 nIndex)
const
955 return ::basegfx::BColor::getEmptyBColor();
959 void setBColor(sal_uInt32 nIndex, const ::basegfx::BColor& rValue)
963 if(!rValue.equalZero())
1001 const ::basegfx::B3DVector&
getNormal(sal_uInt32 nIndex)
const
1009 return ::basegfx::B3DVector::getEmptyVector();
1013 void setNormal(sal_uInt32 nIndex, const ::basegfx::B3DVector& rValue)
1017 if(!rValue.equalZero())
1060 return ::basegfx::B2DPoint::getEmptyPoint();
1068 if(!rValue.equalZero())
1165 void remove(sal_uInt32 nIndex, sal_uInt32 nCount)
1252 if(bTextureCoordinatesEqual)
1262 for(sal_uInt32
a(0);
a <
maPoints.count() - 1;
a++)
1276 if(bTextureCoordinatesEqual)
1337 const sal_uInt32 nNextIndex(
nIndex + 1);
1394 mpPolygon(getDefaultPolygon())
1418 return !(*
this == rPolygon);
1428 OSL_ENSURE(nIndex < mpPolygon->
count(),
"B3DPolygon access outside range (!)");
1443 OSL_ENSURE(nIndex < mpPolygon->
count(),
"B3DPolygon access outside range (!)");
1474 OSL_ENSURE(nIndex < mpPolygon->
count(),
"B3DPolygon access outside range (!)");
1506 OSL_ENSURE(nIndex < mpPolygon->
count(),
"B3DPolygon access outside range (!)");
1522 mpPolygon->transformTextureCoordinates(rMatrix);
1527 return mpPolygon->areTextureCoordinatesUsed();
1558 OSL_ENSURE(
nIndex + nCount <= rPoly.mpPolygon->
count(),
"B3DPolygon Append outside range (!)");
1603 mpPolygon->removeDoublePointsAtBeginEnd();
1604 mpPolygon->removeDoublePointsWholeTrack();
bool impBColorsAreEqual(const ImplB3DPolygon &rCandidate) const
void insert(sal_uInt32 nIndex, const ::basegfx::B3DPoint &rPoint, sal_uInt32 nCount)
void remove(sal_uInt32 nIndex, sal_uInt32 nCount)
const ::basegfx::B2DPoint & getTextureCoordinate(sal_uInt32 nIndex) const
void clearTextureCoordinates()
void removeDoublePointsWholeTrack()
bool impNormalsAreEqual(const ImplB3DPolygon &rCandidate) const
bool areNormalsUsed() const
const ::basegfx::B3DVector & getNormal() const
bool impTextureCoordinatesAreEqual(const ImplB3DPolygon &rCandidate) const
::basegfx::B3DVector maPlaneNormal
void setNormal(sal_uInt32 nIndex, const ::basegfx::B3DVector &rValue)
std::unique_ptr< BColorArray > mpBColors
bool operator==(const ImplB3DPolygon &rCandidate) const
const ::basegfx::B3DPoint & getPoint(sal_uInt32 nIndex) const
void setBColor(sal_uInt32 nIndex, const ::basegfx::BColor &rValue)
bool areBColorsUsed() const
void transformNormals(const ::basegfx::B3DHomMatrix &rMatrix)
std::unique_ptr< NormalsArray3D > mpNormals
std::unique_ptr< TextureCoordinate2D > mpTextureCoordinates
void transform(const ::basegfx::B3DHomMatrix &rMatrix)
CoordinateDataArray3D maPoints
void removeDoublePointsAtBeginEnd()
void insert(sal_uInt32 nIndex, const ImplB3DPolygon &rSource)
ImplB3DPolygon(const ImplB3DPolygon &rToBeCopied)
void transformTextureCoordinates(const ::basegfx::B2DHomMatrix &rMatrix)
const ::basegfx::BColor & getBColor(sal_uInt32 nIndex) const
void setClosed(bool bNew)
void invalidatePlaneNormal()
bool areTextureCoordinatesUsed() const
bool hasDoublePoints() const
void setTextureCoordinate(sal_uInt32 nIndex, const ::basegfx::B2DPoint &rValue)
const ::basegfx::B3DVector & getNormal(sal_uInt32 nIndex) const
void setPoint(sal_uInt32 nIndex, const ::basegfx::B3DPoint &rValue)
ImplB3DPolygon(const ImplB3DPolygon &rToBeCopied, sal_uInt32 nIndex, sal_uInt32 nCount)
Base Point class with two double values.
static const B2DPoint & getEmptyPoint()
Base Point class with three double values.
void remove(sal_uInt32 nIndex, sal_uInt32 nCount=1)
B3DPolygon & operator=(const B3DPolygon &rPolygon)
BColor const & getBColor(sal_uInt32 nIndex) const
bool areBColorsUsed() const
void append(const B3DPoint &rPoint, sal_uInt32 nCount=1)
void setB3DPoint(sal_uInt32 nIndex, const B3DPoint &rValue)
void setTextureCoordinate(sal_uInt32 nIndex, const B2DPoint &rValue)
B3DPoint const & getB3DPoint(sal_uInt32 nIndex) const
void transformNormals(const B3DHomMatrix &rMatrix)
bool areNormalsUsed() const
bool operator!=(const B3DPolygon &rPolygon) const
void setNormal(sal_uInt32 nIndex, const B3DVector &rValue)
B3DVector const & getNormal() const
bool areTextureCoordinatesUsed() const
void clearTextureCoordinates()
o3tl::cow_wrapper< ImplB3DPolygon, o3tl::ThreadSafeRefCountingPolicy > ImplType
void setClosed(bool bNew)
void transformTextureCoordinates(const B2DHomMatrix &rMatrix)
bool operator==(const B3DPolygon &rPolygon) const
void transform(const B3DHomMatrix &rMatrix)
bool hasDoublePoints() const
void removeDoublePoints()
void setBColor(sal_uInt32 nIndex, const BColor &rValue)
B2DPoint const & getTextureCoordinate(sal_uInt32 nIndex) const
bool equal(const B3DTuple &rTup) const
Base Point class with three double values.
B3DVector & normalize()
Normalize this 3D Vector.
static const B3DVector & getEmptyVector()
Base Color class with three double values.
static const BColor & getEmptyBColor()
TYPE getX() const
Get X-Coordinate of 3D Tuple.
TYPE getZ() const
Get Z-Coordinate of 3D Tuple.
TYPE getY() const
Get Y-Coordinate of 3D Tuple.
bool same_object(const cow_wrapper &rOther) const
std::deque< AttacherIndex_Impl > aIndex
B3DVector cross(const B3DVector &rVecA, const B3DVector &rVecB)
Calculate the Cross Product of two 3D Vectors.
OUStringBuffer & remove(OUStringBuffer &rIn, sal_Unicode c)
enumrange< T >::Iterator begin(enumrange< T >)
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)