1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _BGFX_POINT_B3DPOINT_HXX 25 #define _BGFX_POINT_B3DPOINT_HXX 26 27 #include <basegfx/tuple/b3dtuple.hxx> 28 #include <basegfx/basegfxdllapi.h> 29 30 namespace basegfx 31 { 32 // predeclaration 33 class B3DHomMatrix; 34 35 /** Base Point class with three double values 36 37 This class derives all operators and common handling for 38 a 3D data class from B3DTuple. All necessary extensions 39 which are special for points will be added here. 40 41 @see B3DTuple 42 */ 43 class BASEGFX_DLLPUBLIC B3DPoint : public ::basegfx::B3DTuple 44 { 45 public: 46 /** Create a 3D Point 47 48 The point is initialized to (0.0, 0.0, 0.0) 49 */ B3DPoint()50 B3DPoint() 51 : B3DTuple() 52 {} 53 54 /** Create a 3D Point 55 56 @param fX 57 This parameter is used to initialize the X-coordinate 58 of the 3D Point. 59 60 @param fY 61 This parameter is used to initialize the Y-coordinate 62 of the 3D Point. 63 64 @param fZ 65 This parameter is used to initialize the Z-coordinate 66 of the 3D Point. 67 */ B3DPoint(double fX,double fY,double fZ)68 B3DPoint(double fX, double fY, double fZ) 69 : B3DTuple(fX, fY, fZ) 70 {} 71 72 /** Create a copy of a 3D Point 73 74 @param rVec 75 The 3D Point which will be copied. 76 */ B3DPoint(const B3DPoint & rVec)77 B3DPoint(const B3DPoint& rVec) 78 : B3DTuple(rVec) 79 {} 80 81 /** constructor with tuple to allow copy-constructing 82 from B3DTuple-based classes 83 */ B3DPoint(const::basegfx::B3DTuple & rTuple)84 B3DPoint(const ::basegfx::B3DTuple& rTuple) 85 : B3DTuple(rTuple) 86 {} 87 ~B3DPoint()88 ~B3DPoint() 89 {} 90 91 /** *=operator to allow usage from B3DPoint, too 92 */ operator *=(const B3DPoint & rPnt)93 B3DPoint& operator*=( const B3DPoint& rPnt ) 94 { 95 mfX *= rPnt.mfX; 96 mfY *= rPnt.mfY; 97 mfZ *= rPnt.mfZ; 98 return *this; 99 } 100 101 /** *=operator to allow usage from B3DPoint, too 102 */ operator *=(double t)103 B3DPoint& operator*=(double t) 104 { 105 mfX *= t; 106 mfY *= t; 107 mfZ *= t; 108 return *this; 109 } 110 111 /** assignment operator to allow assigning the results 112 of B3DTuple calculations 113 */ operator =(const::basegfx::B3DTuple & rVec)114 B3DPoint& operator=( const ::basegfx::B3DTuple& rVec ) 115 { 116 mfX = rVec.getX(); 117 mfY = rVec.getY(); 118 mfZ = rVec.getZ(); 119 return *this; 120 } 121 122 /** Transform point by given transformation matrix. 123 124 The translational components of the matrix are, in 125 contrast to B3DVector, applied. 126 */ 127 B3DPoint& operator*=( const ::basegfx::B3DHomMatrix& rMat ); 128 getEmptyPoint()129 static const B3DPoint& getEmptyPoint() 130 { 131 return (const B3DPoint&) ::basegfx::B3DTuple::getEmptyTuple(); 132 } 133 }; 134 135 // external operators 136 ////////////////////////////////////////////////////////////////////////// 137 138 /** Transform B3DPoint by given transformation matrix. 139 140 Since this is a Point, translational components of the 141 matrix are used. 142 */ 143 BASEGFX_DLLPUBLIC B3DPoint operator*( const B3DHomMatrix& rMat, const B3DPoint& rPoint ); 144 145 } // end of namespace basegfx 146 147 #endif /* _BGFX_POINT_B3DPOINT_HXX */ 148