Class EllipticRegion
- Namespace
- VirtualLabAPI.Core.Numerics.Region2D
- Assembly
- VirtualLabAPI.dll
Class which describes an elliptic region which may be situated at an arbitrary center and which may be rotated by an arbitrary angle.
[Serializable]
public class EllipticRegion : ElementaryRegion2D, ISerializable, IDeserializationCallback, IRegion1D2D, IDocument, IEquatable<IObjectBase>, IDisposable, ICloneable
- Inheritance
-
ObjectBaseSerializableObjectBaseManualSerializationDocumentBaseEllipticRegion
- Implements
-
IEquatable<IObjectBase>
- Inherited Members
- Extension Methods
Constructors
EllipticRegion()
Default constructor, creating a non-rotated ellipse of 10mm x 5mm (diameter in x and y) and centered at (0,0).
public EllipticRegion()
EllipticRegion(Ellipse)
Constructor which gets an (axis aligned, i.e. non-rotated) ellipse.
public EllipticRegion(Ellipse ellipse)
Parameters
ellipseEllipse
EllipticRegion(EllipticRegion)
Copy constructor
public EllipticRegion(EllipticRegion ellipticRegion)
Parameters
ellipticRegionEllipticRegionThe elliptic region to be copied.
EllipticRegion(VectorD, double, double, double, bool, PhysicalProperty, PhysicalProperty)
Constructor with all parameters including the half axes.
public EllipticRegion(VectorD center, double halfAxisX, double halfAxisY, double angle, bool boundaryIsInside = false, PhysicalProperty propertyOfCoordinatesX = PhysicalProperty.Length, PhysicalProperty propertyOfCoordinatesY = PhysicalProperty.Length)
Parameters
centerVectorDThe center of the ellipse.
halfAxisXdoubleThe half axis in x-direction.
halfAxisYdoubleThe half axis in y-direction.
angledoubleThe angle between the halfAxisX and the x-axis.
boundaryIsInsideboolFlag which says whether or not the boundary is part of the inner region or not.
propertyOfCoordinatesXPhysicalPropertyOptional physical property of the x-coordinates (length by default).
propertyOfCoordinatesYPhysicalPropertyOptional physical property of the y-coordinates (length by default).
Properties
Angle
Gets the rotation angle in radians.
public double Angle { get; set; }
Property Value
Center
Gets the center of the ellipse.
public VectorD Center { get; set; }
Property Value
HalfAxisX
The major half axis of the elliptic region.
public double HalfAxisX { get; set; }
Property Value
HalfAxisY
The minor half axis of the elliptic region.
public double HalfAxisY { get; set; }
Property Value
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>
Methods
CalculateAxisAlignedBoundingBox()
Method for (re)calculating the axis aligned bounding box.
public override void CalculateAxisAlignedBoundingBox()
CalculateDistanceOfPointToRegionBorder(VectorD)
Calculates the distance of a point to the border of this region.
public override double CalculateDistanceOfPointToRegionBorder(VectorD point)
Parameters
pointVectorDPoint to calculate the distance for.
Returns
- double
The distance of the given point to the border of this region
Clone()
Deep copy of the object.
public override object Clone()
Returns
- object
A deep copy of this.
EllipticRegionFromSize(VectorD, VectorD, double, bool, PhysicalProperty, PhysicalProperty)
Static constructor which constructs an ellipse from the overall size, not the half axes.
public static EllipticRegion EllipticRegionFromSize(VectorD center, VectorD size, double angle, bool boundaryIsInside = false, PhysicalProperty propertyOfCoordinatesX = PhysicalProperty.Length, PhysicalProperty propertyOfCoordinatesY = PhysicalProperty.Length)
Parameters
centerVectorDThe center of the ellipse.
sizeVectorDThe overall extension of the ellipse along the two principal axes of the ellipse (x- and y-axis for an unrotated ellipse).
angledoubleThe angle between the size.X and the x-axis.
boundaryIsInsideboolFlag which says whether or not the boundary is part of the inner region or not.
propertyOfCoordinatesXPhysicalPropertyOptional physical property of the x-coordinates (length by default).
propertyOfCoordinatesYPhysicalPropertyOptional physical property of the y-coordinates (length by default).
Returns
- EllipticRegion
The created ellipse
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)
Method for transforming a given elliptic region by rotating by an angle around a given rotation center.
public void Rotate(double angle, VectorD centerOfRotation)
Parameters
angledoubleThe angle to rotate the polygon with (given in radian).
centerOfRotationVectorDThe center to rotate the polygon around.
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).
ScaleToFitIntoRectangle(EllipticRegion, VectorD)
Static method for scaling a given ellipse for fitting into a rectangle who's size is given
public static EllipticRegion ScaleToFitIntoRectangle(EllipticRegion ellipse, VectorD sizeOfRectangle)
Parameters
ellipseEllipticRegionEllipse to be scaled.
sizeOfRectangleVectorDSize of the rectangle the ellipse has to fit in
Returns
- EllipticRegion
The scaled, fitting ellipse.
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 ==(EllipticRegion, EllipticRegion)
Equality operator.
public static bool operator ==(EllipticRegion o1, EllipticRegion o2)
Parameters
o1EllipticRegionThe first region.
o2EllipticRegionThe second region.
Returns
- bool
Whether the two regions are equal.
operator !=(EllipticRegion, EllipticRegion)
Inequality operator.
public static bool operator !=(EllipticRegion o1, EllipticRegion o2)
Parameters
o1EllipticRegionThe first region.
o2EllipticRegionThe second region.
Returns
- bool
Whether the two regions are unequal.