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
-
ObjectBaseSerializableObjectBaseManualSerializationDocumentBaseComposedRegion2D
- 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
subRegionsList<Region2D>Regions to be composed.
compositionModeLogicalOperationTypeMode 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.
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.
checkForIdenticalBoundingBoxesboolIf
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
composedRegion2DComposedRegion2DComposed 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
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. Otherwisefalse.
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. Otherwisefalse.
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 override 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.
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
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.
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
angledoubleThe angle to rotate the polygon with (given in radian).
centerOfRotationVectorDThe center to rotate the polygon around.
newSamplingPointsVectorNumber of sampling points in the rotated data of possibly contained sampled regions.
interpolationMethodInterpolationMethodInterpolation 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
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).
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
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 override void UpdatePropertyOfCoordinates()
Operators
operator ==(ComposedRegion2D, ComposedRegion2D)
Equality operator
public static bool operator ==(ComposedRegion2D o1, ComposedRegion2D o2)
Parameters
o1ComposedRegion2DThe first region.
o2ComposedRegion2DThe second region.
Returns
- bool
Whether the two regions are equal.
operator !=(ComposedRegion2D, ComposedRegion2D)
Inequality operator.
public static bool operator !=(ComposedRegion2D o1, ComposedRegion2D o2)
Parameters
o1ComposedRegion2DThe first region.
o2ComposedRegion2DThe second region.
Returns
- bool
Whether the two regions are equal.