core.math

Numeric constants and functions for trigonometry, rounding, clamping, and powers of two. Includes integer and floating-point points, sizes, and rectangles.

6 structs · 41 functions · Public API

Structs

Size

struct
Size : struct {
    width, height : i32
}

Point

struct
Point : struct {
    x, y : i32
}

Rect

struct
Rect : struct {
    size : Size
    pos : Point
}

SizeF

struct
SizeF : struct {
    width, height : f32
}
Float

PointF

struct
PointF : struct {
    x, y : f32
}

RectF

struct
RectF : struct {
    size : SizeF
    pos : PointF
}

Functions

acos_f64

func
acos_f64   : func ( x : f64 ) -> f64

acosf_f32

func
acosf_f32 : func ( x : f32 ) -> f32

sqrt_f64

func
sqrt_f64   : func ( x : f64 ) -> f64

sqrt_f32

func
sqrt_f32  : func ( x : f32 ) -> f32

sin_f64

func
sin_f64     : func ( x : f64 ) -> f64

sin_f32

func
sin_f32    : func ( x : f32 ) -> f32

cos_f64

func
cos_f64     : func ( x : f64 ) -> f64

cos_f32

func
cos_f32    : func ( x : f32 ) -> f32

tan_f64

func
tan_f64     : func ( x : f64 ) -> f64

floor_f64

func
floor_f64 : func ( x : f64 ) -> f64

floor_f32

func
floor_f32: func ( x : f32 ) -> f32

ceil_f64

func
ceil_f64   : func ( x : f64 ) -> f64

ceil_f32

func
ceil_f32  : func ( x : f32 ) -> f32

fabs

func
fabs       : func ( x : f64 ) -> f64

fabs_f32

func
fabs_f32  : func ( x : f32 ) -> f32

abs

func
abs         : func ( x : i32 ) -> i32

max

func
max : func<T>(a : T, b : T) -> T

min

func
min : func<T>(a : T, b : T) -> T

clamp

func
clamp : func<T>(value : T, low : T, high : T) -> T

get_top_left

func
get_top_left : func(rect : ^Rect) -> Point

get_center

func
get_center : func(rect : ^Rect) -> Point

contains

func
contains : func(rect: ^Rect, pt : Point) -> bool

offset_by

func
offset_by : func(rect : ^Rect, offset : Point) -> ^Rect

inflate

func
inflate : func(rect : ^Rect, delta : Point) -> ^Rect

intersect_rect

func
intersect_rect : func(rect : ^Rect, other : ^Rect) -> Rect

get_top_left

func
get_top_left : func(rect : ^RectF) -> PointF

get_top_right

func
get_top_right : func(rect : ^RectF) -> PointF

get_center

func
get_center : func(rect : ^RectF) -> PointF

contains

func
contains : func(rect : ^RectF, pt : PointF) -> bool

offset_by

func
offset_by : func(rect : ^RectF, offset : PointF) -> ^RectF

inflate

func
inflate : func(rect : ^RectF, delta : PointF) -> ^RectF

intersect_rect

func
intersect_rect : func(rect : ^RectF, other : ^RectF) -> RectF

clamp_rect_to_rect

func
clamp_rect_to_rect : func(rect : RectF, bounds : RectF) -> RectF