Struct Thickness
Describes the thickness of a frame around a cuboid. Six float values describe the Left, Top, Right, Bottom, Front, and Back sides of the cuboid, respectively.
[DataContract("Thickness")]
[DataStyle(DataStyle.Compact)]
public struct Thickness : IEquatable<Thickness>
- Implements
- Inherited Members
Constructors
Thickness(float, float, float, float)
Initializes a new instance of the Thickness structure that has specific lengths applied to each side of the rectangle.
public Thickness(float left, float top, float right, float bottom)
Parameters
left
floatThe thickness for the left side of the rectangle.
top
floatThe thickness for the upper side of the rectangle.
right
floatThe thickness for the right side of the rectangle
bottom
floatThe thickness for the lower side of the rectangle.
Thickness(float, float, float, float, float, float)
Initializes a new instance of the Thickness structure that has specific lengths applied to each side of the cuboid.
public Thickness(float left, float top, float back, float right, float bottom, float front)
Parameters
left
floatThe thickness for the left side of the cuboid.
top
floatThe thickness for the upper side of the cuboid.
back
floatThe thickness for the Back side of the cuboid.
right
floatThe thickness for the right side of the cuboid
bottom
floatThe thickness for the lower side of the cuboid.
front
floatThe thickness for the front side of the cuboid.
Fields
Back
The Back side of the bounding cuboid.
[DataMember(2)]
public float Back
Field Value
Bottom
The bottom side of the bounding rectangle or cuboid.
[DataMember(4)]
public float Bottom
Field Value
Front
The front side of the bounding cuboid.
[DataMember(5)]
public float Front
Field Value
Left
The left side of the bounding rectangle or cuboid.
[DataMember(0)]
public float Left
Field Value
Right
The right side of the bounding rectangle or cuboid.
[DataMember(3)]
public float Right
Field Value
Top
The upper side of the bounding rectangle or cuboid.
[DataMember(1)]
public float Top
Field Value
Properties
this[int]
Gets the component at the specified index.
public float this[int index] { get; }
Parameters
index
intThe index of the component to access. Use 0 for the Left component, 1 for the Top component, 2 for the Front component, 3 for the Right component, 4 for the Bottom component, 5 for the Back component.
Property Value
- float
The value of the component at the specified index.
Exceptions
- ArgumentOutOfRangeException
Thrown when the
index
is out of the range [0, 5].
Methods
Equals(Thickness)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Thickness other)
Parameters
other
ThicknessAn object to compare with this object.
Returns
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
obj
objectThe object to compare with the current instance.
Returns
- bool
true if
obj
and this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
UniformCuboid(float)
Initializes a new instance of the Thickness structure that has the specified uniform length on the Left, Right, Top, Bottom, Front, and Back side.
public static Thickness UniformCuboid(float thickness)
Parameters
thickness
floatThe uniform length applied to all six sides of the bounding cuboid.
Returns
- Thickness
The created thickness class
UniformRectangle(float)
Initializes a new instance of the Thickness structure that has the specified uniform length on the Left, Right, Top, Bottom side and 0 for the Front and Back side.
public static Thickness UniformRectangle(float thickness)
Parameters
thickness
floatThe uniform length applied to all four sides of the bounding rectangle.
Returns
- Thickness
The created thickness class
Operators
operator +(Thickness, Thickness)
Adds two Thickness together.
public static Thickness operator +(Thickness value1, Thickness value2)
Parameters
Returns
- Thickness
A Thickness representing the sum of the two Thickness.
operator /(Thickness, float)
Divides a Thickness by a float.
public static Thickness operator /(Thickness value1, float value2)
Parameters
Returns
- Thickness
The divided thickness
operator ==(Thickness, Thickness)
public static bool operator ==(Thickness left, Thickness right)
Parameters
Returns
operator !=(Thickness, Thickness)
public static bool operator !=(Thickness left, Thickness right)
Parameters
Returns
operator *(Thickness, float)
Multiplies a Thickness by a float.
public static Thickness operator *(Thickness value1, float value2)
Parameters
Returns
- Thickness
The multiplied thickness
operator -(Thickness, Thickness)
Substracts one Thickness with another.
public static Thickness operator -(Thickness value1, Thickness value2)
Parameters
Returns
- Thickness
A Thickness representing the difference between the two Thickness.
operator -(Thickness)
Reverses the direction of a given Thickness.
public static Thickness operator -(Thickness value)
Parameters
value
ThicknessThe Thickness to negate.
Returns
- Thickness
A Thickness with the opposite direction.