Table of Contents

Class SampledRegion2D

Namespace
VirtualLabAPI.Core.Numerics.Region2D
Assembly
VirtualLabAPI.dll

Class which describes a region via sampled data. A data point marks its own small rectangular region as being 'inside' if its value is unequal zero.

[Serializable]
public class SampledRegion2D : Region2D, ISerializable, IDeserializationCallback, IRegion1D2D, IDocument, IEquatable<IObjectBase>, ICloneable, IDisposable
Inheritance
ObjectBase
SerializableObjectBase
ManualSerialization
DocumentBase
SampledRegion2D
Implements
IEquatable<IObjectBase>
Inherited Members
Extension Methods

Constructors

SampledRegion2D(bool)

Default constructor creating a default sampled RegionData object, if wanted.

public SampledRegion2D(bool initWithTemplateData)

Parameters

initWithTemplateData bool

If true, the sampled data will be initialized with template data.

SampledRegion2D(ComplexAmplitude)

Constructor getting an old signal region (represented by ComplexAmplitude) as parameter.

public SampledRegion2D(ComplexAmplitude signalRegion)

Parameters

signalRegion ComplexAmplitude

SampledRegion2D(DataArray2D)

Constructor which gets the sampled region data as data array.

public SampledRegion2D(DataArray2D regionData)

Parameters

regionData DataArray2D

Sampled region data to be set.

SampledRegion2D(Region2D, SamplingParameters, (bool centerX, bool centerY, bool nodeCentering))

Constructor converting a non-sampled region to a sampled one.

public SampledRegion2D(Region2D region, SamplingParameters sp, (bool centerX, bool centerY, bool nodeCentering) centerAroundZero)

Parameters

region Region2D

Region to be sampled

sp SamplingParameters

Sampling Parameters

centerAroundZero (bool centerX, bool centerY, bool nodeCentering)

If true, the sampled data will be centered around zero, otherwise the old region coordinates will be kept unchanged.

SampledRegion2D(SampledRegion2D)

Copy constructor.

public SampledRegion2D(SampledRegion2D regionToCopy)

Parameters

regionToCopy SampledRegion2D

SampledRegion2D to copy.

Properties

RegionData

Get or set the sampled region data. All values unequal zero will be interpreted as 'inside' the region. The other values will mark areas 'outside'.

public DataArray2D RegionData { get; }

Property Value

DataArray2D

Methods

CalculateAxisAlignedBoundingBox()

Method for (re)calculating the axis aligned bounding box.

public override void CalculateAxisAlignedBoundingBox()

Clone()

Deep copy of the object.

public override object Clone()

Returns

object

A deep copy of this.

Equals(object, EqualityIntent)

Determines whether the specified object is equal to this instance.

public override bool Equals(object obj, EqualityIntent equalityIntent)

Parameters

obj object
equalityIntent EqualityIntent

Defines what kind of equality you want to check when comparing two objects, for example all values or just physical equality.

Returns

bool

true if the specified object is equal to this instance; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

GetInOutRelation(VectorD, ExtrapolationInfo)

Method which checks whether or not a point lies inside or outside the 2D region or on its boundary. A data point marks its own small rectangular region as being 'inside' if its value is unequal zero.

public override InsideOutside GetInOutRelation(VectorD point, ExtrapolationInfo extrapolation2use = null)

Parameters

point VectorD

The point to be checked whether it lies inside.

extrapolation2use ExtrapolationInfo

Extrapolation info actually to be used.

Returns

InsideOutside

Information where the point lies in relation to the region.

GetRegionDataRestrictions()

Method which gets the restrictions which apply to the RegionData object.

public static DataArray2DRestrictions GetRegionDataRestrictions()

Returns

DataArray2DRestrictions

The restrictions which apply to the RegionData object.

InOutRelationForBorderPixelOfComposedRegion(VectorD, RectanglePhysical)

