Struct ImRect
Stores the center and extents of the box.
Implements
Inherited Members
Namespace: InitialPrefabs.NimGui
Assembly: InitialPrefabs.ImGui.dll
Syntax
public struct ImRect : IEquatable<ImRect>
Constructors
ImRect(float2, float2)
Creates a rectangle given the center and extents.
Declaration
public ImRect(float2 center, float2 extents)
Parameters
| Type | Name | Description |
|---|---|---|
| Unity.Mathematics.float2 | center | The position of the rectangle. |
| Unity.Mathematics.float2 | extents | The extents is the width and height of the rectangle from the center. |
Fields
Extents
The extents is the width and height of the rectangle from the center.
Declaration
public float2 Extents
Field Value
| Type | Description |
|---|---|
| Unity.Mathematics.float2 |
Position
Typically, the center of the rectangle.
Declaration
public float2 Position
Field Value
| Type | Description |
|---|---|
| Unity.Mathematics.float2 |
Properties
Max
The top right corner of the rectangle.
Declaration
public readonly float2 Max { get; }
Property Value
| Type | Description |
|---|---|
| Unity.Mathematics.float2 | This is the position added by the extents. |
Min
The bottom left corner of the rectangle.
Declaration
public readonly float2 Min { get; }
Property Value
| Type | Description |
|---|---|
| Unity.Mathematics.float2 | This is the position subtracted by the extents. |
Size
The size of the rectangle.
Declaration
public readonly float2 Size { get; }
Property Value
| Type | Description |
|---|---|
| Unity.Mathematics.float2 | A multiplication of the Extents by 2 |
Methods
Clamp(in float4)
Clamps the current bounds of a rectangle to this rectangle's Min and Max points.
Declaration
public float4 Clamp(in float4 bounds)
Parameters
| Type | Name | Description |
|---|---|---|
| Unity.Mathematics.float4 | bounds | A float4 where xy is the min and zw is the max. |
Returns
| Type | Description |
|---|---|
| Unity.Mathematics.float4 | The clamped values in relation to this rectangle. |
Contains(float2)
Checks if the point is wihtin the rectangle.
Declaration
public bool Contains(float2 point)
Parameters
| Type | Name | Description |
|---|---|---|
| Unity.Mathematics.float2 | point | The point to check. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True, if inside the rectangle. |
Equals(ImRect)
Declaration
public bool Equals(ImRect other)
Parameters
| Type | Name | Description |
|---|---|---|
| ImRect | other |
Returns
| Type | Description |
|---|---|
| System.Boolean |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 |
Overrides
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String |
Overrides
Operators
Implicit(ImRect to Rect)
Declaration
public static implicit operator Rect(ImRect rect)
Parameters
| Type | Name | Description |
|---|---|---|
| ImRect | rect |
Returns
| Type | Description |
|---|---|
| UnityEngine.Rect |