48 if(!rSliceVector.empty())
54 const bool bCreateNormals(css::drawing::NormalsKind_SPECIFIC == eNormalsKind);
55 const bool bCreateTextureCoordinatesX(css::drawing::TextureProjectionMode_OBJECTSPECIFIC ==
getSdr3DObjectAttribute().getTextureProjectionX());
56 const bool bCreateTextureCoordinatesY(css::drawing::TextureProjectionMode_OBJECTSPECIFIC ==
getSdr3DObjectAttribute().getTextureProjectionY());
59 if(!
getSdrLFSAttribute().getFill().isDefault() && (bCreateTextureCoordinatesX || bCreateTextureCoordinatesY))
64 const double fSqrtFrontArea(sqrt(fFrontArea));
66 fRelativeTextureWidth = std::trunc(fRelativeTextureWidth - 0.5);
68 if(fRelativeTextureWidth < 1.0)
70 fRelativeTextureWidth = 1.0;
74 aTexTransform.
scale(-1.0, -1.0);
76 aTexTransform.
scale(fRelativeTextureWidth, 1.0);
80 std::vector< basegfx::B3DPolyPolygon > aFill;
83 0.5, 0.6, bCreateTextureCoordinatesX || bCreateTextureCoordinatesY, aTexTransform);
91 if(css::drawing::NormalsKind_SPHERE == eNormalsKind)
95 else if(css::drawing::NormalsKind_FLAT == eNormalsKind)
153 const sal_uInt32 nReducedCount(aReducedLoops.
count());
159 for(sal_uInt32 b(0); bAdd && b < nReducedCount; b++)
170 aReducedLoops.
append(aCandidate);
175 const sal_uInt32 nReducedCount(aReducedLoops.
count());
177 if(nReducedCount > 1)
179 for(sal_uInt32 b(1); b < nReducedCount; b++)
196 aNewLineGeometry.
append(aReducedLoops);
215 for(sal_uInt32 c(0); c < nPolyCount; c++)
218 const sal_uInt32 nPointCount(aCandidate.
count());
222 sal_uInt32 nIndexA(nPointCount);
223 sal_uInt32 nIndexB(nPointCount);
224 sal_uInt32 nIndexC(nPointCount);
226 for(sal_uInt32
d(0);
d < nPointCount;
d++)
228 const sal_uInt32 nPrevInd((
d + nPointCount - 1) % nPointCount);
229 const sal_uInt32 nNextInd((
d + 1) % nPointCount);
233 const double fAngle(aPrev.
angle(aNext));
238 if(M_PI - fabs(fAngle) > M_PI * 0.1)
240 if(nPointCount == nIndexA)
244 else if(nPointCount == nIndexB)
248 else if(nPointCount == nIndexC)
256 const bool bIndexAUsed(nIndexA != nPointCount);
257 const bool bIndexBUsed(nIndexB != nPointCount);
258 bool bIndexCUsed(nIndexC != nPointCount);
265 else if(bIndexAUsed && bIndexBUsed)
269 if(((nIndexA + 2) % nPointCount) == nIndexB)
271 nIndexC = (nIndexA + 1) % nPointCount;
273 else if(((nIndexA + nPointCount - 2) % nPointCount) == nIndexB)
275 nIndexC = (nIndexA + nPointCount - 1) % nPointCount;
278 bIndexCUsed = (nIndexC != nPointCount);
288 aToBeAdded.
append(aStart);
290 aNewLineGeometry.
append(aToBeAdded);
300 aToBeAdded.
append(aStart);
302 aNewLineGeometry.
append(aToBeAdded);
312 aToBeAdded.
append(aStart);
314 aNewLineGeometry.
append(aToBeAdded);
320 aNewLineGeometry.
append(aReducedLoops);
322 if(aNewLineGeometry.
count())
338 aRetval.
append(aHorLines);
343 aRetval.
append(aVerLines);
379 std::unique_lock aGuard(
m_aMutex );
401 :
SdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute),
404 mfDiagonal(fDiagonal),
405 mfBackScale(fBackScale),
406 mbSmoothNormals(bSmoothNormals),
407 mbSmoothLids(bSmoothLids),
408 mbCharacterMode(bCharacterMode),
409 mbCloseFront(bCloseFront),
410 mbCloseBack(bCloseBack)
447 if(SdrPrimitive3D::operator==(rPrimitive))
484 std::unique_lock aGuard(
m_aMutex );
void translate(double fX, double fY)
void scale(double fX, double fY)
B2DPolygon const & getB2DPolygon(sal_uInt32 nIndex) const
void removeDoublePoints()
basegfx::B2DPoint const & getB2DPoint(sal_uInt32 nIndex) const
double angle(const B2DVector &rVec) const
void append(const B3DPolygon &rPolygon, sal_uInt32 nCount=1)
B3DPolygon const & getB3DPolygon(sal_uInt32 nIndex) const
void append(const B3DPoint &rPoint, sal_uInt32 nCount=1)
void setBuffered3DDecomposition(const Primitive3DContainer &rNew)
const Primitive3DContainer & getBuffered3DDecomposition() const
access methods to maBuffered3DDecomposition.
virtual Primitive3DContainer get3DDecomposition(const geometry::ViewInformation3D &rViewInformation) const override
The getDecomposition default implementation will on demand use create3DDecomposition() if maBuffered3...
void append(const Primitive3DContainer &rSource)
SdrExtrudePrimitive3D class.
bool getSmoothLids() const
SdrExtrudePrimitive3D(const basegfx::B3DHomMatrix &rTransform, const basegfx::B2DVector &rTextureSize, const attribute::SdrLineFillShadowAttribute3D &rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute &rSdr3DObjectAttribute, basegfx::B2DPolyPolygon aPolyPolygon, double fDepth, double fDiagonal, double fBackScale, bool bSmoothNormals, bool bSmoothLids, bool bCharacterMode, bool bCloseFront, bool bCloseBack)
constructor
bool getSmoothNormals() const
virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D &rViewInformation) const override
get range
const Slice3DVector & getSlices() const
get (evtl. create) slices
virtual bool operator==(const BasePrimitive3D &rPrimitive) const override
compare operator
const basegfx::B2DPolyPolygon & getPolyPolygon() const
data read access
double getBackScale() const
virtual Primitive3DContainer get3DDecomposition(const geometry::ViewInformation3D &rViewInformation) const override
Overridden to allow for reduced line mode to decide if to buffer decomposition or not.
double getDiagonal() const
virtual ~SdrExtrudePrimitive3D() override
bool getCloseFront() const
virtual Primitive3DContainer create3DDecomposition(const geometry::ViewInformation3D &rViewInformation) const override
local decomposition.
std::optional< geometry::ViewInformation3D > mpLastRLGViewInformation
decomposition data when ReducedLineGeometry is used, see get3DDecomposition
bool getCharacterMode() const
basegfx::B2DPolyPolygon maCorrectedPolyPolygon
geometry helper for slices
bool getCloseBack() const
void impCreateSlices()
create slices
const basegfx::B3DHomMatrix & getTransform() const
data read access
basegfx::B3DRange get3DRangeFromSlices(const Slice3DVector &rSlices) const
implementation for primitive3D which will use given Slice3Ds and expand by evtl.
const basegfx::B2DVector & getTextureSize() const
const attribute::Sdr3DObjectAttribute & getSdr3DObjectAttribute() const
const attribute::SdrLineFillShadowAttribute3D & getSdrLFSAttribute() const
#define PRIMITIVE3D_ID_SDREXTRUDEPRIMITIVE3D
double getArea(const B2DPolygon &rCandidate)
double getLength(const B2DPolygon &rCandidate)
B2DPolyPolygon correctOutmostPolygon(const B2DPolyPolygon &rCandidate)
B2DPolygon adaptiveSubdivideByAngle(const B2DPolygon &rCandidate, double fAngleBound)
B2DPolyPolygon correctOrientations(const B2DPolyPolygon &rCandidate)
void applyNormalsInvertTo3DGeometry(std::vector< basegfx::B3DPolyPolygon > &rFill)
ImplPrimitive3DIDBlock(PolygonHairlinePrimitive3D, PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D) Primitive3DContainer PolygonStrokePrimitive3D
Primitive3DContainer create3DPolyPolygonFillPrimitives(const std::vector< basegfx::B3DPolyPolygon > &r3DPolyPolygonVector, const basegfx::B3DHomMatrix &rObjectTransform, const basegfx::B2DVector &rTextureSize, const attribute::Sdr3DObjectAttribute &aSdr3DObjectAttribute, const attribute::SdrFillAttribute &rFill, const attribute::FillGradientAttribute &rFillGradient)
basegfx::B3DPolyPolygon extractHorizontalLinesFromSlice(const Slice3DVector &rSliceVector, bool bCloseHorLines)
helpers for geometry extraction
Primitive3DContainer createHiddenGeometryPrimitives3D(const std::vector< basegfx::B3DPolyPolygon > &r3DPolyPolygonVector, const basegfx::B3DHomMatrix &rObjectTransform, const basegfx::B2DVector &rTextureSize, const attribute::Sdr3DObjectAttribute &aSdr3DObjectAttribute)
void applyNormalsKindSphereTo3DGeometry(std::vector< basegfx::B3DPolyPolygon > &rFill, const basegfx::B3DRange &rRange)
basegfx::B3DRange getRangeFrom3DGeometry(std::vector< basegfx::B3DPolyPolygon > &rFill)
void extractPlanesFromSlice(std::vector< basegfx::B3DPolyPolygon > &rFill, const Slice3DVector &rSliceVector, bool bCreateNormals, bool bSmoothNormals, bool bSmoothLids, bool bClosed, double fSmoothNormalsMix, double fSmoothLidsMix, bool bCreateTextureCoordinates, const basegfx::B2DHomMatrix &rTexTransform)
void createExtrudeSlices(Slice3DVector &rSliceVector, const basegfx::B2DPolyPolygon &rSource, double fBackScale, double fDiagonal, double fDepth, bool bCharacterMode, bool bCloseFront, bool bCloseBack)
void applyTextureTo3DGeometry(css::drawing::TextureProjectionMode eModeX, css::drawing::TextureProjectionMode eModeY, std::vector< basegfx::B3DPolyPolygon > &rFill, const basegfx::B3DRange &rRange, const basegfx::B2DVector &rTextureSize)
void applyNormalsKindFlatTo3DGeometry(std::vector< basegfx::B3DPolyPolygon > &rFill)
::std::vector< Slice3D > Slice3DVector
typedef for a group of Slice3Ds
Primitive3DContainer createShadowPrimitive3D(const Primitive3DContainer &rSource, const attribute::SdrShadowAttribute &rShadow, bool bShadow3D)
void createReducedOutlines(const geometry::ViewInformation3D &rViewInformation, const basegfx::B3DHomMatrix &rObjectTransform, const basegfx::B3DPolygon &rLoopA, const basegfx::B3DPolygon &rLoopB, basegfx::B3DPolyPolygon &rTarget)
basegfx::B3DPolyPolygon extractVerticalLinesFromSlice(const Slice3DVector &rSliceVector)
Primitive3DContainer create3DPolyPolygonLinePrimitives(const basegfx::B3DPolyPolygon &rUnitPolyPolygon, const basegfx::B3DHomMatrix &rObjectTransform, const attribute::SdrLineAttribute &rLine)