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. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 66 } |
67 | 67 |
68 bool isZero() const { return !m_x && !m_y && !m_z; } | 68 bool isZero() const { return !m_x && !m_y && !m_z; } |
69 | 69 |
70 void normalize(); | 70 void normalize(); |
71 | 71 |
72 float dot(const FloatPoint3D& a) const { | 72 float dot(const FloatPoint3D& a) const { |
73 return m_x * a.x() + m_y * a.y() + m_z * a.z(); | 73 return m_x * a.x() + m_y * a.y() + m_z * a.z(); |
74 } | 74 } |
75 | 75 |
76 // Compute the angle (in radians) between this and y. If either vector is the
zero vector, | 76 // Compute the angle (in radians) between this and y. If either vector is the |
77 // return an angle of 0. | 77 // zero vector, return an angle of 0. |
78 float angleBetween(const FloatPoint3D& y) const; | 78 float angleBetween(const FloatPoint3D& y) const; |
79 | 79 |
80 // Sets this FloatPoint3D to the cross product of the passed two. | 80 // Sets this FloatPoint3D to the cross product of the passed two. |
81 // It is safe for "this" to be the same as either or both of the | 81 // It is safe for "this" to be the same as either or both of the |
82 // arguments. | 82 // arguments. |
83 void cross(const FloatPoint3D& a, const FloatPoint3D& b) { | 83 void cross(const FloatPoint3D& a, const FloatPoint3D& b) { |
84 float x = a.y() * b.z() - a.z() * b.y(); | 84 float x = a.y() * b.z() - a.z() * b.y(); |
85 float y = a.z() * b.x() - a.x() * b.z(); | 85 float y = a.z() * b.x() - a.x() * b.z(); |
86 float z = a.x() * b.y() - a.y() * b.x(); | 86 float z = a.x() * b.y() - a.y() * b.x(); |
87 m_x = x; | 87 m_x = x; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 return (*this - a).length(); | 155 return (*this - a).length(); |
156 } | 156 } |
157 | 157 |
158 // Redeclared here to avoid ODR issues. | 158 // Redeclared here to avoid ODR issues. |
159 // See platform/testing/GeometryPrinters.h. | 159 // See platform/testing/GeometryPrinters.h. |
160 void PrintTo(const FloatPoint3D&, std::ostream*); | 160 void PrintTo(const FloatPoint3D&, std::ostream*); |
161 | 161 |
162 } // namespace blink | 162 } // namespace blink |
163 | 163 |
164 #endif // FloatPoint3D_h | 164 #endif // FloatPoint3D_h |
OLD | NEW |