Struct Hyperrectangle
Hyperrectangle structure.
Namespace: Mars.Common
Assembly: Mars.Common.dll
Syntax
public struct Hyperrectangle : ICloneable, IEquatable<Hyperrectangle>, IFormattable
Remarks
In geometry, an n-orthotope (also called a hyperrectangle or a box) is the generalization of a rectangle for higher dimensions, formally defined as the Cartesian product of intervals.
References:
- Wikipedia contributors, "Hyperrectangle," Wikipedia, The Free Encyclopedia, https://en.wikipedia.org/w/index.php?title=Hyperrectangle
Constructors
Hyperrectangle(Double, Double, Double, Double)
Initializes a new instance of the Hyperrectangle struct.
Declaration
public Hyperrectangle(double x, double y, double width, double height)
Parameters
Type | Name | Description |
---|---|---|
System.Double | x | The x-coordinate of the lower-left corner of the rectangle.. |
System.Double | y | The y-coordinate of the lower-left corner of the rectangle. |
System.Double | width | The width of the rectangle. |
System.Double | height | The height of the rectangle. |
Hyperrectangle(Double[], Double[], Boolean)
Initializes a new instance of the Hyperrectangle struct.
Declaration
public Hyperrectangle(double[] min, double[] max, bool copy = true)
Parameters
Type | Name | Description |
---|---|---|
System.Double[] | min | The minimum point in the hyperrectangle (the lower bound). |
System.Double[] | max | The maximum point in the hyperrectangle (the upper bound). |
System.Boolean | copy | Whether the passed vectors should be copied into this instance or used as-is. Default is true (elements from the given vectors will be copied into new array instances). |
Properties
Max
Gets the maximum point defining the upper bound of the hyperrectangle.
Declaration
public double[] Max { get; }
Property Value
Type | Description |
---|---|
System.Double[] |
Min
Gets the minimum point defining the lower bound of the hyperrectangle.
Declaration
public double[] Min { get; }
Property Value
Type | Description |
---|---|
System.Double[] |
NumberOfDimensions
Gets the number of dimensions of the hyperrectangle.
Declaration
public int NumberOfDimensions { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Clone()
Creates a new object that is a copy of the current instance.
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.Object | A new object that is a copy of this instance. |
Contains(Double[])
Determines if the specified point is contained within this Hyperrectangle structure.
Declaration
public bool Contains(params double[] point)
Parameters
Type | Name | Description |
---|---|---|
System.Double[] | point |
Returns
Type | Description |
---|---|
System.Boolean |
Equals(Hyperrectangle)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(Hyperrectangle other)
Parameters
Type | Name | Description |
---|---|---|
Hyperrectangle | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
System.Boolean | true if the current object is equal to the other parameter; otherwise, false. |
FromMinAndLength(Double[], Double[], Boolean)
Initializes a new instance of the Hyperrectangle struct from a minimum value and a size.
Declaration
public static Hyperrectangle FromMinAndLength(double[] min, double[] size, bool copy = true)
Parameters
Type | Name | Description |
---|---|---|
System.Double[] | min | The minimum point in the hyperrectangle (the lower bound). |
System.Double[] | size | The size of each dimension (i.e. width, height, and so on). |
System.Boolean | copy | Whether the passed vectors should be copied into this instance or used as-is. Default is true (elements from the given vectors will be copied into new array instances). |
Returns
Type | Description |
---|---|
Hyperrectangle |
FromMinAndMax(Double[], Double[], Boolean)
Initializes a new instance of the Hyperrectangle struct from minimum and maximum values.
Declaration
public static Hyperrectangle FromMinAndMax(double[] min, double[] max, bool copy = true)
Parameters
Type | Name | Description |
---|---|---|
System.Double[] | min | The minimum point in the hyperrectangle (the lower bound). |
System.Double[] | max | The maximum point in the hyperrectangle (the upper bound). |
System.Boolean | copy | Whether the passed vectors should be copied into this instance or used as-is. Default is true (elements from the given vectors will be copied into new array instances). |
Returns
Type | Description |
---|---|
Hyperrectangle |
GetLength()
Gets the length of each dimension. The length of the first dimension
can be referred as the width, the second as the height, and so on.
Declaration
public double[] GetLength()
Returns
Type | Description |
---|---|
System.Double[] |
IntersectsWith(Hyperrectangle)
Determines if this rectangle intersects with rect.
Declaration
public bool IntersectsWith(Hyperrectangle rect)
Parameters
Type | Name | Description |
---|---|---|
Hyperrectangle | rect |
Returns
Type | Description |
---|---|
System.Boolean |
ToString()
Returns a that represents this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A |
ToString(String, IFormatProvider)
Returns a that represents this instance.
Declaration
public string ToString(string format, IFormatProvider formatProvider = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | The format to use.-or- A null reference (Nothing in Visual Basic) to use the default format defined for the type of the System.IFormattable implementation. |
IFormatProvider | formatProvider | The provider to use to format the value.-or- A null reference (Nothing in Visual Basic) to obtain the numeric format information from the current locale setting of the operating system. |
Returns
Type | Description |
---|---|
System.String | A |
Implements
ICloneable
IEquatable<>
IFormattable