Class CompoundShape.Signature
- Namespace
- CADability.Shapes
- Assembly
- CADability.dll
A compact description of a SimpleShape that is invariant under rotation and translation, used to find congruent shapes quickly: the shape is rotated so that its longest outline segment is horizontal and cut with a few horizontal and vertical lines; the parameter intervals inside the shape on these lines, the rotation angle and the total length of the borders are stored. Created by CalculateSignature(), compared with isEqual(Signature, out bool, double) and verified with isCongruent(SimpleShape, Signature, out ModOp2D, double).
public class CompoundShape.Signature : ISerializable
- Inheritance
-
CompoundShape.Signature
- Implements
- Inherited Members
Constructors
Signature(double, double[][], double)
Creates a signature from its components; normally only CalculateSignature() does this.
public Signature(double toHor, double[][] values, double length)
Parameters
toHordoubleAngle (in radians) by which the shape was rotated to make its longest segment horizontal
valuesdouble[][]For each cutting line the parameter intervals (pairs of values 0 to 1) inside the shape, as returned by Clip(ICurve2D, bool)
lengthdoubleTotal length of the outline and all holes
Signature(SerializationInfo, StreamingContext)
Constructor required by the binary deserialization (ISerializable).
protected Signature(SerializationInfo info, StreamingContext context)
Parameters
infoSerializationInfoSerializationInfo
contextStreamingContextStreamingContext
Methods
isEqual(Signature, out bool, double)
Compares two signatures: all cut intervals must agree within precision (relative values, 0 to
- and the total lengths within twice that. The cuts are also compared mirrored, so a reflected shape matches as
well;
reflectthen reports that a reflection is needed. Equal signatures do not guarantee congruent shapes, they only make it likely; isCongruent(SimpleShape, Signature, out ModOp2D, double) verifies it.
public bool isEqual(CompoundShape.Signature other, out bool reflect, double precision)
Parameters
otherCompoundShape.SignatureThe signature to compare with
reflectbooltrue if the shapes match only with a reflection
precisiondoubleMaximum difference of the (relative) cut values
Returns
- bool
true if the signatures are equal