From 947427cb8d6d4aa020ae0f238c3195229490936e Mon Sep 17 00:00:00 2001 From: Jan Haller Date: Sun, 3 May 2015 14:51:44 +0200 Subject: [PATCH] Clarified semantics of Shape::getGlobalBounds(), improved related documentation --- include/SFML/Graphics/Image.hpp | 2 +- include/SFML/Graphics/Shape.hpp | 13 ++++++++++--- include/SFML/Graphics/Sprite.hpp | 2 +- include/SFML/Graphics/Text.hpp | 4 ++-- include/SFML/Graphics/VertexArray.hpp | 4 ++-- include/SFML/Window/Sensor.hpp | 2 +- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/include/SFML/Graphics/Image.hpp b/include/SFML/Graphics/Image.hpp index ad5d99fab..11dc8f705 100644 --- a/include/SFML/Graphics/Image.hpp +++ b/include/SFML/Graphics/Image.hpp @@ -193,7 +193,7 @@ public: /// \param destX X coordinate of the destination position /// \param destY Y coordinate of the destination position /// \param sourceRect Sub-rectangle of the source image to copy - /// \param applyAlpha Should the copy take in account the source transparency? + /// \param applyAlpha Should the copy take into account the source transparency? /// //////////////////////////////////////////////////////////// void copy(const Image& source, unsigned int destX, unsigned int destY, const IntRect& sourceRect = IntRect(0, 0, 0, 0), bool applyAlpha = false); diff --git a/include/SFML/Graphics/Shape.hpp b/include/SFML/Graphics/Shape.hpp index 2c8d5dd78..5983a9deb 100644 --- a/include/SFML/Graphics/Shape.hpp +++ b/include/SFML/Graphics/Shape.hpp @@ -227,13 +227,20 @@ public: FloatRect getLocalBounds() const; //////////////////////////////////////////////////////////// - /// \brief Get the global bounding rectangle of the entity + /// \brief Get the global (non-minimal) bounding rectangle of the entity /// /// The returned rectangle is in global coordinates, which means - /// that it takes in account the transformations (translation, + /// that it takes into account the transformations (translation, /// rotation, scale, ...) that are applied to the entity. /// In other words, this function returns the bounds of the - /// sprite in the global 2D world's coordinate system. + /// shape in the global 2D world's coordinate system. + /// + /// This function does not necessarily return the \a minimal + /// bounding rectangle. It merely ensures that the returned + /// rectangle covers all the vertices (but possibly more). + /// This allows for a fast approximation of the bounds as a + /// first check; you may want to use more precise checks + /// on top of that. /// /// \return Global bounding rectangle of the entity /// diff --git a/include/SFML/Graphics/Sprite.hpp b/include/SFML/Graphics/Sprite.hpp index a5e3b932a..c7447dffb 100644 --- a/include/SFML/Graphics/Sprite.hpp +++ b/include/SFML/Graphics/Sprite.hpp @@ -179,7 +179,7 @@ public: /// \brief Get the global bounding rectangle of the entity /// /// The returned rectangle is in global coordinates, which means - /// that it takes in account the transformations (translation, + /// that it takes into account the transformations (translation, /// rotation, scale, ...) that are applied to the entity. /// In other words, this function returns the bounds of the /// sprite in the global 2D world's coordinate system. diff --git a/include/SFML/Graphics/Text.hpp b/include/SFML/Graphics/Text.hpp index b753902c3..c31ec611a 100644 --- a/include/SFML/Graphics/Text.hpp +++ b/include/SFML/Graphics/Text.hpp @@ -268,10 +268,10 @@ public: /// \brief Get the global bounding rectangle of the entity /// /// The returned rectangle is in global coordinates, which means - /// that it takes in account the transformations (translation, + /// that it takes into account the transformations (translation, /// rotation, scale, ...) that are applied to the entity. /// In other words, this function returns the bounds of the - /// sprite in the global 2D world's coordinate system. + /// text in the global 2D world's coordinate system. /// /// \return Global bounding rectangle of the entity /// diff --git a/include/SFML/Graphics/VertexArray.hpp b/include/SFML/Graphics/VertexArray.hpp index 209b24e35..f0820a534 100644 --- a/include/SFML/Graphics/VertexArray.hpp +++ b/include/SFML/Graphics/VertexArray.hpp @@ -163,8 +163,8 @@ public: //////////////////////////////////////////////////////////// /// \brief Compute the bounding rectangle of the vertex array /// - /// This function returns the axis-aligned rectangle that - /// contains all the vertices of the array. + /// This function returns the minimal axis-aligned rectangle + /// that contains all the vertices of the array. /// /// \return Bounding rectangle of the vertex array /// diff --git a/include/SFML/Window/Sensor.hpp b/include/SFML/Window/Sensor.hpp index 350976fbf..6078881fa 100644 --- a/include/SFML/Window/Sensor.hpp +++ b/include/SFML/Window/Sensor.hpp @@ -122,7 +122,7 @@ public: /// /// You may wonder why some sensor types look so similar, for example /// Accelerometer and Gravity / UserAcceleration. The first one -/// is the raw measurement of the acceleration, and takes in account +/// is the raw measurement of the acceleration, and takes into account /// both the earth gravity and the user movement. The others are /// more precise: they provide these components separately, which is /// usually more useful. In fact they are not direct sensors, they