OLD | NEW |
1 /* | 1 /* |
2 Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org> | 2 Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org> |
3 2004, 2005 Rob Buis <buis@kde.org> | 3 2004, 2005 Rob Buis <buis@kde.org> |
4 2005 Eric Seidel <eric@webkit.org> | 4 2005 Eric Seidel <eric@webkit.org> |
5 2010 Zoltan Herczeg <zherczeg@webkit.org> | 5 2010 Zoltan Herczeg <zherczeg@webkit.org> |
6 | 6 |
7 This library is free software; you can redistribute it and/or | 7 This library is free software; you can redistribute it and/or |
8 modify it under the terms of the GNU Library General Public | 8 modify it under the terms of the GNU Library General Public |
9 License as published by the Free Software Foundation; either | 9 License as published by the Free Software Foundation; either |
10 version 2 of the License, or (at your option) any later version. | 10 version 2 of the License, or (at your option) any later version. |
11 | 11 |
12 This library is distributed in the hope that it will be useful, | 12 This library is distributed in the hope that it will be useful, |
13 but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 Library General Public License for more details. | 15 Library General Public License for more details. |
16 | 16 |
17 You should have received a copy of the GNU Library General Public License | 17 You should have received a copy of the GNU Library General Public License |
18 aint with this library; see the file COPYING.LIB. If not, write to | 18 aint with this library; see the file COPYING.LIB. If not, write to |
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 Boston, MA 02110-1301, USA. | 20 Boston, MA 02110-1301, USA. |
21 */ | 21 */ |
22 | 22 |
23 #ifndef FloatPoint3D_h | 23 #ifndef FloatPoint3D_h |
24 #define FloatPoint3D_h | 24 #define FloatPoint3D_h |
25 | 25 |
26 #include "platform/geometry/FloatPoint.h" | 26 #include "platform/geometry/FloatPoint.h" |
| 27 #include "third_party/skia/include/core/SkPoint3.h" |
27 | 28 |
28 namespace blink { | 29 namespace blink { |
29 | 30 |
30 class PLATFORM_EXPORT FloatPoint3D { | 31 class PLATFORM_EXPORT FloatPoint3D { |
31 public: | 32 public: |
32 FloatPoint3D() | 33 FloatPoint3D() |
33 : m_x(0) | 34 : m_x(0) |
34 , m_y(0) | 35 , m_y(0) |
35 , m_z(0) | 36 , m_z(0) |
36 { | 37 { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 FloatPoint3D result; | 121 FloatPoint3D result; |
121 result.cross(*this, point); | 122 result.cross(*this, point); |
122 return result; | 123 return result; |
123 } | 124 } |
124 | 125 |
125 float lengthSquared() const { return this->dot(*this); } | 126 float lengthSquared() const { return this->dot(*this); } |
126 float length() const { return sqrtf(lengthSquared()); } | 127 float length() const { return sqrtf(lengthSquared()); } |
127 | 128 |
128 float distanceTo(const FloatPoint3D& a) const; | 129 float distanceTo(const FloatPoint3D& a) const; |
129 | 130 |
| 131 operator SkPoint3() const { return SkPoint3::Make(m_x, m_y, m_z); } |
| 132 |
130 private: | 133 private: |
131 float m_x; | 134 float m_x; |
132 float m_y; | 135 float m_y; |
133 float m_z; | 136 float m_z; |
134 }; | 137 }; |
135 | 138 |
136 inline FloatPoint3D& operator +=(FloatPoint3D& a, const FloatPoint3D& b) | 139 inline FloatPoint3D& operator +=(FloatPoint3D& a, const FloatPoint3D& b) |
137 { | 140 { |
138 a.move(b.x(), b.y(), b.z()); | 141 a.move(b.x(), b.y(), b.z()); |
139 return a; | 142 return a; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 return (*this - a).length(); | 189 return (*this - a).length(); |
187 } | 190 } |
188 | 191 |
189 // Redeclared here to avoid ODR issues. | 192 // Redeclared here to avoid ODR issues. |
190 // See platform/testing/GeometryPrinters.h. | 193 // See platform/testing/GeometryPrinters.h. |
191 void PrintTo(const FloatPoint3D&, std::ostream*); | 194 void PrintTo(const FloatPoint3D&, std::ostream*); |
192 | 195 |
193 } // namespace blink | 196 } // namespace blink |
194 | 197 |
195 #endif // FloatPoint3D_h | 198 #endif // FloatPoint3D_h |
OLD | NEW |