Struct ModOp2D
A 2-dimensional modification operation implemented as a homogenous matix 3*2. You can apply such modificaion to GeoVector2D and GeoPoint2D points or to ICurve2D implementing objects.
Implements
Inherited Members
Namespace: CADability
Assembly: CADability.dll
Syntax
[Serializable]
public struct ModOp2D : ISerializable
Constructors
| Improve this Doc View SourceModOp2D(Double, Double, Double, Double, Double, Double)
Creates a modification according to the given coefficients
Declaration
public ModOp2D(double Matrix00, double Matrix01, double Matrix02, double Matrix10, double Matrix11, double Matrix12)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | Matrix00 | |
| System.Double | Matrix01 | |
| System.Double | Matrix02 | |
| System.Double | Matrix10 | |
| System.Double | Matrix11 | |
| System.Double | Matrix12 |
ModOp2D(Double[,])
Declaration
public ModOp2D(double[, ] m)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double[,] | m |
Properties
| Improve this Doc View SourceDeterminant
Gets the determinant of this modification
Declaration
public double Determinant { get; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Factor
Returns the scaling factor of this modification
Declaration
public double Factor { get; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Identity
Creates a modification which is the identity
Declaration
public static ModOp2D Identity { get; }
Property Value
| Type | Description |
|---|---|
| ModOp2D |
IsIdentity
Returns true, if this modification is the identity.
Declaration
public bool IsIdentity { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsIsogonal
Declaration
public bool IsIsogonal { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsNull
Declaration
public bool IsNull { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Item[Int32, Int32]
Declaration
public double this[int i, int j] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | i | |
| System.Int32 | j |
Property Value
| Type | Description |
|---|---|
| System.Double |
Matrix
Gets or sets the 3*2 Matrix that defines this mmodification
Declaration
public double[, ] Matrix { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double[,] |
Matrix2D
Declaration
public Matrix Matrix2D { get; }
Property Value
| Type | Description |
|---|---|
| System.Drawing.Drawing2D.Matrix | Returns the System.Drawing.Drawing2D.Matrix object equivalent to this modification. |
Null
Creates a modification which is null, i.e. no valid ModOp2D
Declaration
public static ModOp2D Null { get; }
Property Value
| Type | Description |
|---|---|
| ModOp2D |
Methods
| Improve this Doc View SourceFit(GeoPoint2D[], GeoPoint2D[], Boolean)
Constructs a modification, that transforms the Src points to the Dst points. The length of Src and Dst must be equal and less than 4. If the length is 1, the resulting ModOp is a translation, if the length is 2, the parameter DoScale decides whether the resulting ModOp is a translation and rotation (DoScale==false) or translation, rotation and scaling (DoScale==true). If the length is 3, the resulting modification is any kind of an affinity, that projects the src points to the dst points.
Declaration
public static ModOp2D Fit(GeoPoint2D[] Src, GeoPoint2D[] Dst, bool DoScale)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint2D[] | Src | source points |
| GeoPoint2D[] | Dst | destination points |
| System.Boolean | DoScale | scaling if two point pairs are given |
Returns
| Type | Description |
|---|---|
| ModOp2D | resulting transformation |
Fit(GeoVector2D[], GeoVector2D[])
Constructs a modification, that transforms the src vectors to the dst vectors. The length of src and dst must be 2. The resulting modification is any kind of an affinity, that projects the src vectors to the dst vectors. The origin (0,0) remains fixed.
Declaration
public static ModOp2D Fit(GeoVector2D[] src, GeoVector2D[] dst)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector2D[] | src | source vectors |
| GeoVector2D[] | dst | destination vectors |
Returns
| Type | Description |
|---|---|
| ModOp2D | resulting transformation |
GetInverse()
Returns the inverse of this modification.
Declaration
public ModOp2D GetInverse()
Returns
| Type | Description |
|---|---|
| ModOp2D | inverse |
IsAlmostIdentity(Double)
Declaration
public bool IsAlmostIdentity(double precision)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | precision |
Returns
| Type | Description |
|---|---|
| System.Boolean |
PlaneToplane(Plane, Plane)
Returns a 2d modification, that transforms from the coordinate system of the first plane to the coordinate system of the second plane. If the planes ar not coincident, the first plane is projected onto the second plane.
Declaration
public static ModOp2D PlaneToplane(Plane FromPlane, Plane ToPlane)
Parameters
| Type | Name | Description |
|---|---|---|
| Plane | FromPlane | Source plane |
| Plane | ToPlane | Destination plane |
Returns
| Type | Description |
|---|---|
| ModOp2D | See above |
Rotate(GeoPoint2D, SweepAngle)
Creates a rotation about a fixpoint
Declaration
public static ModOp2D Rotate(GeoPoint2D Center, SweepAngle Rotation)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint2D | Center | the fixpoint |
| SweepAngle | Rotation | the rotation angle |
Returns
| Type | Description |
|---|---|
| ModOp2D | resulting modification |
Rotate(SweepAngle)
Creates a rotation about the origin
Declaration
public static ModOp2D Rotate(SweepAngle Rotation)
Parameters
| Type | Name | Description |
|---|---|---|
| SweepAngle | Rotation | the rotation angle |
Returns
| Type | Description |
|---|---|
| ModOp2D | resulting modification |
Scale(GeoPoint2D, Double)
Declaration
public static ModOp2D Scale(GeoPoint2D center, double factor)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint2D | center | |
| System.Double | factor |
Returns
| Type | Description |
|---|---|
| ModOp2D |
Scale(GeoPoint2D, Double, Double)
Declaration
public static ModOp2D Scale(GeoPoint2D center, double factorx, double factory)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint2D | center | |
| System.Double | factorx | |
| System.Double | factory |
Returns
| Type | Description |
|---|---|
| ModOp2D |
Scale(Double)
Declaration
public static ModOp2D Scale(double factor)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | factor |
Returns
| Type | Description |
|---|---|
| ModOp2D |
Scale(Double, Double)
Declaration
public static ModOp2D Scale(double factorx, double factory)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | factorx | |
| System.Double | factory |
Returns
| Type | Description |
|---|---|
| ModOp2D |
To3D()
Declaration
public ModOp To3D()
Returns
| Type | Description |
|---|---|
| ModOp |
Translate(GeoVector2D)
Creates a translation
Declaration
public static ModOp2D Translate(GeoVector2D offset)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector2D | offset | offset vector |
Returns
| Type | Description |
|---|---|
| ModOp2D | resulting modification |
Translate(Double, Double)
Creates a translation
Declaration
public static ModOp2D Translate(double dx, double dy)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | dx | x-offset |
| System.Double | dy | y-offset |
Returns
| Type | Description |
|---|---|
| ModOp2D | resulting modification |
XYPart(ModOp)
Returns a 2d ModOp which represents the 2d part of a 3d ModOp.
Declaration
public static ModOp2D XYPart(ModOp m)
Parameters
| Type | Name | Description |
|---|---|---|
| ModOp | m | 3d ModOp |
Returns
| Type | Description |
|---|---|
| ModOp2D | 2d ModOp |
Operators
| Improve this Doc View SourceMultiply(ModOp2D, GeoPoint2D)
Modifies the given point by this modification.
Declaration
public static GeoPoint2D operator *(ModOp2D m, GeoPoint2D p)
Parameters
| Type | Name | Description |
|---|---|---|
| ModOp2D | m | modification |
| GeoPoint2D | p | point |
Returns
| Type | Description |
|---|---|
| GeoPoint2D | modified point |
Multiply(ModOp2D, GeoVector2D)
Modifies the given vector by this modification
Declaration
public static GeoVector2D operator *(ModOp2D m, GeoVector2D v)
Parameters
| Type | Name | Description |
|---|---|---|
| ModOp2D | m | modification |
| GeoVector2D | v | vector |
Returns
| Type | Description |
|---|---|
| GeoVector2D | modified vector |
Multiply(ModOp2D, ModOp2D)
Combines two modification into one modification. If two modifications have to be applied to several GeoPoint2Ds or GeoVector2Ds it is faster to use the combination.
Declaration
public static ModOp2D operator *(ModOp2D lhs, ModOp2D rhs)
Parameters
| Type | Name | Description |
|---|---|---|
| ModOp2D | lhs | second modification |
| ModOp2D | rhs | first modification |
Returns
| Type | Description |
|---|---|
| ModOp2D | the combination |
Multiply(ModOp2D, Double)
Multiplies the double value by the scaling factor of this modification
Declaration
public static double operator *(ModOp2D m, double d)
Parameters
| Type | Name | Description |
|---|---|---|
| ModOp2D | m | modification |
| System.Double | d | input value |
Returns
| Type | Description |
|---|---|
| System.Double | modified value |
Explicit Interface Implementations
| Improve this Doc View SourceISerializable.GetObjectData(SerializationInfo, StreamingContext)
Declaration
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Runtime.Serialization.SerializationInfo | info | |
| System.Runtime.Serialization.StreamingContext | context |