/// <summary> /// Translates the affine transform by the given translation vector, in the order specified. /// </summary> /// <param name="translateVector"> /// A vector whose components will translate the /// transform in the corresponding dimension. /// </param> /// <param name="order">The order to apply the transform in.</param> public void Translate(Vector translateVector, MatrixOperationOrder order) { AffineMatrix translateMatrix = new AffineMatrix(Format, RowCount); MatrixProcessor.Translate(translateMatrix, translateVector); Matrix result; if (Format == MatrixFormat.RowMajor) { if (order == MatrixOperationOrder.Append) { result = MatrixProcessor.Multiply(this, translateMatrix); } else { result = MatrixProcessor.Multiply(translateMatrix, this); } } else { if (order == MatrixOperationOrder.Append) { result = MatrixProcessor.Multiply(translateMatrix, this); } else { result = MatrixProcessor.Multiply(this, translateMatrix); } } MatrixProcessor.SetMatrix(result, this); }
/// <summary> /// Applies a shear to the transform, either before or after this <see cref="AffineMatrix{T}"/>. /// </summary> /// <param name="shearVector">The vector used to compute the shear.</param> /// <param name="order">The order to apply the transform in.</param> public virtual void Shear(Vector shearVector, MatrixOperationOrder order) { Matrix shear = new Matrix(Format, RowCount, ColumnCount, new DoubleComponent(1)); MatrixProcessor.Shear(shear, shearVector); Matrix result; if (order == MatrixOperationOrder.Prepend) { if (Format == MatrixFormat.RowMajor) { result = MatrixProcessor.Multiply(shear, this); } else { result = MatrixProcessor.Multiply(this, shear); } } else { if (Format == MatrixFormat.RowMajor) { result = MatrixProcessor.Multiply(this, shear); } else { result = MatrixProcessor.Multiply(shear, this); } } MatrixProcessor.SetMatrix(result, this); }
/// <summary> /// Translates the affine transform by the given amount /// in each dimension. /// </summary> /// <param name="amount">Amount to translate by.</param> /// <param name="order">The order to apply the transform in.</param> public void Translate(DoubleComponent amount, MatrixOperationOrder order) { Vector translateVector = new Vector(RowCount - 1); for (Int32 i = 0; i < translateVector.ComponentCount; i++) { translateVector[i] = amount; } AffineMatrix translateMatrix = new AffineMatrix(Format, RowCount); MatrixProcessor.Translate(translateMatrix, translateVector); Matrix result; if (order == MatrixOperationOrder.Append) { result = MatrixProcessor.Multiply(translateMatrix, this); } else { result = MatrixProcessor.Multiply(this, translateMatrix); } MatrixProcessor.SetMatrix(result, this); }
/// <summary> /// Scales the elements in the linear transformation by the given <paramref name="amount"/>. /// </summary> /// <param name="amount"> /// Amount of scale to apply uniformly in all dimensions. /// </param> /// <param name="order">The order to apply the transform in.</param> public virtual void Scale(DoubleComponent amount, MatrixOperationOrder order) { Vector scaleVector = new Vector(Format == MatrixFormat.ColumnMajor ? RowCount : ColumnCount); for (Int32 i = 0; i < scaleVector.ComponentCount; i++) { scaleVector[i] = amount; } Scale(scaleVector, MatrixOperationOrder.Default); }
public override void Scale(DoubleComponent amount, MatrixOperationOrder order) { Vector scaleVector = new Vector(RowCount - 1); for (Int32 i = 0; i < scaleVector.ComponentCount; i++) { scaleVector[i] = amount; } Scale(scaleVector, MatrixOperationOrder.Default); }
/// <summary> /// Rotates the affine transform around the given <paramref name="axis"/>. /// </summary> /// <param name="axis">The axis to rotate around.</param> /// <param name="radians">Angle to rotate through.</param> /// <param name="order">The order to apply the transform in.</param> public virtual void RotateAlong(Vector axis, Double radians, MatrixOperationOrder order) { throw new NotImplementedException(); }
void ITransformMatrix <DoubleComponent> .Shear(IVector <DoubleComponent> shearVector, MatrixOperationOrder order) { throw new NotImplementedException(); }
void ITransformMatrix <DoubleComponent> .RotateAlong(IVector <DoubleComponent> axis, Double radians, MatrixOperationOrder order) { throw new NotImplementedException(); }
/// <summary> /// Scales the matrix by the given vector <paramref name="scaleVector"/>. /// </summary> /// <param name="scaleVector"> /// A vector with scaling components which /// correspond to the affine transform dimensions. /// </param> /// <param name="order">Order in which to apply the operation.</param> void ITransformMatrix <DoubleComponent> .Scale(IVectorD scaleVector, MatrixOperationOrder order) { throw new NotSupportedException(); }
/// <summary> /// Scales the matrix by the given <paramref name="amount"/> in all orthoganal columns. /// </summary> /// <param name="amount">Amount to scale by.</param> /// <param name="order">Order in which to apply the operation.</param> void ITransformMatrix <DoubleComponent> .Scale(DoubleComponent amount, MatrixOperationOrder order) { throw new NotSupportedException(); }
/// <summary> /// Rotates the affine transform around the given <paramref name="axis"/> /// at the given <paramref name="point"/>. /// </summary> /// <param name="point">Point at which to compute the rotation.</param> /// <param name="axis">The axis to rotate around.</param> /// <param name="radians">Angle to rotate through.</param> /// <param name="order">Order in which to apply the operation.</param> void IAffineTransformMatrix <DoubleComponent> .RotateAt(IVectorD point, IVectorD axis, Double radians, MatrixOperationOrder order) { throw new NotSupportedException(); }
/// <summary> /// Translates the affine transform by the given translation vector. /// </summary> /// <param name="translateVector"> /// A vector whose components will translate the transform /// in the corresponding dimension. /// </param> /// <param name="order">Order in which to apply the operation.</param> void IAffineTransformMatrix <DoubleComponent> .Translate(IVectorD translateVector, MatrixOperationOrder order) { throw new NotSupportedException(); }
void IAffineTransformMatrix <DoubleComponent> .RotateAt(IVector <DoubleComponent> point, IVector <DoubleComponent> axis, double radians, MatrixOperationOrder order) { throw new NotImplementedException(); }
/// <summary> /// Rotates the affine transform around the given <paramref name="axis"/> at the given <paramref name="point"/>. /// </summary> /// <param name="point">Point at which to compute the rotation.</param> /// <param name="axis">The axis to rotate around. May be an addition of the basis vectors.</param> /// <param name="radians">Angle to rotate through.</param> /// <param name="order">The order to apply the transform in.</param> public void RotateAt(Vector point, Vector axis, Double radians, MatrixOperationOrder order) { throw new NotImplementedException(); }