Show / Hide Table of Contents

Struct ModOp

A 3-dimensional modification operation implemented as a homogenous matrix 4*3. You can apply such a modification to GeoPoints or GeoVectors or you can use it for GeoObjects Modify(ModOp). If you want to move, rotate, scale reflect or generally modify a GeoObject you will need this class. Use the static methods to create ModOps that do a required modification (like CADability.ModOp.Rotate(System.Int32,CADability.SweepAngle), Translate(Double, Double, Double) etc.

Implements
System.Runtime.Serialization.ISerializable
IJsonSerialize
Inherited Members
System.ValueType.Equals(System.Object)
System.ValueType.GetHashCode()
System.ValueType.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: CADability
Assembly: CADability.dll
Syntax
[Serializable]
[JsonVersion(serializeAsStruct = true, version = 1)]
public struct ModOp : ISerializable, IJsonSerialize

Constructors

| Improve this Doc View Source

ModOp(IJsonReadStruct)

Declaration
public ModOp(IJsonReadStruct data)
Parameters
Type Name Description
IJsonReadStruct data
| Improve this Doc View Source

ModOp(Double, Double, Double, Double, Double, Double, Double, Double, Double, Double, Double, Double)

Creates a modification according to the given coefficients

Declaration
public ModOp(double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23)
Parameters
Type Name Description
System.Double m00
System.Double m01
System.Double m02
System.Double m03
System.Double m10
System.Double m11
System.Double m12
System.Double m13
System.Double m20
System.Double m21
System.Double m22
System.Double m23
| Improve this Doc View Source

ModOp(Double[,])

Declaration
public ModOp(double[, ] m)
Parameters
Type Name Description
System.Double[,] m
| Improve this Doc View Source

ModOp(Double[,], GeoVector)

Declaration
public ModOp(double[, ] m, GeoVector trans)
Parameters
Type Name Description
System.Double[,] m
GeoVector trans

Properties

| Improve this Doc View Source

Determinant

Returns the determinant of the matrix of this modification.

Declaration
public double Determinant { get; }
Property Value
Type Description
System.Double
| Improve this Doc View Source

Factor

Gets the scaling factor if appropriate

Declaration
public double Factor { get; }
Property Value
Type Description
System.Double
| Improve this Doc View Source

Identity

Creates a modification that leaves everything unchanged.

Declaration
public static ModOp Identity { get; }
Property Value
Type Description
ModOp
| Improve this Doc View Source

IsIsogonal

Same as IsOrthogonal but with scaling allowed

Declaration
public bool IsIsogonal { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsNull

Returns true for ModOps that are 0.0 in all components. Uninitialized ModOp objects will return true. Usually used for a test, whether it has been initialized, since a 0 ModOp shouldn't occur in normal circumstances.

Declaration
public bool IsNull { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsOrthogonal

Returns true if orthogonal vectors stay orthogonal after transformation and no scaling is performed

Declaration
public bool IsOrthogonal { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

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
| Improve this Doc View Source

Matrix

Gets or sets the Matrix that defines this mmodification

Declaration
public double[, ] Matrix { get; set; }
Property Value
Type Description
System.Double[,]
| Improve this Doc View Source

Mode

Gets the kind of operation this ModOp performs.

Declaration
public ModOp.ModificationMode Mode { get; }
Property Value
Type Description
ModOp.ModificationMode
| Improve this Doc View Source

Null

Creates a modification that makes everythin to 0

Declaration
public static ModOp Null { get; }
Property Value
Type Description
ModOp
| Improve this Doc View Source

Oriented

Gets the orientation of this ModOp. True means orientation is preserved (e.g. lefthanded yields lefthanded), false means orientation is reversed (lefthanded yields righthanded and vice versa) when this ModOp is applied to vectors.

Declaration
public bool Oriented { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

Translation

Returns the translation vector of this ModOp

Declaration
public GeoVector Translation { get; set; }
Property Value
Type Description
GeoVector

Methods

| Improve this Doc View Source

Fit(GeoPoint, GeoVector[], GeoPoint, GeoVector[])

Declaration
public static ModOp Fit(GeoPoint srcLoc, GeoVector[] src, GeoPoint dstLoc, GeoVector[] dst)
Parameters
Type Name Description
GeoPoint srcLoc
GeoVector[] src
GeoPoint dstLoc
GeoVector[] dst
Returns
Type Description
ModOp
| Improve this Doc View Source

Fit(GeoPoint[], GeoPoint[], Boolean)

Constructs a ModOp, that transforms the Src points to the Dst points. The length of Src and Dst must be equal and less than 5. 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 or 4, the resulting ModOp is any kind of an affinity, that projects the src points to the dst points.

Declaration
public static ModOp Fit(GeoPoint[] Src, GeoPoint[] Dst, bool DoScale)
Parameters
Type Name Description
GeoPoint[] Src

source points

GeoPoint[] Dst

destination points

System.Boolean DoScale

scaling if two point pairs are given

Returns
Type Description
ModOp

resulting transformation

| Improve this Doc View Source

GetInverse()

Returns the inverse of this modification.

Declaration
public ModOp GetInverse()
Returns
Type Description
ModOp

inverse

| Improve this Doc View Source

ReflectPlane()

Constructs a ModOp, that performs a reflection about the y/z plane

Declaration
public static ModOp ReflectPlane()
Returns
Type Description
ModOp

resulting transformation

| Improve this Doc View Source

ReflectPlane(Plane)

Constructs a ModOp, that performs a reflection about the given plane

Declaration
public static ModOp ReflectPlane(Plane pln)
Parameters
Type Name Description
Plane pln

plane for reflection

Returns
Type Description
ModOp

resulting transformation

| Improve this Doc View Source

ReflectPoint(GeoPoint)

Constructs a ModOp, that performs a reflection about the given point

Declaration
public static ModOp ReflectPoint(GeoPoint center)
Parameters
Type Name Description
GeoPoint center
Returns
Type Description
ModOp

resulting transformation

| Improve this Doc View Source

Rotate(GeoPoint, GeoVector, GeoVector)

Creates a rotation around the fixpoint that moves the vector from to the vector to.

Declaration
public static ModOp Rotate(GeoPoint fixPoint, GeoVector from, GeoVector to)
Parameters
Type Name Description
GeoPoint fixPoint
GeoVector from

Source vector

GeoVector to

Destination vector

Returns
Type Description
ModOp

The modification that performs the rotation

| Improve this Doc View Source

Rotate(GeoPoint, GeoVector, SweepAngle)

Creates a modification that performs a rotation about an axis through the given point

Declaration
public static ModOp Rotate(GeoPoint FixPoint, GeoVector Axis, SweepAngle Rotation)
Parameters
Type Name Description
GeoPoint FixPoint

point on the axis

GeoVector Axis

direction of the axis

SweepAngle Rotation

rotation angle

Returns
Type Description
ModOp

the resulting modification

| Improve this Doc View Source

Rotate(GeoVector, SweepAngle)

Creates a modification that performs a rotation about an axis through the origina

Declaration
public static ModOp Rotate(GeoVector Axis, SweepAngle Rotation)
Parameters
Type Name Description
GeoVector Axis

direction of the axis

SweepAngle Rotation

rotation angle

Returns
Type Description
ModOp

the resulting modification

| Improve this Doc View Source

Rotate(GeoVector, Double, Double)

Declaration
public static ModOp Rotate(GeoVector Axis, double sin, double cos)
Parameters
Type Name Description
GeoVector Axis
System.Double sin
System.Double cos
Returns
Type Description
ModOp
| Improve this Doc View Source

Scale(GeoPoint, GeoVector, Double)

Creates a modification that performs a scaling in a given direction with a fixpoint

Declaration
public static ModOp Scale(GeoPoint FixPoint, GeoVector Direction, double Factor)
Parameters
Type Name Description
GeoPoint FixPoint

fixpoint for the scaling

GeoVector Direction

direction for the scaling

System.Double Factor

scaling factor for the given direction

Returns
Type Description
ModOp

the resulting modification

| Improve this Doc View Source

Scale(GeoPoint, Double)

Creates a modification that performs a scaling about a given point

Declaration
public static ModOp Scale(GeoPoint FixPoint, double Factor)
Parameters
Type Name Description
GeoPoint FixPoint

fixpoint for the scaling

System.Double Factor

scaling factor

Returns
Type Description
ModOp

the resulting modification

| Improve this Doc View Source

Scale(GeoVector, Double)

Creates a modification that performs a scaling in a given direction

Declaration
public static ModOp Scale(GeoVector Direction, double Factor)
Parameters
Type Name Description
GeoVector Direction

direction for the scaling

System.Double Factor

scaling factor for the given direction

Returns
Type Description
ModOp

the resulting modification

| Improve this Doc View Source

Scale(Double)

Creates a modification that performs a scaling about the origin

Declaration
public static ModOp Scale(double Factor)
Parameters
Type Name Description
System.Double Factor

scaling factor

Returns
Type Description
ModOp

the resulting modification

| Improve this Doc View Source

Scale(Double, Double, Double)

Creates a modification that performs a scaling with different factors in x,y and z direction

Declaration
public static ModOp Scale(double FactorX, double FactorY, double FactorZ)
Parameters
Type Name Description
System.Double FactorX

scaling in the direction of the x-axis

System.Double FactorY

scaling in the direction of the y-axis

System.Double FactorZ

scaling in the direction of the z-axis

Returns
Type Description
ModOp

the resulting modification

| Improve this Doc View Source

To2D()

Declaration
public ModOp2D To2D()
Returns
Type Description
ModOp2D
| Improve this Doc View Source

ToMatrix()

Declaration
public Matrix ToMatrix()
Returns
Type Description
MathNet.Numerics.LinearAlgebra.Double.Matrix
| Improve this Doc View Source

Transform(CoordSys, CoordSys)

Constructs a ModOp, that maps the Src coordinate system to the Dst coordinate system

Declaration
public static ModOp Transform(CoordSys Src, CoordSys Dst)
Parameters
Type Name Description
CoordSys Src

source coordinate system

CoordSys Dst

destination coordinate system

Returns
Type Description
ModOp

resulting transformation

| Improve this Doc View Source

Translate(GeoVector)

Constructs a ModOp, that performs a translation by the given offset vector

Declaration
public static ModOp Translate(GeoVector offset)
Parameters
Type Name Description
GeoVector offset

offset vector

Returns
Type Description
ModOp

resulting transformation

| Improve this Doc View Source

Translate(Double, Double, Double)

Constructs a ModOp, that performs a translation by the given offsets

Declaration
public static ModOp Translate(double dx, double dy, double dz)
Parameters
Type Name Description
System.Double dx

offset in direction of the x-axis

System.Double dy

offset in direction of the y-axis

System.Double dz

offset in direction of the z-axis

Returns
Type Description
ModOp

resulting transformation

Operators

| Improve this Doc View Source

Multiply(ModOp, GeoPoint)

Modifies the given point by this modification.

Declaration
public static GeoPoint operator *(ModOp m, GeoPoint p)
Parameters
Type Name Description
ModOp m

modification

GeoPoint p

point

Returns
Type Description
GeoPoint

modified point

| Improve this Doc View Source

Multiply(ModOp, GeoPoint2D)

Modifies the given 2d point by this modification. The point is assumed in the x/y plane

Declaration
public static GeoPoint operator *(ModOp m, GeoPoint2D p)
Parameters
Type Name Description
ModOp m

modification

GeoPoint2D p

point

Returns
Type Description
GeoPoint

modified point

| Improve this Doc View Source

Multiply(ModOp, GeoVector)

Modifies the given vector by this modification

Declaration
public static GeoVector operator *(ModOp m, GeoVector v)
Parameters
Type Name Description
ModOp m

modification

GeoVector v

vector

Returns
Type Description
GeoVector

modified vector

| Improve this Doc View Source

Multiply(ModOp, GeoVector2D)

Modifies the given 2d vector by this modification, The vector is assumed in the x/y plane

Declaration
public static GeoVector operator *(ModOp m, GeoVector2D v)
Parameters
Type Name Description
ModOp m

modification

GeoVector2D v

vector

Returns
Type Description
GeoVector

modified vector

| Improve this Doc View Source

Multiply(ModOp, ModOp)

Combines two modification into one modification. If two modifications have to be applied to several GeoPoints or GeoVectors or to IGeoObjects it is faster to use the combination.

Declaration
public static ModOp operator *(ModOp lhs, ModOp rhs)
Parameters
Type Name Description
ModOp lhs

second modification

ModOp rhs

first modification

Returns
Type Description
ModOp

the combination

| Improve this Doc View Source

Multiply(ModOp, Plane)

Declaration
public static Plane operator *(ModOp m, Plane pln)
Parameters
Type Name Description
ModOp m
Plane pln
Returns
Type Description
Plane
| Improve this Doc View Source

Multiply(ModOp, Double)

Multiplies the double value by the scaling factor of this modification

Declaration
public static double operator *(ModOp m, double d)
Parameters
Type Name Description
ModOp m

modification

System.Double d

input value

Returns
Type Description
System.Double

modified value

Explicit Interface Implementations

| Improve this Doc View Source

IJsonSerialize.GetObjectData(IJsonWriteData)

Declaration
void IJsonSerialize.GetObjectData(IJsonWriteData data)
Parameters
Type Name Description
IJsonWriteData data
| Improve this Doc View Source

IJsonSerialize.SetObjectData(IJsonReadData)

Declaration
void IJsonSerialize.SetObjectData(IJsonReadData data)
Parameters
Type Name Description
IJsonReadData data
| Improve this Doc View Source

ISerializable.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

Implements

System.Runtime.Serialization.ISerializable
IJsonSerialize
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX