Просмотр исходного кода

Added (untested) ortho method.

Mark Sibly 9 лет назад
Родитель
Сommit
79fffa8352
1 измененных файлов с 13 добавлено и 0 удалено
  1. 13 0
      modules/std/geom/affinemat3.monkey2

+ 13 - 0
modules/std/geom/affinemat3.monkey2

@@ -74,5 +74,18 @@ Struct AffineMat3<T>
 	Method Scale:AffineMat3( sx:T,sy:T )
 		Return Transform( sx,0,0,sy,0,0 )
 	End
+
+	Function Ortho:AffineMat3( left:T,right:T,bottom:T,top:T )
+
+		Local w:=right-left,h:=top-bottom
+
+		Local r:AffineMat3
+		r.i.x=2/w
+		r.j.y=2/h
+		r.t.x=-(right+left)/w
+		r.t.y=-(top+bottom)/h
+		Return r
+	End
+	
 	
 End