Table of Contents

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

toHor double

Angle (in radians) by which the shape was rotated to make its longest segment horizontal

values double[][]

For each cutting line the parameter intervals (pairs of values 0 to 1) inside the shape, as returned by Clip(ICurve2D, bool)

length double

Total length of the outline and all holes

Signature(SerializationInfo, StreamingContext)

Constructor required by the binary deserialization (ISerializable).

protected Signature(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

SerializationInfo

context StreamingContext

StreamingContext

Methods

isEqual(Signature, out bool, double)

Compares two signatures: all cut intervals must agree within precision (relative values, 0 to

  1. and the total lengths within twice that. The cuts are also compared mirrored, so a reflected shape matches as well; reflect then 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

other CompoundShape.Signature

The signature to compare with

reflect bool

true if the shapes match only with a reflection

precision double

Maximum difference of the (relative) cut values

Returns

bool

true if the signatures are equal