Coverage Report

Created: 2025-12-31 10:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/basegfx/point/b3dpoint.hxx
Line
Count
Source
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
20
#pragma once
21
22
#include <basegfx/tuple/b3dtuple.hxx>
23
#include <basegfx/basegfxdllapi.h>
24
25
namespace basegfx
26
{
27
    class B3DHomMatrix;
28
29
    /** Base Point class with three double values
30
31
        This class derives all operators and common handling for
32
        a 3D data class from B3DTuple. All necessary extensions
33
        which are special for points will be added here.
34
35
        @see B3DTuple
36
    */
37
    class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC B3DPoint : public ::basegfx::B3DTuple
38
    {
39
    public:
40
        /** Create a 3D Point
41
42
            The point is initialized to (0.0, 0.0, 0.0)
43
        */
44
        B3DPoint()
45
200k
        {}
46
47
        /** Create a 3D Point
48
49
            @param fX
50
            This parameter is used to initialize the X-coordinate
51
            of the 3D Point.
52
53
            @param fY
54
            This parameter is used to initialize the Y-coordinate
55
            of the 3D Point.
56
57
            @param fZ
58
            This parameter is used to initialize the Z-coordinate
59
            of the 3D Point.
60
        */
61
        B3DPoint(double fX, double fY, double fZ)
62
356k
        :   B3DTuple(fX, fY, fZ)
63
356k
        {}
64
65
        /** constructor with tuple to allow copy-constructing
66
            from B3DTuple-based classes
67
        */
68
        B3DPoint(const ::basegfx::B3DTuple& rTuple)
69
        :   B3DTuple(rTuple)
70
0
        {}
71
72
        /** *=operator to allow usage from B3DPoint, too
73
        */
74
        B3DPoint& operator*=( const B3DPoint& rPnt )
75
0
        {
76
0
            mnX *= rPnt.mnX;
77
0
            mnY *= rPnt.mnY;
78
0
            mnZ *= rPnt.mnZ;
79
0
            return *this;
80
0
        }
81
82
        /** *=operator to allow usage from B3DPoint, too
83
        */
84
        B3DPoint& operator*=(double t)
85
0
        {
86
0
            mnX *= t;
87
0
            mnY *= t;
88
0
            mnZ *= t;
89
0
            return *this;
90
0
        }
91
92
        /** assignment operator to allow assigning the results
93
            of B3DTuple calculations
94
        */
95
        B3DPoint& operator=( const ::basegfx::B3DTuple& rVec )
96
6.88k
        {
97
6.88k
            mnX = rVec.getX();
98
6.88k
            mnY = rVec.getY();
99
6.88k
            mnZ = rVec.getZ();
100
6.88k
            return *this;
101
6.88k
        }
102
103
        /** Transform point by given transformation matrix.
104
105
            The translational components of the matrix are, in
106
            contrast to B3DVector, applied.
107
        */
108
        B3DPoint& operator*=( const ::basegfx::B3DHomMatrix& rMat );
109
    };
110
111
    // external operators
112
113
114
    /** Transform B3DPoint by given transformation matrix.
115
116
        Since this is a Point, translational components of the
117
        matrix are used.
118
    */
119
    BASEGFX_DLLPUBLIC B3DPoint operator*( const B3DHomMatrix& rMat, const B3DPoint& rPoint );
120
121
} // end of namespace basegfx
122
123
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */