Struct ArenaRect

Namespace
SurvivorsMaker.Simulation
Assembly
SurvivorsMaker.Simulation.dll

Axis-aligned arena rectangle, centered on the origin unless built otherwise.

public struct ArenaRect
Inherited Members

Constructors

ArenaRect(Vec2, Vec2)

public ArenaRect(Vec2 min, Vec2 max)

Parameters

min Vec2
max Vec2

Fields

Max

public Vec2 Max

Field Value

Vec2

Min

public Vec2 Min

Field Value

Vec2

Properties

Center

public Vec2 Center { get; }

Property Value

Vec2

Height

public float Height { get; }

Property Value

float

Width

public float Width { get; }

Property Value

float

Methods

Centered(float, float)

public static ArenaRect Centered(float width, float height)

Parameters

width float
height float

Returns

ArenaRect

Clamp(Vec2, float)

Keeps a circle of radius inside. If the arena is too small on an axis, uses its center.

public Vec2 Clamp(Vec2 p, float radius = 0)

Parameters

p Vec2
radius float

Returns

Vec2

Contains(Vec2)

Inclusive containment test.

public bool Contains(Vec2 p)

Parameters

p Vec2

Returns

bool

Inset(float)

Rectangle shrunk by margin on every side (never inverted).

public ArenaRect Inset(float margin)

Parameters

margin float

Returns

ArenaRect

RandomPoint(SimRandom)

public Vec2 RandomPoint(SimRandom random)

Parameters

random SimRandom

Returns

Vec2