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 29 namespace basegfx 30 { 31 // predeclaration 32 class B3DHomMatrix; 33 34 /** Base Point class with three double values 35 36 This class derives all operators and common handling for 37 a 3D data class from B3DTuple. All necessary extensions 38 which are special for points will be added here. 39 40 @see B3DTuple 41 */ 42 class B3DPoint : public ::basegfx::B3DTuple 43 { 44 public: 45 /** Create a 3D Point 46 47 The point is initialized to (0.0, 0.0, 0.0) 48 */ B3DPoint()49 B3DPoint() 50 : B3DTuple() 51 {} 52 53 /** Create a 3D Point 54 55 @param fX 56 This parameter is used to initialize the X-coordinate 57 of the 3D Point. 58 59 @param fY 60 This parameter is used to initialize the Y-coordinate 61 of the 3D Point. 62 63 @param fZ 64 This parameter is used to initialize the Z-coordinate 65 of the 3D Point. 66 */ B3DPoint(double fX,double fY,double fZ)67 B3DPoint(double fX, double fY, double fZ) 68 : B3DTuple(fX, fY, fZ) 69 {} 70 71 /** Create a copy of a 3D Point 72 73 @param rVec 74 The 3D Point which will be copied. 75 */ B3DPoint(const B3DPoint & rVec)76 B3DPoint(const B3DPoint& rVec) 77 : B3DTuple(rVec) 78 {} 79 80 /** constructor with tuple to allow copy-constructing 81 from B3DTuple-based classes 82 */ B3DPoint(const::basegfx::B3DTuple & rTuple)83 B3DPoint(const ::basegfx::B3DTuple& rTuple) 84 : B3DTuple(rTuple) 85 {} 86 ~B3DPoint()87 ~B3DPoint() 88 {} 89 90 /** *=operator to allow usage from B3DPoint, too 91 */ operator *=(const B3DPoint & rPnt)92 B3DPoint& operator*=( const B3DPoint& rPnt ) 93 { 94 mfX *= rPnt.mfX; 95 mfY *= rPnt.mfY; 96 mfZ *= rPnt.mfZ; 97 return *this; 98 } 99 100 /** *=operator to allow usage from B3DPoint, too 101 */ operator *=(double t)102 B3DPoint& operator*=(double t) 103 { 104 mfX *= t; 105 mfY *= t; 106 mfZ *= t; 107 return *this; 108 } 109 110 /** assignment operator to allow assigning the results 111 of B3DTuple calculations 112 */ operator =(const::basegfx::B3DTuple & rVec)113 B3DPoint& operator=( const ::basegfx::B3DTuple& rVec ) 114 { 115 mfX = rVec.getX(); 116 mfY = rVec.getY(); 117 mfZ = rVec.getZ(); 118 return *this; 119 } 120 121 /** Transform point by given transformation matrix. 122 123 The translational components of the matrix are, in 124 contrast to B3DVector, applied. 125 */ 126 B3DPoint& operator*=( const ::basegfx::B3DHomMatrix& rMat ); 127 getEmptyPoint()128 static const B3DPoint& getEmptyPoint() 129 { 130 return (const B3DPoint&) ::basegfx::B3DTuple::getEmptyTuple(); 131 } 132 }; 133 134 // external operators 135 ////////////////////////////////////////////////////////////////////////// 136 137 /** Transform B3DPoint by given transformation matrix. 138 139 Since this is a Point, translational components of the 140 matrix are used. 141 */ 142 B3DPoint operator*( const B3DHomMatrix& rMat, const B3DPoint& rPoint ); 143 144 } // end of namespace basegfx 145 146 #endif /* _BGFX_POINT_B3DPOINT_HXX */ 147