If a sampled region is used inside a composed region, we may need a special handling for the border pixels (i.e. near a given bounding box). See ITN.064 for more information on the mode 'border continuation'.

public InsideOutside InOutRelationForBorderPixelOfComposedRegion(VectorD point, RectanglePhysical boundingBoxOfParentComposedRegion)

Parameters

point VectorD

Point near the borders of a given bounding box.

boundingBoxOfParentComposedRegion RectanglePhysical

Bounding box of the parenting composed region.

Returns

InsideOutside

The InOut-relation for the given point.

MayBeNonzeroOutside(out bool, out bool, out bool, out bool)

Method which determines whether or not the region can provide "inside" state outside of its boundary interval. This is not the case for extrapolation mode 'ConstantZero', of course.

public override void MayBeNonzeroOutside(out bool maybeNonZeroLeft, out bool maybeNonZeroRight, out bool maybeNonZeroBottom, out bool maybeNonZeroTop)

Parameters

maybeNonZeroLeft bool

True, if there may be nonzero values left of the bounding box.

maybeNonZeroRight bool

True, if there may be nonzero values right of the bounding box.

maybeNonZeroBottom bool

True, if there may be nonzero values below the bottom of the bounding box.

maybeNonZeroTop bool

True, if there may be nonzero values above the top of the bounding box.

Rotate(double, VectorD, Vector, InterpolationMethod, bool)

Method for transforming a given sampled region by rotating by an angle around a given rotation center.

public void Rotate(double angle, VectorD centerOfRotation, Vector newSamplingPoints, InterpolationMethod interpolationMethod, bool considerExtrapolation)

Parameters

angle double

The angle to rotate the polygon with (given in radian).

centerOfRotation VectorD

The center to rotate the polygon around.

newSamplingPoints Vector

Number of sampling points in the rotated data.

interpolationMethod InterpolationMethod

Interpolation method to be used for rotating.

considerExtrapolation bool

If true, extrapolated values will be rotated into the result if angle is no integer multiple of ±π/2.

ScaleByFactors(VectorD, bool)

Scales the region by the given factor.

public override void ScaleByFactors(VectorD factors, bool keepCenter)

Parameters

factors VectorD

The scaling factors for both x- and y-direction.

keepCenter bool

Whether the center of the region remains unchanged (true) or is scaled by the same factors (false).

SetRegionData(DataArray2D, bool, bool)

Sets the sampled region data.

public void SetRegionData(DataArray2D regionData2bSet, bool cloneData, bool enforceValidity)

Parameters

regionData2bSet DataArray2D

Sampled data to be set. The data array has to fulfill some restrictions defined in the static method GetRegionDataRestrictions().

cloneData bool

If true, the regionData2bSet will be cloned first. This is also the case if regionData2bSet has wrong precision or doesn't fulfill the restrictions.

enforceValidity bool

If true, a data array not fulfilling the restrictions will be adapted so it does. if false, a data array not fulfilling the restrictions will cause an ArgumentException.

Shift(VectorD)

Shifts this region by the given vector.

public override void Shift(VectorD shift)

Parameters

shift VectorD

The shift added to the current position of the region.

UpdatePropertyOfCoordinates()

Method for handling update after change of the physical property of the coordinate

public override void UpdatePropertyOfCoordinates()

Operators

operator ==(SampledRegion2D, SampledRegion2D)

Equals operator

public static bool operator ==(SampledRegion2D o1, SampledRegion2D o2)

Parameters

o1 SampledRegion2D

The first sampled region to compare

o2 SampledRegion2D

The second sampled region to compare

Returns

bool

true if both objects have equal data.

operator !=(SampledRegion2D, SampledRegion2D)

Inequality operator.

public static bool operator !=(SampledRegion2D o1, SampledRegion2D o2)

Parameters

o1 SampledRegion2D

The first sampled region to compare

o2 SampledRegion2D

The second sampled region to compare

Returns

bool

true if both objects have unequal data.