Table of Contents

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
ObjectBase
SerializableObjectBase
ManualSerialization
DocumentBase
EllipticRegion
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

ellipse Ellipse

EllipticRegion(EllipticRegion)

Copy constructor

public EllipticRegion(EllipticRegion ellipticRegion)

Parameters

ellipticRegion EllipticRegion

The 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

center VectorD

The center of the ellipse.

halfAxisX double

The half axis in x-direction.

halfAxisY double

The half axis in y-direction.

angle double

The angle between the halfAxisX and the x-axis.

boundaryIsInside bool

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

propertyOfCoordinatesX PhysicalProperty

Optional physical property of the x-coordinates (length by default).

propertyOfCoordinatesY PhysicalProperty

Optional physical property of the y-coordinates (length by default).

Properties

Angle

Gets the rotation angle in radians.

public double Angle { get; set; }

Property Value

double

Center

Gets the center of the ellipse.

public VectorD Center { get; set; }

Property Value

VectorD

HalfAxisX

The major half axis of the elliptic region.

public double HalfAxisX { get; set; }

Property Value

double

HalfAxisY

The minor half axis of the elliptic region.

public double HalfAxisY { get; set; }

Property Value

double

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

point VectorD

Point 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

center VectorD

The center of the ellipse.

size VectorD

The overall extension of the ellipse along the two principal axes of the ellipse (x- and y-axis for an unrotated ellipse).

angle double

The angle between the size.X and the x-axis.

boundaryIsInside bool

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

propertyOfCoordinatesX PhysicalProperty

Optional physical property of the x-coordinates (length by default).

propertyOfCoordinatesY PhysicalProperty

Optional 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

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)

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

angle double

The angle to rotate the polygon with (given in radian).

centerOfRotation VectorD

The 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

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

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

ellipse EllipticRegion

Ellipse to be scaled.

sizeOfRectangle VectorD

Size 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

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

Equality operator.

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

Parameters

o1 EllipticRegion

The first region.

o2 EllipticRegion

The second region.

Returns

bool

Whether the two regions are equal.

operator !=(EllipticRegion, EllipticRegion)

Inequality operator.

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

Parameters

o1 EllipticRegion

The first region.

o2 EllipticRegion

The second region.

Returns

bool

Whether the two regions are unequal.