Table of Contents

Class ComposedRegion2D

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

Public class which defines a region composed by several subregions. These subregions are composed using logical operations like AND, OR, XOR, DIFF. Please note: The axis aligned bounding box cannot be determined exactly in every case.

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

Constructors

ComposedRegion2D()

Default constructor creating a new composed region, containing a single rectangular region. The composition mode is initialized as Union (OR).

public ComposedRegion2D()

ComposedRegion2D(List<Region2D>, LogicalOperationType, bool, PhysicalProperty, PhysicalProperty, bool)

Constructor getting all field parameters.

public ComposedRegion2D(List<Region2D> subRegions, LogicalOperationType compositionMode, bool boundariesAreInside = false, PhysicalProperty propertyOfCoordinatesX = PhysicalProperty.Length, PhysicalProperty propertyOfCoordinatesY = PhysicalProperty.Length, bool checkForIdenticalBoundingBoxes = false)

Parameters

subRegions List<Region2D>

Regions to be composed.

compositionMode LogicalOperationType

Mode for compositing the regions. There is only one mode allowed for this object. If more than one mode is needed, this object may be part of another ComposedRegion2D, using another composition mode.

boundariesAreInside bool

Flag which says whether or not the boundary is part of the inner region or not.

propertyOfCoordinatesX PhysicalProperty

Physical property of the x-coordinate.

propertyOfCoordinatesY PhysicalProperty

Physical property of the y-coordinate.

checkForIdenticalBoundingBoxes bool

If true, the subregion's axis aligned bounding boxes will be checked for being identical. If this is not the case, an ArgumentException will be thrown.

ComposedRegion2D(ComposedRegion2D)

Copy constructor.

public ComposedRegion2D(ComposedRegion2D composedRegion2D)

Parameters

composedRegion2D ComposedRegion2D

Composed region to be copied.

Properties

CompositionMode

The logical operation to be used as composition mode.

public LogicalOperationType CompositionMode { get; set; }

Property Value

LogicalOperationType

ParameterRunParameters

Gets all available parameters. For variable parameters (i.e. those double and int parameters which can be used in the Parameter Run, Parametric Optimization and so on) add a VaryParameterInfo object (derived from Parameter class) to the returned list.

public virtual List<Parameter> ParameterRunParameters { get; }

Property Value

List<Parameter>

SubRegions

Get or set the list of subregions (as read-only list).

public ReadOnlyCollection<Region2D> SubRegions { get; }

Property Value

ReadOnlyCollection<Region2D>

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.

ContainsNonEquidistantlySampledRegion()

Checks whether or not the composed region contains at least one non-equidistantly sampled subregion.

public bool ContainsNonEquidistantlySampledRegion()

Returns

bool

True, if the composed region contains at least one non-equidistantly sampled subregion. Otherwise false.

ContainsSampledRegion()

Checks whether or not the composed region contains at least one sampled subregion.

public bool ContainsSampledRegion()

Returns

bool

True, if the composed region contains at least one sampled subregion. Otherwise false.

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.

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.

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)

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

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

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 of possibly contained sampled regions.

interpolationMethod InterpolationMethod

Interpolation method to be used for the rotation of possibly contained sampled regions.

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

Exceptions

ArgumentException

Scaling of composed regions with keeping the center is not possible if the bounding box is not initialized.

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 ==(ComposedRegion2D, ComposedRegion2D)

Equality operator

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

Parameters

o1 ComposedRegion2D

The first region.

o2 ComposedRegion2D

The second region.

Returns

bool

Whether the two regions are equal.

operator !=(ComposedRegion2D, ComposedRegion2D)

Inequality operator.

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

Parameters

o1 ComposedRegion2D

The first region.

o2 ComposedRegion2D

The second region.

Returns

bool

Whether the two regions are equal.