MyGUI  3.2.1
MyGUI_GeometryUtility.h
Go to the documentation of this file.
1 /*
2  * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3  * Distributed under the MIT License
4  * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5  */
6 
7 #ifndef __MYGUI_GEOMETRY_UTILITY_H__
8 #define __MYGUI_GEOMETRY_UTILITY_H__
9 
10 #include "MyGUI_Prerequest.h"
11 
12 namespace MyGUI
13 {
14 
15  typedef std::vector<FloatPoint> VectorFloatPoint;
16 
17  namespace geometry_utility
18  {
19  VectorFloatPoint cropPolygon(FloatPoint* _baseVerticiesPos, size_t _size, const IntCoord& _cropRectangle);
20 
21  enum Side {Left, Right, Top, Bottom};
22  void cropPolygonSide(VectorFloatPoint& _verticies, int _sideCoord, Side _side);
23 
24  // get point position relative to rectangle
25  FloatPoint getPositionInsideRect(const FloatPoint& _point, const FloatPoint& _corner0, const FloatPoint& _corner1, const FloatPoint& _corner2);
26 
27  FloatPoint getUVFromPositionInsideRect(const FloatPoint& _point, const FloatPoint& _v0, const FloatPoint& _v1, const FloatPoint& _baseUV);
28 
29  } // namespace geometry_utility
30 
31 } // namespace MyGUI
32 
33 #endif // __MYGUI_GEOMETRY_UTILITY_H__