Table of Contents

Class Region2D

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

Class that describes a 2D region.

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

Constructors

Region2D(bool, PhysicalProperty, PhysicalProperty)

Constructor which gets the _boundariesAreInside flag. To be called from derived classes constructors.

public Region2D(bool boundariesAreInside, PhysicalProperty propertyOfCoordinatesX = PhysicalProperty.Length, PhysicalProperty propertyOfCoordinatesY = PhysicalProperty.Length)

Parameters

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.

Region2D(Region2D)

Copy constructor.

public Region2D(Region2D region2bCopied)

Parameters

region2bCopied Region2D

The region to be copied.

Fields

DefaultDocumentName

The default document name (= type description) for an Order Collection.

public const string DefaultDocumentName = "Region"

Field Value

string

FileExtensionString

The file extension for an Order Collection.

public const string FileExtensionString = "rgn"

Field Value

string

Properties

AxisAlignedBoundingBox

Gets the bounding box for the 2D region. Its sides are parallel to the x- and y-axis resp.

public RectanglePhysical AxisAlignedBoundingBox { get; }

Property Value

RectanglePhysical

BoundariesAreInside

Gets or sets whether or not the boundaries of the region belong to the inner region.

public bool BoundariesAreInside { get; set; }

Property Value

bool

CommentOfCoordinates_X

Gets and sets the comment for the x-coordinates.

public string CommentOfCoordinates_X { get; set; }

Property Value

string

CommentOfCoordinates_Y

Gets and sets the comment for the y-coordinates.

public string CommentOfCoordinates_Y { get; set; }

Property Value

string

CommonMeasuredQuantityOfCoordinates

The measured quantity of the coordinate axis (for 1D regions) or axes (2D regions). Can be null in case of 2D regions with two different measured quantities.

public MeasuredQuantity? CommonMeasuredQuantityOfCoordinates { get; }

Property Value

MeasuredQuantity

ExtrapolationHandling

The extrapolation mode for this region. See ITN.064 for more information on the mode 'border continuation'.

public ExtrapolationInfo ExtrapolationHandling { get; set; }

Property Value

ExtrapolationInfo

IsOneD

Gets whether this IRegion1D2D is 1D or 2D

public bool IsOneD { get; }

Property Value

bool

Name

The name which can be given to the region by the user.

public string Name { get; set; }

Property Value

string

PropertyOfCoordinatesX

Physical property of the x-coordinates of the region

public PhysicalProperty PropertyOfCoordinatesX { get; set; }

Property Value

PhysicalProperty

PropertyOfCoordinatesY

Physical property of the y-coordinates of the region

public PhysicalProperty PropertyOfCoordinatesY { get; set; }

Property Value

PhysicalProperty

RegionType

Gets the type of the region

public Region2DType RegionType { get; }

Property Value

Region2DType

Methods

CalculateAxisAlignedBoundingBox()

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

[MemberNotNull("_axisAlignedBoundingBox")]
public abstract void CalculateAxisAlignedBoundingBox()

Clone()

Clones the current object.

public override object Clone()

Returns

object

Deep copy of this object.

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

GetInOutRelationForPeriodicRegions(VectorD)

Help method for determining the 'inside' state for a periodic region.

protected InsideOutside GetInOutRelationForPeriodicRegions(VectorD point)

Parameters

point VectorD

The point to be checked whether it lies inside.

Returns

InsideOutside

Information where the point lies in relation to the region.

InvertRegion(Region2D)

Creates a new region with inverted in / out regions compared to this.

public static Region2D InvertRegion(Region2D region2Invert)

Parameters

region2Invert Region2D

Region to be inverted.

Returns

Region2D

A new region with inverted in / out regions compared to this.

IsInside(double, double)

Method which checks whether or not a point is inside the 2D region.

public bool IsInside(double pointX, double pointY)

Parameters

pointX double

The x-coordinate of the point to be checked whether it lies inside.

pointY double

The y-coordinate of the point to be checked whether it lies inside.

Returns

bool

true if point lies inside the 2D region.

IsInside(VectorD)

Method which checks whether or not a point is inside the 2D region.

public bool IsInside(VectorD point)

Parameters

point VectorD

The point to be checked whether it lies inside.

Returns

bool

true if point lies inside the 2D region.

Load(string)

Loads the specified file name. Works independently from whether the document has been saved without view settings (as prior to VL 6.0) or with view settings.

public static Region2D Load(string fileName)

Parameters

fileName string

Name of the file.

Returns

Region2D

The specified document.

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

ScaleByFactor(double, bool)

Scales the region by the given factor. The center of the region remains unchanged.

public void ScaleByFactor(double factor, bool keepCenter)

Parameters

factor double

The scaling factor (used for both x- and y-direction for 2D regions).

keepCenter bool

Whether the center of the region is kept (true) or scaled by the same factor (false).

ScaleByFactors(VectorD, bool)

Scales the region by the given factor.

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

Shift(VectorD)

Shifts this region by the given vector.

public abstract 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 virtual void UpdatePropertyOfCoordinates()

checkScalingFactors(VectorD)

Method to check that the scaling factors are greater than zero and whether scaling is necessary.

protected bool checkScalingFactors(VectorD factors)

Parameters

factors VectorD

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

Returns

bool

Whether scaling is necessary. (false if both scaling factors are numerically equal to 1.

Exceptions

ArgumentException

Scaling factor has to be greater than 0.

Operators

operator ==(Region2D, Region2D)

Equality operator

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

Parameters

o1 Region2D

The first region.

o2 Region2D

The second region.

Returns

bool

Whether the two regions are equal.

operator !=(Region2D, Region2D)

Inequality operator.

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

Parameters

o1 Region2D

The first region.

o2 Region2D

The second region.

Returns

bool

Whether the two regions are unequal.