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
-
ObjectBaseSerializableObjectBaseManualSerializationDocumentBaseRegion2D
- 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
boundariesAreInsideboolFlag which says whether or not the boundary is part of the inner region or not.
propertyOfCoordinatesXPhysicalPropertyPhysical property of the x-coordinate.
propertyOfCoordinatesYPhysicalPropertyPhysical property of the y-coordinate.
Region2D(Region2D)
Copy constructor.
public Region2D(Region2D region2bCopied)
Parameters
region2bCopiedRegion2DThe region to be copied.
Fields
DefaultDocumentName
The default document name (= type description) for an Order Collection.
public const string DefaultDocumentName = "Region"
Field Value
FileExtensionString
The file extension for an Order Collection.
public const string FileExtensionString = "rgn"
Field Value
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
BoundariesAreInside
Gets or sets whether or not the boundaries of the region belong to the inner region.
public bool BoundariesAreInside { get; set; }
Property Value
CommentOfCoordinates_X
Gets and sets the comment for the x-coordinates.
public string CommentOfCoordinates_X { get; set; }
Property Value
CommentOfCoordinates_Y
Gets and sets the comment for the y-coordinates.
public string CommentOfCoordinates_Y { get; set; }
Property Value
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
IsOneD
Gets whether this IRegion1D2D is 1D or 2D
public bool IsOneD { get; }
Property Value
Name
The name which can be given to the region by the user.
public string Name { get; set; }
Property Value
PropertyOfCoordinatesX
Physical property of the x-coordinates of the region
public PhysicalProperty PropertyOfCoordinatesX { get; set; }
Property Value
PropertyOfCoordinatesY
Physical property of the y-coordinates of the region
public PhysicalProperty PropertyOfCoordinatesY { get; set; }
Property Value
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
objobjectequalityIntentEqualityIntentDefines what kind of equality you want to check when comparing two objects, for example all values or just physical equality.
Returns
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
pointVectorDThe point to be checked whether it lies inside.
extrapolation2useExtrapolationInfoExtrapolation 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
pointVectorDThe 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
region2InvertRegion2DRegion 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
pointXdoubleThe x-coordinate of the point to be checked whether it lies inside.
pointYdoubleThe y-coordinate of the point to be checked whether it lies inside.
Returns
- bool
trueif 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
pointVectorDThe point to be checked whether it lies inside.
Returns
- bool
trueif 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
fileNamestringName 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
maybeNonZeroLeftboolTrue, if there may be nonzero values left of the bounding box.maybeNonZeroRightboolTrue, if there may be nonzero values right of the bounding box.maybeNonZeroBottomboolTrue, if there may be nonzero values below the bottom of the bounding box.maybeNonZeroTopboolTrue, 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
factordoubleThe scaling factor (used for both x- and y-direction for 2D regions).
keepCenterboolWhether 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
factorsVectorDThe scaling factors for both x- and y-direction.
keepCenterboolWhether 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
shiftVectorDThe 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
factorsVectorDThe scaling factors for both x- and y-direction.
Returns
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
Returns
- bool
Whether the two regions are equal.
operator !=(Region2D, Region2D)
Inequality operator.
public static bool operator !=(Region2D o1, Region2D o2)
Parameters
Returns
- bool
Whether the two regions are unequal.