internal void Set(ref Matrix2x3 toWorld) { this.ToWorld = toWorld; Matrix2x3.Invert(ref toWorld, out ToBody); Matrix2x2.CreateNormal(ref toWorld, out ToWorldNormal); Matrix2x2.CreateNormal(ref ToBody, out ToBodyNormal); }
protected internal override void UpdateTime(TimeStep step) { time += step.Dt; radius = 1 + time * pressurePulseSpeed; explosionBody.Transformation = Matrix2x3.FromScale(new Vector2D(radius, radius)); base.UpdateTime(step); }
public static Line Transform(Matrix2x3 matrix, Line line) { Line result; Transform(ref matrix, ref line, out result); return(result); }
protected override void Open() { dispose += DemoHelper.BasicDemoSetup(DemoInfo); dispose += DemoHelper.CreateTank(DemoInfo, new Vector2D(50, 0)); List <Body> bodies = new List <Body>(); dispose += DemoHelper.CreateTank(DemoInfo, new Vector2D(250, 0), bodies); Scene.Engine.AddLogic(new GravityField(new Vector2D(0, 1000), new Lifespan())); DemoHelper.AddFloor(DemoInfo, new ALVector2D(0, new Vector2D(700, 750))); IShape shape = ShapeFactory.CreateSprite(Cache <SurfacePolygons> .GetItem("fighter.png"), 3, 16, 4); for (int i = 128 * 3; i > -128; i -= 128) { Body b = DemoHelper.AddShape(DemoInfo, shape, 40, new ALVector2D(1, new Vector2D(700, 272 + i))); //b.Transformation *= Matrix2x3.FromScale(new Vector2D(1, .5f)); } Body line = DemoHelper.AddLine(DemoInfo, new Vector2D(300, 400), new Vector2D(600, 400), 20, Scalar.PositiveInfinity); line.IgnoresGravity = true; GroupedOneWayPlatformIgnorer ignorer = new GroupedOneWayPlatformIgnorer(-Vector2D.YAxis, 10); ignorer.AddGroup(bodies.ToArray()); line.CollisionIgnorer = ignorer; Body ball = DemoHelper.AddCircle(DemoInfo, 80, 20, 4000, new ALVector2D(0, 1028, 272)); ball.Transformation *= Matrix2x3.FromRotationZ(1) * Matrix2x3.FromScale(new Vector2D(.9f, .5f)) * Matrix2x3.FromRotationZ(-1); }
public Matrix2x3 ViewBoxTransform() { if(_cachedViewBoxTransform == null) { Matrix2x3 matrix = new Matrix2x3(); float x = 0.0f, y = 0.0f, w, h, attrWidth = _width.value, attrHeight = _height.value; if(!string.IsNullOrEmpty(_attrList.GetValue("viewBox"))) { Rect r = _viewport; x += -r.x; y += -r.y; w = r.width; h = r.height; } else { w = attrWidth; h = attrHeight; } float x_ratio = attrWidth / w, y_ratio = attrHeight / h; matrix = matrix.ScaleNonUniform(x_ratio, y_ratio); matrix = matrix.Translate(x, y); _cachedViewBoxTransform = matrix; } return _cachedViewBoxTransform; }
private Body(Body copy) { Initialize(); this.ignoresCollisionResponce = copy.ignoresCollisionResponce; this.shape = copy.shape; this.massInfo = copy.massInfo; this.coefficients = copy.coefficients; this.collisionIgnorer = copy.collisionIgnorer; this.matrices = copy.matrices.Duplicate(); this.state = copy.state.Duplicate(); this.lifetime = copy.lifetime.Duplicate(); this.transformation = copy.transformation; this.linearDamping = copy.linearDamping; this.angularDamping = copy.angularDamping; this.ignoresCollisionResponce = copy.ignoresCollisionResponce; this.ignoresGravity = copy.ignoresGravity; this.ignoresPhysicsLogics = copy.ignoresPhysicsLogics; this.isTransformed = copy.isTransformed; this.isCollidable = copy.isCollidable; this.isEventable = copy.isEventable; this.tag = copy.tag; }
public Matrices() { this.ToWorld = Matrix2x3.Identity; this.ToBody = Matrix2x3.Identity; this.ToWorldNormal = Matrix2x2.Identity; this.ToBodyNormal = Matrix2x2.Identity; }
/// <summary> /// Sets the Transform. /// </summary> /// <param name="matrix">The Matrix.</param> public void SetTransform(Matrix2x3 matrix) { var matrixf = new float[16]; matrixf[0] = matrix[0, 0]; matrixf[1] = matrix[1, 0]; matrixf[2] = 0; matrixf[3] = 0; matrixf[4] = matrix[0, 1]; matrixf[5] = matrix[1, 1]; matrixf[6] = 0; matrixf[7] = 0; matrixf[8] = 0; matrixf[9] = 0; matrixf[10] = 1; matrixf[11] = 0; matrixf[12] = matrix.OffsetX; matrixf[13] = matrix.OffsetY; matrixf[14] = 0; matrixf[15] = 1; _matrix4 = matrixf; }
/// <summary> /// Transforms the vector by the matrix. /// </summary> /// <param name="v">Vector2 to transform. Considered to be a row vector for purposes of multiplication.</param> /// <param name="matrix">Matrix to use as the transformation.</param> /// <param name="result">Row vector product of the transformation.</param> public static void Transform(ref Vector2 v, ref Matrix2x3 matrix, out Vector3 result) { result = new Vector3(); result.X = v.X * matrix.M11 + v.Y * matrix.M21; result.Y = v.X * matrix.M12 + v.Y * matrix.M22; result.Z = v.X * matrix.M13 + v.Y * matrix.M23; }
public static BoundingRectangle FromCircle(Matrix2x3 matrix, Scalar radius) { BoundingRectangle result; FromCircle(ref matrix, ref radius, out result); return(result); }
public void ConstructorValuesAreAccessibleByIndexer() { Matrix2x3 matrix2x3; matrix2x3 = new Matrix2x3(); for (int x = 0; x < matrix2x3.Columns; x++) { for (int y = 0; y < matrix2x3.Rows; y++) { Assert.Equal(0, matrix2x3[x, y], Epsilon); } } double value = 33.33; matrix2x3 = new Matrix2x3(value); for (int x = 0; x < matrix2x3.Columns; x++) { for (int y = 0; y < matrix2x3.Rows; y++) { Assert.Equal(value, matrix2x3[x, y], Epsilon); } } GenerateFilledMatrixWithValues(out matrix2x3); for (int y = 0; y < matrix2x3.Rows; y++) { for (int x = 0; x < matrix2x3.Columns; x++) { Assert.Equal(y * matrix2x3.Columns + x, matrix2x3[x, y], Epsilon); } } }
public void MemberGetAndSetValuesCorrectly() { Matrix2x3 matrix2x3 = new Matrix2x3(); matrix2x3.M11 = 0; matrix2x3.M21 = 1; matrix2x3.M12 = 2; matrix2x3.M22 = 3; matrix2x3.M13 = 4; matrix2x3.M23 = 5; Assert.Equal(0, matrix2x3.M11, Epsilon); Assert.Equal(1, matrix2x3.M21, Epsilon); Assert.Equal(2, matrix2x3.M12, Epsilon); Assert.Equal(3, matrix2x3.M22, Epsilon); Assert.Equal(4, matrix2x3.M13, Epsilon); Assert.Equal(5, matrix2x3.M23, Epsilon); Assert.Equal(matrix2x3[0, 0], matrix2x3.M11, Epsilon); Assert.Equal(matrix2x3[1, 0], matrix2x3.M21, Epsilon); Assert.Equal(matrix2x3[0, 1], matrix2x3.M12, Epsilon); Assert.Equal(matrix2x3[1, 1], matrix2x3.M22, Epsilon); Assert.Equal(matrix2x3[0, 2], matrix2x3.M13, Epsilon); Assert.Equal(matrix2x3[1, 2], matrix2x3.M23, Epsilon); }
private Matrices(Matrices copy) { this.ToWorld = copy.ToWorld; this.ToBody = copy.ToBody; this.ToWorldNormal = copy.ToWorldNormal; this.ToBodyNormal = copy.ToBodyNormal; }
public static void FromVectors(ref Matrix2x3 matrix, Vector2D[] vectors, out BoundingRectangle result) { if (vectors == null) { throw new ArgumentNullException("vectors"); } if (vectors.Length == 0) { throw new ArgumentOutOfRangeException("vectors"); } Vector2D current; Vector2D.TransformNormal(ref matrix, ref vectors[0], out current); result.Max = current; result.Min = current; for (int index = 1; index < vectors.Length; ++index) { Vector2D.TransformNormal(ref matrix, ref vectors[index], out current); if (current.X > result.Max.X) { result.Max.X = current.X; } else if (current.X < result.Min.X) { result.Min.X = current.X; } if (current.Y > result.Max.Y) { result.Max.Y = current.Y; } else if (current.Y < result.Min.Y) { result.Min.Y = current.Y; } } result.Max.X += matrix.m02; result.Max.Y += matrix.m12; result.Min.X += matrix.m02; result.Min.Y += matrix.m12; }
public static List <Body> AddPyramid(DemoOpenInfo info, IShape shape, Scalar mass, BoundingRectangle rect, Scalar xSpacing, Scalar ySpacing) { BoundingRectangle shapeRect; Matrix2x3 ident = Matrix2x3.Identity; shape.CalcBoundingRectangle(ref ident, out shapeRect); Vector2D size = shapeRect.Max - shapeRect.Min; Vector2D spacing = new Vector2D(xSpacing, ySpacing) + size; Vector2D end = rect.Max - size * .5f; Vector2D begin = rect.Min + size * .5f; Vector2D center = (end + begin) * .5f; List <Body> result = new List <Body>(); for (int row = 1; begin.Y + row * spacing.Y < end.Y; row++) { Scalar start = center.X - ((spacing.X * row - 1) * .5f); for (int column = 0; column < row; ++column) { Vector2D pos = new Vector2D(start + spacing.X * column, row * spacing.Y + begin.Y); if (pos.X > begin.X && pos.X <= end.X) { result.Add(AddShape(info, shape, mass, new ALVector2D(0, pos))); } } } return(result); }
public Matrix2x3 ViewBoxTransform() { if (_cachedViewBoxTransform == null) { Matrix2x3 matrix = new Matrix2x3(); float x = 0.0f, y = 0.0f, w, h, attrWidth = _width.value, attrHeight = _height.value; if (!string.IsNullOrEmpty(_attrList.GetValue("viewBox"))) { Rect r = _viewport; x += -r.x; y += -r.y; w = r.width; h = r.height; } else { w = attrWidth; h = attrHeight; } float x_ratio = attrWidth / w, y_ratio = attrHeight / h; matrix = matrix.ScaleNonUniform(x_ratio, y_ratio); matrix = matrix.Translate(x, y); _cachedViewBoxTransform = matrix; } return(_cachedViewBoxTransform); }
public void Transform(Matrix2x3 matrix) { if (Triangulated) { for (int i = 0; i < Vertices.Count; i++) { Vertices[i] = matrix.ApplyTo(Vertices[i]); } } else { if (polygons != null) { for (int i = 0; i < polygons.Count; i++) { polygons[i] = matrix.ApplyTo(polygons[i]).ToList(); } } if (tree != null) { TransformRecursiveley(tree, matrix); } } }
public static Matrix2x3 Translate(Vector2 translation) { Matrix2x3 result = identity; result.m02 = translation.x; result.m12 = translation.y; return(result); }
/// <summary> /// Transforms the vector by the matrix. /// </summary> /// <param name="v">Vector2 to transform. Considered to be a column vector for purposes of multiplication.</param> /// <param name="matrix">Matrix to use as the transformation.</param> /// <param name="result">Column vector product of the transformation.</param> public static void Transform(ref Vector3 v, ref Matrix2x3 matrix, out Vector2 result) { #if !WINDOWS result = new Vector2(); #endif result.X = matrix.M11 * v.X + matrix.M12 * v.Y + matrix.M13 * v.Z; result.Y = matrix.M21 * v.X + matrix.M22 * v.Y + matrix.M23 * v.Z; }
/// <summary> /// Multiplies the two matrices. /// </summary> /// <param name="a">First matrix to multiply.</param> /// <param name="b">Second matrix to multiply.</param> /// <param name="result">Product of the multiplication.</param> public static void Multiply(ref Matrix2x3 a, ref Matrix3x2 b, out Matrix2x2 result) { result.M11 = a.M11 * b.M11 + a.M12 * b.M21 + a.M13 * b.M31; result.M12 = a.M11 * b.M12 + a.M12 * b.M22 + a.M13 * b.M32; result.M21 = a.M21 * b.M11 + a.M22 * b.M21 + a.M23 * b.M31; result.M22 = a.M21 * b.M12 + a.M22 * b.M22 + a.M23 * b.M32; }
public void Multiply(Matrix2x3 secondMatrix) { float sa = secondMatrix.a, sb = secondMatrix.b, sc = secondMatrix.c, sd = secondMatrix.d, se = secondMatrix.e, sf = secondMatrix.f; SetValues(a * sa + c * sb, b * sa + d * sb, a * sc + c * sd, b * sc + d * sd, a * se + c * sf + e, b * se + d * sf + f); }
static void TransformRecursiveley(PolyNode node, Matrix2x3 matrix) { foreach (PolyNode childNode in node.Childs) { childNode.Contour = matrix.ApplyTo(childNode.Contour).ToList(); TransformRecursiveley(childNode, matrix); } }
public static Matrix2x3 Scale(Vector2 scale) { Matrix2x3 result = identity; result.m00 = scale.x; result.m11 = scale.y; return(result); }
public IndirectTexMatrix() { Matrix = new Matrix2x3( 0.5f, 0.0f, 0.0f, 0.0f, 0.5f, 0.0f); Exponent = 1; }
public void EqualityOperatorWorksCorrectly() { Matrix2x3 value1 = new Matrix2x3(100); Matrix2x3 value2 = new Matrix2x3(50) * 2; Assert.Equal(value1, value2); Assert.True(value1 == value2, "Equality operator failed."); }
public static void Validate(this Matrix2x3 m) { if (IsInvalid(m.M11) || IsInvalid(m.M12) || IsInvalid(m.M13) || IsInvalid(m.M21) || IsInvalid(m.M22) || IsInvalid(m.M23)) { throw new NotFiniteNumberException("Invalid value."); } }
public static void ToMatrix2x3(ref ALVector2D source, out Matrix2x3 result) { result.m00 = MathHelper.Cos(source.Angular); result.m10 = MathHelper.Sin(source.Angular); result.m01 = -result.m10; result.m11 = result.m00; result.m02 = source.Linear.X; result.m12 = source.Linear.Y; }
public void AccessorThrowsWhenOutOfBounds() { Matrix2x3 matrix2x3 = new Matrix2x3(); Assert.Throws <ArgumentOutOfRangeException>(() => { matrix2x3[-1, 0] = 0; }); Assert.Throws <ArgumentOutOfRangeException>(() => { matrix2x3[0, -1] = 0; }); Assert.Throws <ArgumentOutOfRangeException>(() => { matrix2x3[2, 0] = 0; }); Assert.Throws <ArgumentOutOfRangeException>(() => { matrix2x3[0, 3] = 0; }); }
public void ConstantValuesAreCorrect() { Matrix2x3 matrix2x3 = new Matrix2x3(); Assert.Equal(2, matrix2x3.Columns); Assert.Equal(3, matrix2x3.Rows); Assert.Equal(Matrix2x3.ColumnCount, matrix2x3.Columns); Assert.Equal(Matrix2x3.RowCount, matrix2x3.Rows); }
internal void UpdatePosition(float dt) { if (Mass != 0) { RotationAngle += AngularVelocity * dt; Center += LinearVelocity * dt; Polygon = (Matrix2x3.Translation(Center) * Matrix2x3.Rotation(RotationAngle) * Matrix2x3.Translation(-startCenter)).ApplyTo(startPolygon); } }
public void MuliplyByMatrix2x3ProducesMatrix2x1() { Matrix3x1 matrix1 = new Matrix3x1(3); Matrix2x3 matrix2 = new Matrix2x3(2); Matrix2x1 result = matrix1 * matrix2; Matrix2x1 expected = new Matrix2x1(18, 18); Assert.Equal(expected, result); }
/// <summary> /// Transforms the vector by the matrix. /// </summary> /// <param name="v">System.Numerics.Vector2 to transform. Considered to be a row vector for purposes of multiplication.</param> /// <param name="matrix">System.Numerics.Matrix4x4 to use as the transformation.</param> /// <param name="result">Row vector product of the transformation.</param> public static void Transform(ref System.Numerics.Vector2 v, ref Matrix2x3 matrix, out System.Numerics.Vector3 result) { #if !WINDOWS result = new System.Numerics.Vector3(); #endif result.X = v.X * matrix.M11 + v.Y * matrix.M21; result.Y = v.X * matrix.M12 + v.Y * matrix.M22; result.Z = v.X * matrix.M13 + v.Y * matrix.M23; }
public static Vector2D[][] ApplyMatrixToRange(ref Matrix2x3 matrix, Vector2D[][] polygons) { if (polygons == null) { throw new ArgumentNullException("polygons"); } Vector2D[][] result = new Vector2D[polygons.Length][]; for (int index = 0; index < polygons.Length; ++index) { result[index] = ApplyMatrix(ref matrix, polygons[index]); } return result; }
public void Multiply(Matrix2x3 secondMatrix) { float sa = secondMatrix.a; float sb = secondMatrix.b; float sc = secondMatrix.c; float sd = secondMatrix.d; float se = secondMatrix.e; float sf = secondMatrix.f; SetValues(a*sa + c*sb, b*sa + d*sb, a*sc + c*sd, b*sc + d*sd, a*se + c*sf + e, b*se + d*sf + f); }
/// <summary> /// Adds the two matrices together on a per-element basis. /// </summary> /// <param name="a">First matrix to add.</param> /// <param name="b">Second matrix to add.</param> /// <param name="result">Sum of the two matrices.</param> public static void Add(ref Matrix2x3 a, ref Matrix2x3 b, out Matrix2x3 result) { float m11 = a.M11 + b.M11; float m12 = a.M12 + b.M12; float m13 = a.M13 + b.M13; float m21 = a.M21 + b.M21; float m22 = a.M22 + b.M22; float m23 = a.M23 + b.M23; result.M11 = m11; result.M12 = m12; result.M13 = m13; result.M21 = m21; result.M22 = m22; result.M23 = m23; }
public void IndexerGetAndSetValuesCorrectly() { Matrix2x3 matrix2x3 = new Matrix2x3(); for (int x = 0; x < matrix2x3.Columns; x++) { for (int y = 0; y < matrix2x3.Rows; y++) { matrix2x3[x, y] = y * matrix2x3.Columns + x; } } for (int y = 0; y < matrix2x3.Rows; y++) { for (int x = 0; x < matrix2x3.Columns; x++) { Assert.Equal(y * matrix2x3.Columns + x, matrix2x3[x, y], Epsilon); } } }
public void AccessorThrowsWhenOutOfBounds() { Matrix2x3 matrix2x3 = new Matrix2x3(); try { matrix2x3[-1, 0] = 0; Assert.Fail("Matrix2x3[-1, 0] did not throw when it should have."); } catch (ArgumentOutOfRangeException) { } try { matrix2x3[0, -1] = 0; Assert.Fail("Matrix2x3[0, -1] did not throw when it should have."); } catch (ArgumentOutOfRangeException) { } try { matrix2x3[2, 0] = 0; Assert.Fail("Matrix2x3[2, 0] did not throw when it should have."); } catch (ArgumentOutOfRangeException) { } try { matrix2x3[0, 3] = 0; Assert.Fail("Matrix2x3[0, 3] did not throw when it should have."); } catch (ArgumentOutOfRangeException) { } }
/// <summary> /// Transforms the vector by the matrix. /// </summary> /// <param name="v">System.Numerics.Vector2 to transform. Considered to be a column vector for purposes of multiplication.</param> /// <param name="matrix">System.Numerics.Matrix4x4 to use as the transformation.</param> /// <param name="result">Column vector product of the transformation.</param> public static void Transform(ref System.Numerics.Vector3 v, ref Matrix2x3 matrix, out System.Numerics.Vector2 result) { #if !WINDOWS result = new System.Numerics.Vector2(); #endif result.X = matrix.M11 * v.X + matrix.M12 * v.Y + matrix.M13 * v.Z; result.Y = matrix.M21 * v.X + matrix.M22 * v.Y + matrix.M23 * v.Z; }
/// <summary> /// Subtracts the two matrices from each other on a per-element basis. /// </summary> /// <param name="a">First matrix to subtract.</param> /// <param name="b">Second matrix to subtract.</param> /// <param name="result">Difference of the two matrices.</param> public static void Subtract(ref Matrix2x3 a, ref Matrix2x3 b, out Matrix2x3 result) { float m11 = a.M11 - b.M11; float m12 = a.M12 - b.M12; float m13 = a.M13 - b.M13; float m21 = a.M21 - b.M21; float m22 = a.M22 - b.M22; float m23 = a.M23 - b.M23; result.M11 = m11; result.M12 = m12; result.M13 = m13; result.M21 = m21; result.M22 = m22; result.M23 = m23; }
/// <summary> /// Negates every element in the matrix. /// </summary> /// <param name="matrix">System.Numerics.Matrix4x4 to negate.</param> /// <param name="result">Negated matrix.</param> public static void Negate(ref Matrix2x3 matrix, out Matrix2x3 result) { float m11 = -matrix.M11; float m12 = -matrix.M12; float m13 = -matrix.M13; float m21 = -matrix.M21; float m22 = -matrix.M22; float m23 = -matrix.M23; result.M11 = m11; result.M12 = m12; result.M13 = m13; result.M21 = m21; result.M22 = m22; result.M23 = m23; }
public SVGTransform(Matrix2x3 matrix) { _type = SVGTransformMode.Matrix; this.matrix = matrix; }
private void GenerateFilledMatrixWithValues(out Matrix2x3 matrix) { matrix = new Matrix2x3(0, 1, 2, 3, 4, 5); }
public Matrix2x3(Matrix2x3 m) : this(m.a, m.b, m.c, m.d, m.e, m.f) { }
/// <summary> /// Multiplies the two matrices. /// </summary> /// <param name="a">First matrix to multiply.</param> /// <param name="b">Second matrix to multiply.</param> /// <param name="result">Product of the multiplication.</param> public static void Multiply(ref Matrix2x3 a, ref Matrix3x3 b, out Matrix2x3 result) { float resultM11 = a.M11 * b.M11 + a.M12 * b.M21 + a.M13 * b.M31; float resultM12 = a.M11 * b.M12 + a.M12 * b.M22 + a.M13 * b.M32; float resultM13 = a.M11 * b.M13 + a.M12 * b.M23 + a.M13 * b.M33; float resultM21 = a.M21 * b.M11 + a.M22 * b.M21 + a.M23 * b.M31; float resultM22 = a.M21 * b.M12 + a.M22 * b.M22 + a.M23 * b.M32; float resultM23 = a.M21 * b.M13 + a.M22 * b.M23 + a.M23 * b.M33; result.M11 = resultM11; result.M12 = resultM12; result.M13 = resultM13; result.M21 = resultM21; result.M22 = resultM22; result.M23 = resultM23; }
public void SetRotate(float rotateAngle, float cx, float cy) { _type = SVGTransformMode.Rotate; _angle = rotateAngle; matrix = new Matrix2x3().Translate(cx, cy).Rotate(angle).Translate(-cx, -cy); }
public void SetRotate(float rotateAngle) { _type = SVGTransformMode.Rotate; _angle = rotateAngle; matrix = new Matrix2x3().Rotate(rotateAngle); }
public void SetMatrix(Matrix2x3 m) { _type = SVGTransformMode.Matrix; matrix = m; }
public void AccessorThrowsWhenOutOfBounds() { Matrix2x3 matrix2x3 = new Matrix2x3(); Assert.Throws<ArgumentOutOfRangeException>(() => { matrix2x3[-1, 0] = 0; }); Assert.Throws<ArgumentOutOfRangeException>(() => { matrix2x3[0, -1] = 0; }); Assert.Throws<ArgumentOutOfRangeException>(() => { matrix2x3[2, 0] = 0; }); Assert.Throws<ArgumentOutOfRangeException>(() => { matrix2x3[0, 3] = 0; }); }
/// <summary> /// Computes the transposed matrix of a matrix. /// </summary> /// <param name="matrix">System.Numerics.Matrix4x4 to transpose.</param> /// <param name="result">Transposed matrix.</param> public static void Transpose(ref Matrix2x3 matrix, out Matrix3x2 result) { result.M11 = matrix.M11; result.M12 = matrix.M21; result.M21 = matrix.M12; result.M22 = matrix.M22; result.M31 = matrix.M13; result.M32 = matrix.M23; }
public void SetScale(float sx, float sy) { _type = SVGTransformMode.Scale; matrix = new Matrix2x3().ScaleNonUniform(sx, sy); }
public static Vector2D[] ApplyMatrix(ref Matrix2x3 matrix, Vector2D[] vertexes) { return OperationHelper.ArrayRefOp<Matrix2x3, Vector2D, Vector2D>(ref matrix, vertexes, Vector2D.Transform); }
public void SetSkewY(float skewAngle) { _type = SVGTransformMode.SkewY; _angle = skewAngle; matrix = new Matrix2x3().SkewY(angle); }
public void SetTranslate(float tx, float ty) { _type = SVGTransformMode.Translate; matrix = new Matrix2x3().Translate(tx, ty); }
public SVGTransform() { matrix = new Matrix2x3(); _type = SVGTransformMode.Matrix; }
public void SimpleSubtractionGeneratesCorrectValues() { Matrix2x3 value1 = new Matrix2x3(100); Matrix2x3 value2 = new Matrix2x3(1); Matrix2x3 result = value1 - value2; for (int y = 0; y < Matrix2x3.RowCount; y++) { for (int x = 0; x < Matrix2x3.ColumnCount; x++) { Assert.Equal(100 - 1, result[x, y], Epsilon); } } }
public void MuliplyByMatrix4x2ProducesMatrix4x3() { Matrix2x3 matrix1 = new Matrix2x3(3); Matrix4x2 matrix2 = new Matrix4x2(2); Matrix4x3 result = matrix1 * matrix2; Matrix4x3 expected = new Matrix4x3(12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12); Assert.Equal(expected, result); }