[go: up one dir, main page]

[][src]Module egui::math

Vectors, positions, rectangles etc.

Modules

smart_aim

Structs

MovementTracker

This struct tracks recent values of some time series. This can be used for things like smoothed averages (for e.g. FPS) or for smoothed velocity (e.g. mouse pointer speed). All times are in seconds.

Pos2

A position on screen.

Rect

A rectangular region of space.

Vec2

A size or direction in 2D space.

Constants

TAU

The circumference of a circle divided by its radius.

Functions

almost_equal

Should return true when arguments are the same within some rounding error. For instance almost_equal(x, x.to_degrees().to_radians(), f32::EPSILON) should hold true for all x. The epsilon can be f32::EPSILON to handle simple transforms (like degrees -> radians) but should be higher to handle more complex transformations.

clamp

Returns range.start() if x <= range.start(), returns range.end() if x >= range.end() and returns x elsewhen.

ease_in_ease_out

For t=[0,1], returns [0,1] with a derivate of zero at both ends

format_with_minimum_precision
lerp

Linear interpolation.

pos2
remap

Linearly remap a value from one range to another, so that when x == from.start() returns to.start() and when x == from.end() returns to.end().

remap_clamp

Like remap, but also clamps the value so that the returned value is always in the to range.

round_to_precision

Round a value to the given number of decimal places.

round_to_precision_f32

Round a value to the given number of decimal places.

vec2