* FlipX / MirrorX added 4.x-dev

Thu, 15 Jul 2021 08:51:57 +0300

author
dogukangulyasar
date
Thu, 15 Jul 2021 08:51:57 +0300
branch
4.x-dev
changeset 1717
2ec8ce4582c3
parent 1716
d02bc2e9b8ed
child 1718
fc59bffda6f7

* FlipX / MirrorX added

Source/Gorgon/Geometry/Bounds.h file | annotate | diff | comparison | revisions
Source/Gorgon/Geometry/Point.h file | annotate | diff | comparison | revisions
--- a/Source/Gorgon/Geometry/Bounds.h	Thu Jul 15 01:36:46 2021 +0300
+++ b/Source/Gorgon/Geometry/Bounds.h	Thu Jul 15 08:51:57 2021 +0300
@@ -807,13 +807,33 @@
 			bounds.Bottom= T_( bounds.Bottom+ (bounds.Left  -origin.X)*rate );
 		}
 	}
+	
+	///Reflects the bounds along X axis
 	template <class T_>
 	void MirrorX(basic_Bounds<T_> &bounds){
         bounds.Right = -bounds.Right;
+        if(bounds.Left>bounds.Right) std::swap(bounds.Left,bounds.Right);
     }
+    
+    ///Reflects the bounds along Y axis
     template <class T_>
     void MirrorY(basic_Bounds<T_> &bounds){
         bounds.Bottom = -bounds.Bottom;
+        if(bounds.Top>bounds.Bottom) std::swap(bounds.Top,bounds.Bottom);
+    }
+    
+    ///Flips the bounds along Y axis
+    template <class T_>
+	void FlipX(basic_Bounds<T_> &bounds){
+        bounds.Bottom= -bounds.Bottom;
+        if(bounds.Top>bounds.Bottom) std::swap(bounds.Top,bounds.Bottom);
+    }
+    
+    ///Flips the bounds along X axis
+    template <class T_>
+    void FlipY(basic_Bounds<T_> &bounds){
+        bounds.Right = -bounds.Right;
+        if(bounds.Left>bounds.Right) std::swap(bounds.Left,bounds.Right);
     }
 	
 	/// @see basic_Bounds
--- a/Source/Gorgon/Geometry/Point.h	Thu Jul 15 01:36:46 2021 +0300
+++ b/Source/Gorgon/Geometry/Point.h	Thu Jul 15 08:51:57 2021 +0300
@@ -552,14 +552,14 @@
 		
 		/// Reflects the given point along the X axis
 		template<class T_>
-		void MirrorX(basic_Point<T_> &point) {
-			point.Y = -point.Y;
+		void FlipX(basic_Point<T_> &point) {
+			point.X = -point.X;
 		}
 
 		/// Reflects the given point along the Y axis
 		template<class T_>
-		void MirrorY(basic_Point<T_> &point) {
-			point.X = -point.X;
+		void FlipY(basic_Point<T_> &point) {
+			point.Y = -point.Y;
 		}
 
 		/// Reflects the given point horizontally

mercurial