> For the complete documentation index, see [llms.txt](https://kinematicsoup.gitbook.io/reactor/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kinematicsoup.gitbook.io/reactor/api-reference/ks.reactor/ks.reactor.ksrange.md).

# Class ksRange

Namespace: [KS.Reactor](/reactor/api-reference/ks.reactor.md)\
Assembly: KSCommon.dll

Defines a numerical range that wraps around.

```csharp
public class ksRange
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) ← [ksRange](/reactor/api-reference/ks.reactor/ks.reactor.ksrange.md)

#### Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\)), [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\)), [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode), [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype), [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone), [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals), [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Constructors

### ksRange(float, float) <a href="#ks_reactor_ksrange__ctor_system_single_system_single" id="ks_reactor_ksrange__ctor_system_single_system_single"></a>

Constructor.

```csharp
public ksRange(float min, float max)
```

#### Parameters

`min` [float](https://learn.microsoft.com/dotnet/api/system.single)

Min value in the range (inclusive).

`max` [float](https://learn.microsoft.com/dotnet/api/system.single)

Max value in the range (exclusive).

## Properties

### Degrees <a href="#ks_reactor_ksrange_degrees" id="ks_reactor_ksrange_degrees"></a>

Degrees (0 - 360).

```csharp
public static ksRange Degrees { get; }
```

#### Property Value

[ksRange](/reactor/api-reference/ks.reactor/ks.reactor.ksrange.md)

### Max <a href="#ks_reactor_ksrange_max" id="ks_reactor_ksrange_max"></a>

Max value in the range (exclusive).

```csharp
public float Max { get; }
```

#### Property Value

[float](https://learn.microsoft.com/dotnet/api/system.single)

### Min <a href="#ks_reactor_ksrange_min" id="ks_reactor_ksrange_min"></a>

Min value in the range (inclusive).

```csharp
public float Min { get; }
```

#### Property Value

[float](https://learn.microsoft.com/dotnet/api/system.single)

### Radians <a href="#ks_reactor_ksrange_radians" id="ks_reactor_ksrange_radians"></a>

Radians (0 - 2PI).

```csharp
public static ksRange Radians { get; }
```

#### Property Value

[ksRange](/reactor/api-reference/ks.reactor/ks.reactor.ksrange.md)

## Methods

### Clamp(float) <a href="#ks_reactor_ksrange_clamp_system_single" id="ks_reactor_ksrange_clamp_system_single"></a>

Clamps a value into the range.

```csharp
public float Clamp(float value)
```

#### Parameters

`value` [float](https://learn.microsoft.com/dotnet/api/system.single)

#### Returns

[float](https://learn.microsoft.com/dotnet/api/system.single)

Clamped value.

### Delta(float, float) <a href="#ks_reactor_ksrange_delta_system_single_system_single" id="ks_reactor_ksrange_delta_system_single_system_single"></a>

Calculates the shortest delta between two values.

```csharp
public float Delta(float from, float to)
```

#### Parameters

`from` [float](https://learn.microsoft.com/dotnet/api/system.single)

`to` [float](https://learn.microsoft.com/dotnet/api/system.single)

#### Returns

[float](https://learn.microsoft.com/dotnet/api/system.single)

Delta between from and to.

### MoveTowards(float, float, float) <a href="#ks_reactor_ksrange_movetowards_system_single_system_single_system_single" id="ks_reactor_ksrange_movetowards_system_single_system_single_system_single"></a>

Moves a value towards another in the shorest direction.

```csharp
public float MoveTowards(float start, float target, float distance)
```

#### Parameters

`start` [float](https://learn.microsoft.com/dotnet/api/system.single)

Start value.

`target` [float](https://learn.microsoft.com/dotnet/api/system.single)

Target to move towards.

`distance` [float](https://learn.microsoft.com/dotnet/api/system.single)

delta distance to move. It will not overshoot the target. Negative values will move away from the target.

#### Returns

[float](https://learn.microsoft.com/dotnet/api/system.single)

Result.

### SetRange(float, float) <a href="#ks_reactor_ksrange_setrange_system_single_system_single" id="ks_reactor_ksrange_setrange_system_single_system_single"></a>

Sets new min and max range values

```csharp
public void SetRange(float min, float max)
```

#### Parameters

`min` [float](https://learn.microsoft.com/dotnet/api/system.single)

Min value in the range (inclusive).

`max` [float](https://learn.microsoft.com/dotnet/api/system.single)

Max value in the range (exclusive).

### Slerp(float, float, float) <a href="#ks_reactor_ksrange_slerp_system_single_system_single_system_single" id="ks_reactor_ksrange_slerp_system_single_system_single_system_single"></a>

Spherically interpolates between two values.

```csharp
public float Slerp(float from, float to, float t)
```

#### Parameters

`from` [float](https://learn.microsoft.com/dotnet/api/system.single)

Value to interpolate from.

`to` [float](https://learn.microsoft.com/dotnet/api/system.single)

Value to interpolate to.

`t` [float](https://learn.microsoft.com/dotnet/api/system.single)

Amount to interpolate between 0 and 1.

#### Returns

[float](https://learn.microsoft.com/dotnet/api/system.single)

Interpolated value.

### Wrap(float) <a href="#ks_reactor_ksrange_wrap_system_single" id="ks_reactor_ksrange_wrap_system_single"></a>

Fits a value into the range. This is not a clamp--values outside the range will wrap around.

```csharp
public float Wrap(float value)
```

#### Parameters

`value` [float](https://learn.microsoft.com/dotnet/api/system.single)

#### Returns

[float](https://learn.microsoft.com/dotnet/api/system.single)

Value in range.
