Sfoglia il codice sorgente

[2d] Added optional point parameter to h2d.col.matrix.getScale

Parameter was cited in documentation but not present in code
Clément Espeute 1 mese fa
parent
commit
fb5ad9c237
1 ha cambiato i file con 3 aggiunte e 2 eliminazioni
  1. 3 2
      h2d/col/Matrix.hx

+ 3 - 2
h2d/col/Matrix.hx

@@ -208,8 +208,9 @@ class Matrix {
 		Returns a Point with a total scaling applied by the Matrix.
 		@param p Optional Point instance. If provided, sets values of given Point and returns it. Otherwise returns new Point instance.
 	**/
-	public inline function getScale() {
-		var p = new h2d.col.Point();
+	public inline function getScale(p: h2d.col.Point = null) {
+		if (p == null)
+			p = new h2d.col.Point();
 		p.x = Math.sqrt(a * a + b * b);
 		p.y = Math.sqrt(c * c + d * d);
 		if( getDeterminant() < 0 ) {