mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Add lambdas.
This commit is contained in:
committed by
Christoffer Lerno
parent
c9e1e2d763
commit
b508a43f8f
@@ -109,7 +109,7 @@ define matrix4f_perspective = matrix::perspective<float>;
|
||||
/**
|
||||
* @require types::is_numerical($typeof(x)) `The input must be a numerical value or numerical vector`
|
||||
**/
|
||||
macro abs(x) = $$abs(x);
|
||||
macro abs(x) => $$abs(x);
|
||||
|
||||
/**
|
||||
* @require values::@is_int(x) `The input must be an integer`
|
||||
@@ -149,64 +149,64 @@ $endif;
|
||||
/**
|
||||
* @require values::@is_floatlike(x) `The input must be a floating point value or float vector`
|
||||
**/
|
||||
macro ceil(x) = $$ceil(x);
|
||||
macro ceil(x) => $$ceil(x);
|
||||
|
||||
/**
|
||||
* @require types::is_numerical($typeof(x)) `The input must be a numerical value or numerical vector`
|
||||
* @require types::@has_same(x, lower, upper) `The input types must be equal`
|
||||
**/
|
||||
macro clamp(x, lower, upper) = $$max(lower, $$min(x, upper));
|
||||
macro clamp(x, lower, upper) => $$max(lower, $$min(x, upper));
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(mag) `The input must be a number value or float vector`
|
||||
* @require values::@is_same_vector_type(mag, sgn) `The input types must match`
|
||||
**/
|
||||
macro copysign(mag, sgn) = $$copysign(mag, sgn);
|
||||
macro copysign(mag, sgn) => $$copysign(mag, sgn);
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(x) `The input must be a number value or float vector`
|
||||
**/
|
||||
macro cos(x) = $$cos(x);
|
||||
macro cos(x) => $$cos(x);
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(x) `The input must be a number value or float vector`
|
||||
**/
|
||||
macro cosec(x) = 1 / sin(x);
|
||||
macro cosec(x) => 1 / sin(x);
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(x) `The input must be a number value or float vector`
|
||||
**/
|
||||
macro cosech(x) = 2 / (exp(x) - exp(-x));
|
||||
macro cosech(x) => 2 / (exp(x) - exp(-x));
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(x) `The input must be a number value or float vector`
|
||||
**/
|
||||
macro cosh(x) = (exp(x) + exp(-x)) / 2.0;
|
||||
macro cosh(x) => (exp(x) + exp(-x)) / 2.0;
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(x) `The input must be a number value or float vector`
|
||||
**/
|
||||
macro cotan(x) = cos(x) / sin(x);
|
||||
macro cotan(x) => cos(x) / sin(x);
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(x) `The input must be a number value or float vector`
|
||||
**/
|
||||
macro cotanh(x) = (exp(2.0 * x) + 1.0) / (exp(2.0 * x) - 1.0);
|
||||
macro cotanh(x) => (exp(2.0 * x) + 1.0) / (exp(2.0 * x) - 1.0);
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(x) `The input must be a number value or float vector`
|
||||
**/
|
||||
macro exp(x) = $$exp(values::promote_int(x));
|
||||
macro exp(x) => $$exp(values::promote_int(x));
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(x) `The input must be a number value or float vector`
|
||||
**/
|
||||
macro exp2(x) = $$exp2(values::promote_int(x));
|
||||
macro exp2(x) => $$exp2(values::promote_int(x));
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(x) `The input must be a number value or float vector`
|
||||
**/
|
||||
macro floor(x) = $$floor(values::promote_int(x));
|
||||
macro floor(x) => $$floor(values::promote_int(x));
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(a) `The input must be a number or float vector`
|
||||
@@ -215,7 +215,7 @@ macro floor(x) = $$floor(values::promote_int(x));
|
||||
* @require types::@is_same_vector_type(a, b) `The input types must be equal`
|
||||
* @require types::@is_same_vector_type(a, c) `The input types must match`
|
||||
**/
|
||||
macro fma(a, b, c) = $$fma(a, b, c);
|
||||
macro fma(a, b, c) => $$fma(a, b, c);
|
||||
|
||||
|
||||
/**
|
||||
@@ -223,22 +223,22 @@ macro fma(a, b, c) = $$fma(a, b, c);
|
||||
* @require values::@is_promotable_to_floatlike(y) `The input must be a number or a float vector`
|
||||
* @require types::@is_same_vector_type(x, y) `The input types must match`
|
||||
**/
|
||||
macro hypot(x, y) = sqrt(sqr(x) + sqr(y));
|
||||
macro hypot(x, y) => sqrt(sqr(x) + sqr(y));
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(x) `The input must be a number or a float vector`
|
||||
**/
|
||||
macro log(x) = $$log(values::promote_int(x));
|
||||
macro log(x) => $$log(values::promote_int(x));
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(x) `The input must be a number or a float vector`
|
||||
**/
|
||||
macro log2(x) = $$log2(values::promote_int(x));
|
||||
macro log2(x) => $$log2(values::promote_int(x));
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(x) `The input must be a number or a float vector`
|
||||
**/
|
||||
macro log10(x) = $$log10(values::promote_int(x));
|
||||
macro log10(x) => $$log10(values::promote_int(x));
|
||||
|
||||
/**
|
||||
* @require types::is_numerical($typeof(x)) `The input must be a floating point value or float vector`
|
||||
@@ -278,12 +278,12 @@ macro min(x, y, ...)
|
||||
* @require types::@is_float(a) `The input must be a floating point value`
|
||||
* @require types::@has_same(a, b, c) `The input types must be equal`
|
||||
**/
|
||||
macro muladd(a, b, c) = $$fmuladd(a, b, c);
|
||||
macro muladd(a, b, c) => $$fmuladd(a, b, c);
|
||||
|
||||
/**
|
||||
* @require values::@is_floatlike(x) `The input must be a floating point value or float vector`
|
||||
**/
|
||||
macro nearbyint(x) = $$nearbyint(x);
|
||||
macro nearbyint(x) => $$nearbyint(x);
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(x) `The input must be a number or a float vector`
|
||||
@@ -301,64 +301,64 @@ macro pow(x, exp)
|
||||
/**
|
||||
* @require values::@is_floatlike(x) `The input must be a number or a float vector`
|
||||
**/
|
||||
macro rint(x) = $$rint(x);
|
||||
macro rint(x) => $$rint(x);
|
||||
|
||||
/**
|
||||
* @require values::@is_floatlike(x) `The input must be a floating point value or float vector`
|
||||
**/
|
||||
macro round(x) = $$round(x);
|
||||
macro round(x) => $$round(x);
|
||||
|
||||
/**
|
||||
* @require values::@is_floatlike(x) `The input must be a floating point value or float vector`
|
||||
**/
|
||||
macro roundeven(x) = $$roundeven(x);
|
||||
macro roundeven(x) => $$roundeven(x);
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(x) `The input must be a number or a float vector`
|
||||
**/
|
||||
macro sec(x) = 1 / cos(x);
|
||||
macro sec(x) => 1 / cos(x);
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(x) `The input must be a number or a float vector`
|
||||
**/
|
||||
macro sech(x) = 2 / (exp(x) + exp(-x));
|
||||
macro sech(x) => 2 / (exp(x) + exp(-x));
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(x) `The input must be a number or a float vector`
|
||||
**/
|
||||
macro sin(x) = $$sin(values::promote_int(x));
|
||||
macro sin(x) => $$sin(values::promote_int(x));
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(x) `The input must be a number or a float vector`
|
||||
**/
|
||||
macro sinh(x) = (exp(x) - exp(-x)) / 2.0;
|
||||
macro sinh(x) => (exp(x) - exp(-x)) / 2.0;
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(x) `The input must be a number or a float vector`
|
||||
**/
|
||||
macro sqr(x) = values::promote_int(x) * values::promote_int(x);
|
||||
macro sqr(x) => values::promote_int(x) * values::promote_int(x);
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(x) `The input must be a number or a float vector`
|
||||
**/
|
||||
macro sqrt(x) = $$sqrt(values::promote_int(x));
|
||||
macro sqrt(x) => $$sqrt(values::promote_int(x));
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(x) `The input must be a number or a float vector`
|
||||
**/
|
||||
macro tan(x) = sin(x) / cos(x);
|
||||
macro tan(x) => sin(x) / cos(x);
|
||||
|
||||
/**
|
||||
* @require values::@is_promotable_to_floatlike(x) `The input must be a number or a float vector`
|
||||
**/
|
||||
macro tanh(x) = (exp(2.0 * x) - 1.0) / (exp(2.0 * x) + 1.0);
|
||||
macro tanh(x) => (exp(2.0 * x) - 1.0) / (exp(2.0 * x) + 1.0);
|
||||
|
||||
/**
|
||||
* @require values::@is_floatlike(x) `The input must be a floating point value or float vector`
|
||||
**/
|
||||
macro trunc(x) = $$trunc(x);
|
||||
macro trunc(x) => $$trunc(x);
|
||||
|
||||
private macro lerp(x, y, amount) = x + (y - x) * amount;
|
||||
private macro lerp(x, y, amount) => x + (y - x) * amount;
|
||||
private macro reflect(x, y)
|
||||
{
|
||||
var dot = x.dot(y);
|
||||
@@ -371,194 +371,194 @@ private macro normalize(x)
|
||||
return x * (1 / len);
|
||||
}
|
||||
|
||||
macro float float.ceil(float x) = $$ceil(x);
|
||||
macro float float.clamp(float x, float lower, float upper) = $$max(lower, $$min(x, upper));
|
||||
macro float float.copysign(float mag, float sgn) = $$copysign(mag, sgn);
|
||||
macro float float.floor(float x) = $$floor(x);
|
||||
macro float float.fma(float a, float b, float c) = $$fma(a, b, c);
|
||||
macro float float.muladd(float a, float b, float c) = $$fmuladd(a, b, c);
|
||||
macro float float.nearbyint(float x) = $$nearbyint(x);
|
||||
macro float float.pow(float x, exp) = pow(x, exp);
|
||||
macro float float.rint(float x) = $$rint(x);
|
||||
macro float float.round(float x) = $$round(x);
|
||||
macro float float.roundeven(float x) = $$roundeven(x);
|
||||
macro float float.trunc(float x) = $$trunc(x);
|
||||
macro float float.ceil(float x) => $$ceil(x);
|
||||
macro float float.clamp(float x, float lower, float upper) => $$max(lower, $$min(x, upper));
|
||||
macro float float.copysign(float mag, float sgn) => $$copysign(mag, sgn);
|
||||
macro float float.floor(float x) => $$floor(x);
|
||||
macro float float.fma(float a, float b, float c) => $$fma(a, b, c);
|
||||
macro float float.muladd(float a, float b, float c) => $$fmuladd(a, b, c);
|
||||
macro float float.nearbyint(float x) => $$nearbyint(x);
|
||||
macro float float.pow(float x, exp) => pow(x, exp);
|
||||
macro float float.rint(float x) => $$rint(x);
|
||||
macro float float.round(float x) => $$round(x);
|
||||
macro float float.roundeven(float x) => $$roundeven(x);
|
||||
macro float float.trunc(float x) => $$trunc(x);
|
||||
|
||||
macro float float[<*>].sum(float[<*>] x, float start = 0.0) = $$reduce_fadd(x, start);
|
||||
macro float float[<*>].product(float[<*>] x, float start = 1.0) = $$reduce_fmul(x, start);
|
||||
macro float float[<*>].max(float[<*>] x) = $$reduce_max(x);
|
||||
macro float float[<*>].min(float[<*>] x) = $$reduce_min(x);
|
||||
macro float[<*>] float[<*>].ceil(float[<*>] x) = $$ceil(x);
|
||||
macro float[<*>] float[<*>].clamp(float[<*>] x, float[<*>] lower, float[<*>] upper) = $$max(lower, $$min(x, upper));
|
||||
macro float[<*>] float[<*>].copysign(float[<*>] mag, float[<*>] sgn) = $$copysign(mag, sgn);
|
||||
macro float[<*>] float[<*>].fma(float[<*>] a, float[<*>] b, float[<*>] c) = $$fma(a, b, c);
|
||||
macro float[<*>] float[<*>].floor(float[<*>] x) = $$floor(x);
|
||||
macro float[<*>] float[<*>].nearbyint(float[<*>] x) = $$nearbyint(x);
|
||||
macro float[<*>] float[<*>].pow(float[<*>] x, exp) = pow(x, exp);
|
||||
macro float[<*>] float[<*>].rint(float[<*>] x) = $$rint(x);
|
||||
macro float[<*>] float[<*>].round(float[<*>] x) = $$round(x);
|
||||
macro float[<*>] float[<*>].roundeven(float[<*>] x) = $$roundeven(x);
|
||||
macro float[<*>] float[<*>].trunc(float[<*>] x) = $$trunc(x);
|
||||
macro float float[<*>].dot(float[<*>] x, float[<*>] y) = (x * y).sum();
|
||||
macro float float[<*>].length(float[<*>] x) = $$sqrt(x.dot(x));
|
||||
macro float float[<*>].distance(float[<*>] x, float[<*>] y) = (x - y).length();
|
||||
macro float[<*>] float[<*>].normalize(float[<*>] x) = normalize(x);
|
||||
macro float[<*>] float[<*>].lerp(float[<*>] x, float[<*>] y, float amount) = lerp(x, y, amount);
|
||||
macro float[<*>] float[<*>].reflect(float[<*>] x, float[<*>] y) = reflect(x, y);
|
||||
macro bool float[<*>].equals(float[<*>] x, float[<*>] y) = equals_vec(x, y);
|
||||
macro float float[<*>].sum(float[<*>] x, float start = 0.0) => $$reduce_fadd(x, start);
|
||||
macro float float[<*>].product(float[<*>] x, float start = 1.0) => $$reduce_fmul(x, start);
|
||||
macro float float[<*>].max(float[<*>] x) => $$reduce_max(x);
|
||||
macro float float[<*>].min(float[<*>] x) => $$reduce_min(x);
|
||||
macro float[<*>] float[<*>].ceil(float[<*>] x) => $$ceil(x);
|
||||
macro float[<*>] float[<*>].clamp(float[<*>] x, float[<*>] lower, float[<*>] upper) => $$max(lower, $$min(x, upper));
|
||||
macro float[<*>] float[<*>].copysign(float[<*>] mag, float[<*>] sgn) => $$copysign(mag, sgn);
|
||||
macro float[<*>] float[<*>].fma(float[<*>] a, float[<*>] b, float[<*>] c) => $$fma(a, b, c);
|
||||
macro float[<*>] float[<*>].floor(float[<*>] x) => $$floor(x);
|
||||
macro float[<*>] float[<*>].nearbyint(float[<*>] x) => $$nearbyint(x);
|
||||
macro float[<*>] float[<*>].pow(float[<*>] x, exp) => pow(x, exp);
|
||||
macro float[<*>] float[<*>].rint(float[<*>] x) => $$rint(x);
|
||||
macro float[<*>] float[<*>].round(float[<*>] x) => $$round(x);
|
||||
macro float[<*>] float[<*>].roundeven(float[<*>] x) => $$roundeven(x);
|
||||
macro float[<*>] float[<*>].trunc(float[<*>] x) => $$trunc(x);
|
||||
macro float float[<*>].dot(float[<*>] x, float[<*>] y) => (x * y).sum();
|
||||
macro float float[<*>].length(float[<*>] x) => $$sqrt(x.dot(x));
|
||||
macro float float[<*>].distance(float[<*>] x, float[<*>] y) => (x - y).length();
|
||||
macro float[<*>] float[<*>].normalize(float[<*>] x) => normalize(x);
|
||||
macro float[<*>] float[<*>].lerp(float[<*>] x, float[<*>] y, float amount) => lerp(x, y, amount);
|
||||
macro float[<*>] float[<*>].reflect(float[<*>] x, float[<*>] y) => reflect(x, y);
|
||||
macro bool float[<*>].equals(float[<*>] x, float[<*>] y) => equals_vec(x, y);
|
||||
|
||||
macro bool[<*>] float[<*>].comp_lt(float[<*>] x, float[<*>] y) = $$veccomplt(x, y);
|
||||
macro bool[<*>] float[<*>].comp_le(float[<*>] x, float[<*>] y) = $$veccomple(x, y);
|
||||
macro bool[<*>] float[<*>].comp_eq(float[<*>] x, float[<*>] y) = $$veccompeq(x, y);
|
||||
macro bool[<*>] float[<*>].comp_gt(float[<*>] x, float[<*>] y) = $$veccompgt(x, y);
|
||||
macro bool[<*>] float[<*>].comp_ge(float[<*>] x, float[<*>] y) = $$veccompge(x, y);
|
||||
macro bool[<*>] float[<*>].comp_ne(float[<*>] x, float[<*>] y) = $$veccompne(x, y);
|
||||
macro bool[<*>] float[<*>].comp_lt(float[<*>] x, float[<*>] y) => $$veccomplt(x, y);
|
||||
macro bool[<*>] float[<*>].comp_le(float[<*>] x, float[<*>] y) => $$veccomple(x, y);
|
||||
macro bool[<*>] float[<*>].comp_eq(float[<*>] x, float[<*>] y) => $$veccompeq(x, y);
|
||||
macro bool[<*>] float[<*>].comp_gt(float[<*>] x, float[<*>] y) => $$veccompgt(x, y);
|
||||
macro bool[<*>] float[<*>].comp_ge(float[<*>] x, float[<*>] y) => $$veccompge(x, y);
|
||||
macro bool[<*>] float[<*>].comp_ne(float[<*>] x, float[<*>] y) => $$veccompne(x, y);
|
||||
|
||||
macro double double.ceil(double x) = $$ceil(x);
|
||||
macro double double.clamp(double x, double lower, double upper) = $$max(lower, $$min(x, upper));
|
||||
macro double double.copysign(double mag, double sgn) = $$copysign(mag, sgn);
|
||||
macro double double.floor(double x) = $$floor(x);
|
||||
macro double double.fma(double a, double b, double c) = $$fma(a, b, c);
|
||||
macro double double.muladd(double a, double b, double c) = $$fmuladd(a, b, c);
|
||||
macro double double.nearbyint(double x) = $$nearbyint(x);
|
||||
macro double double.pow(double x, exp) = pow(x, exp);
|
||||
macro double double.rint(double x) = $$rint(x);
|
||||
macro double double.round(double x) = $$round(x);
|
||||
macro double double.roundeven(double x) = $$roundeven(x);
|
||||
macro double double.trunc(double x) = $$trunc(x);
|
||||
macro double double.ceil(double x) => $$ceil(x);
|
||||
macro double double.clamp(double x, double lower, double upper) => $$max(lower, $$min(x, upper));
|
||||
macro double double.copysign(double mag, double sgn) => $$copysign(mag, sgn);
|
||||
macro double double.floor(double x) => $$floor(x);
|
||||
macro double double.fma(double a, double b, double c) => $$fma(a, b, c);
|
||||
macro double double.muladd(double a, double b, double c) => $$fmuladd(a, b, c);
|
||||
macro double double.nearbyint(double x) => $$nearbyint(x);
|
||||
macro double double.pow(double x, exp) => pow(x, exp);
|
||||
macro double double.rint(double x) => $$rint(x);
|
||||
macro double double.round(double x) => $$round(x);
|
||||
macro double double.roundeven(double x) => $$roundeven(x);
|
||||
macro double double.trunc(double x) => $$trunc(x);
|
||||
|
||||
macro double double[<*>].sum(double[<*>] x, double start = 0.0) = $$reduce_fadd(x, start);
|
||||
macro double double[<*>].product(double[<*>] x, double start = 1.0) = $$reduce_fmul(x, start);
|
||||
macro double double[<*>].max(double[<*>] x) = $$reduce_fmax(x);
|
||||
macro double double[<*>].min(double[<*>] x) = $$reduce_fmin(x);
|
||||
macro double[<*>] double[<*>].ceil(double[<*>] x) = $$ceil(x);
|
||||
macro double[<*>] double[<*>].clamp(double[<*>] x, double[<*>] lower, double[<*>] upper) = $$max(lower, $$min(x, upper));
|
||||
macro double[<*>] double[<*>].copysign(double[<*>] mag, double[<*>] sgn) = $$copysign(mag, sgn);
|
||||
macro double[<*>] double[<*>].floor(double[<*>] x) = $$floor(x);
|
||||
macro double[<*>] double[<*>].fma(double[<*>] a, double[<*>] b, double[<*>] c) = $$fma(a, b, c);
|
||||
macro double[<*>] double[<*>].nearbyint(double[<*>] x) = $$nearbyint(x);
|
||||
macro double[<*>] double[<*>].pow(double[<*>] x, exp) = pow(x, exp);
|
||||
macro double[<*>] double[<*>].rint(double[<*>] x) = $$rint(x);
|
||||
macro double[<*>] double[<*>].round(double[<*>] x) = $$round(x);
|
||||
macro double[<*>] double[<*>].roundeven(double[<*>] x) = $$roundeven(x);
|
||||
macro double[<*>] double[<*>].trunc(double[<*>] x) = $$trunc(x);
|
||||
macro double double[<*>].dot(double[<*>] x, double[<*>] y) = (x * y).sum();
|
||||
macro double double[<*>].length(double[<*>] x) = $$sqrt(x.dot(x));
|
||||
macro double double[<*>].distance(double[<*>] x, double[<*>] y) = (x - y).length();
|
||||
macro double[<*>] double[<*>].normalize(double[<*>] x) = normalize(x);
|
||||
macro double[<*>] double[<*>].reflect(double[<*>] x, double[<*>] y) = reflect(x, y);
|
||||
macro double[<*>] double[<*>].lerp(double[<*>] x, double[<*>] y, double amount) = lerp(x, y, amount);
|
||||
macro bool double[<*>].equals(double[<*>] x, double[<*>] y) = equals_vec(x, y);
|
||||
macro double double[<*>].sum(double[<*>] x, double start = 0.0) => $$reduce_fadd(x, start);
|
||||
macro double double[<*>].product(double[<*>] x, double start = 1.0) => $$reduce_fmul(x, start);
|
||||
macro double double[<*>].max(double[<*>] x) => $$reduce_fmax(x);
|
||||
macro double double[<*>].min(double[<*>] x) => $$reduce_fmin(x);
|
||||
macro double[<*>] double[<*>].ceil(double[<*>] x) => $$ceil(x);
|
||||
macro double[<*>] double[<*>].clamp(double[<*>] x, double[<*>] lower, double[<*>] upper) => $$max(lower, $$min(x, upper));
|
||||
macro double[<*>] double[<*>].copysign(double[<*>] mag, double[<*>] sgn) => $$copysign(mag, sgn);
|
||||
macro double[<*>] double[<*>].floor(double[<*>] x) => $$floor(x);
|
||||
macro double[<*>] double[<*>].fma(double[<*>] a, double[<*>] b, double[<*>] c) => $$fma(a, b, c);
|
||||
macro double[<*>] double[<*>].nearbyint(double[<*>] x) => $$nearbyint(x);
|
||||
macro double[<*>] double[<*>].pow(double[<*>] x, exp) => pow(x, exp);
|
||||
macro double[<*>] double[<*>].rint(double[<*>] x) => $$rint(x);
|
||||
macro double[<*>] double[<*>].round(double[<*>] x) => $$round(x);
|
||||
macro double[<*>] double[<*>].roundeven(double[<*>] x) => $$roundeven(x);
|
||||
macro double[<*>] double[<*>].trunc(double[<*>] x) => $$trunc(x);
|
||||
macro double double[<*>].dot(double[<*>] x, double[<*>] y) => (x * y).sum();
|
||||
macro double double[<*>].length(double[<*>] x) => $$sqrt(x.dot(x));
|
||||
macro double double[<*>].distance(double[<*>] x, double[<*>] y) => (x - y).length();
|
||||
macro double[<*>] double[<*>].normalize(double[<*>] x) => normalize(x);
|
||||
macro double[<*>] double[<*>].reflect(double[<*>] x, double[<*>] y) => reflect(x, y);
|
||||
macro double[<*>] double[<*>].lerp(double[<*>] x, double[<*>] y, double amount) => lerp(x, y, amount);
|
||||
macro bool double[<*>].equals(double[<*>] x, double[<*>] y) => equals_vec(x, y);
|
||||
|
||||
macro bool[<*>] double[<*>].comp_lt(double[<*>] x, double[<*>] y) = $$veccomplt(x, y);
|
||||
macro bool[<*>] double[<*>].comp_le(double[<*>] x, double[<*>] y) = $$veccomple(x, y);
|
||||
macro bool[<*>] double[<*>].comp_eq(double[<*>] x, double[<*>] y) = $$veccompeq(x, y);
|
||||
macro bool[<*>] double[<*>].comp_gt(double[<*>] x, double[<*>] y) = $$veccompgt(x, y);
|
||||
macro bool[<*>] double[<*>].comp_ge(double[<*>] x, double[<*>] y) = $$veccompge(x, y);
|
||||
macro bool[<*>] double[<*>].comp_ne(double[<*>] x, double[<*>] y) = $$veccompne(x, y);
|
||||
macro bool[<*>] double[<*>].comp_lt(double[<*>] x, double[<*>] y) => $$veccomplt(x, y);
|
||||
macro bool[<*>] double[<*>].comp_le(double[<*>] x, double[<*>] y) => $$veccomple(x, y);
|
||||
macro bool[<*>] double[<*>].comp_eq(double[<*>] x, double[<*>] y) => $$veccompeq(x, y);
|
||||
macro bool[<*>] double[<*>].comp_gt(double[<*>] x, double[<*>] y) => $$veccompgt(x, y);
|
||||
macro bool[<*>] double[<*>].comp_ge(double[<*>] x, double[<*>] y) => $$veccompge(x, y);
|
||||
macro bool[<*>] double[<*>].comp_ne(double[<*>] x, double[<*>] y) => $$veccompne(x, y);
|
||||
|
||||
macro ichar ichar[<*>].sum(ichar[<*>] x) = $$reduce_add(x);
|
||||
macro ichar ichar[<*>].product(ichar[<*>] x) = $$reduce_mul(x);
|
||||
macro ichar ichar[<*>].and(ichar[<*>] x) = $$reduce_and(x);
|
||||
macro ichar ichar[<*>].or(ichar[<*>] x) = $$reduce_or(x);
|
||||
macro ichar ichar[<*>].xor(ichar[<*>] x) = $$reduce_xor(x);
|
||||
macro ichar ichar[<*>].max(ichar[<*>] x) = $$reduce_max(x);
|
||||
macro ichar ichar[<*>].min(ichar[<*>] x) = $$reduce_min(x);
|
||||
macro ichar ichar[<*>].sum(ichar[<*>] x) => $$reduce_add(x);
|
||||
macro ichar ichar[<*>].product(ichar[<*>] x) => $$reduce_mul(x);
|
||||
macro ichar ichar[<*>].and(ichar[<*>] x) => $$reduce_and(x);
|
||||
macro ichar ichar[<*>].or(ichar[<*>] x) => $$reduce_or(x);
|
||||
macro ichar ichar[<*>].xor(ichar[<*>] x) => $$reduce_xor(x);
|
||||
macro ichar ichar[<*>].max(ichar[<*>] x) => $$reduce_max(x);
|
||||
macro ichar ichar[<*>].min(ichar[<*>] x) => $$reduce_min(x);
|
||||
|
||||
macro short short[<*>].sum(short[<*>] x) = $$reduce_add(x);
|
||||
macro short short[<*>].product(short[<*>] x) = $$reduce_mul(x);
|
||||
macro short short[<*>].and(short[<*>] x) = $$reduce_and(x);
|
||||
macro short short[<*>].or(short[<*>] x) = $$reduce_or(x);
|
||||
macro short short[<*>].xor(short[<*>] x) = $$reduce_xor(x);
|
||||
macro short short[<*>].max(short[<*>] x) = $$reduce_max(x);
|
||||
macro short short[<*>].min(short[<*>] x) = $$reduce_min(x);
|
||||
macro short short[<*>].sum(short[<*>] x) => $$reduce_add(x);
|
||||
macro short short[<*>].product(short[<*>] x) => $$reduce_mul(x);
|
||||
macro short short[<*>].and(short[<*>] x) => $$reduce_and(x);
|
||||
macro short short[<*>].or(short[<*>] x) => $$reduce_or(x);
|
||||
macro short short[<*>].xor(short[<*>] x) => $$reduce_xor(x);
|
||||
macro short short[<*>].max(short[<*>] x) => $$reduce_max(x);
|
||||
macro short short[<*>].min(short[<*>] x) => $$reduce_min(x);
|
||||
|
||||
macro bool[<*>] int[<*>].comp_lt(int[<*>] x, int[<*>] y) = $$veccomplt(x, y);
|
||||
macro bool[<*>] int[<*>].comp_le(int[<*>] x, int[<*>] y) = $$veccomple(x, y);
|
||||
macro bool[<*>] int[<*>].comp_eq(int[<*>] x, int[<*>] y) = $$veccompeq(x, y);
|
||||
macro bool[<*>] int[<*>].comp_gt(int[<*>] x, int[<*>] y) = $$veccompgt(x, y);
|
||||
macro bool[<*>] int[<*>].comp_ge(int[<*>] x, int[<*>] y) = $$veccompge(x, y);
|
||||
macro bool[<*>] int[<*>].comp_ne(int[<*>] x, int[<*>] y) = $$veccompne(x, y);
|
||||
macro bool[<*>] int[<*>].comp_lt(int[<*>] x, int[<*>] y) => $$veccomplt(x, y);
|
||||
macro bool[<*>] int[<*>].comp_le(int[<*>] x, int[<*>] y) => $$veccomple(x, y);
|
||||
macro bool[<*>] int[<*>].comp_eq(int[<*>] x, int[<*>] y) => $$veccompeq(x, y);
|
||||
macro bool[<*>] int[<*>].comp_gt(int[<*>] x, int[<*>] y) => $$veccompgt(x, y);
|
||||
macro bool[<*>] int[<*>].comp_ge(int[<*>] x, int[<*>] y) => $$veccompge(x, y);
|
||||
macro bool[<*>] int[<*>].comp_ne(int[<*>] x, int[<*>] y) => $$veccompne(x, y);
|
||||
|
||||
macro int int[<*>].sum(int[<*>] x) = $$reduce_add(x);
|
||||
macro int int[<*>].product(int[<*>] x) = $$reduce_mul(x);
|
||||
macro int int[<*>].and(int[<*>] x) = $$reduce_and(x);
|
||||
macro int int[<*>].or(int[<*>] x) = $$reduce_or(x);
|
||||
macro int int[<*>].xor(int[<*>] x) = $$reduce_xor(x);
|
||||
macro int int[<*>].max(int[<*>] x) = $$reduce_max(x);
|
||||
macro int int[<*>].min(int[<*>] x) = $$reduce_min(x);
|
||||
macro int int[<*>].sum(int[<*>] x) => $$reduce_add(x);
|
||||
macro int int[<*>].product(int[<*>] x) => $$reduce_mul(x);
|
||||
macro int int[<*>].and(int[<*>] x) => $$reduce_and(x);
|
||||
macro int int[<*>].or(int[<*>] x) => $$reduce_or(x);
|
||||
macro int int[<*>].xor(int[<*>] x) => $$reduce_xor(x);
|
||||
macro int int[<*>].max(int[<*>] x) => $$reduce_max(x);
|
||||
macro int int[<*>].min(int[<*>] x) => $$reduce_min(x);
|
||||
|
||||
macro long long[<*>].sum(long[<*>] x) = $$reduce_add(x);
|
||||
macro long long[<*>].product(long[<*>] x) = $$reduce_mul(x);
|
||||
macro long long[<*>].and(long[<*>] x) = $$reduce_and(x);
|
||||
macro long long[<*>].or(long[<*>] x) = $$reduce_or(x);
|
||||
macro long long[<*>].xor(long[<*>] x) = $$reduce_xor(x);
|
||||
macro long long[<*>].max(long[<*>] x) = $$reduce_max(x);
|
||||
macro long long[<*>].min(long[<*>] x) = $$reduce_min(x);
|
||||
macro long long[<*>].sum(long[<*>] x) => $$reduce_add(x);
|
||||
macro long long[<*>].product(long[<*>] x) => $$reduce_mul(x);
|
||||
macro long long[<*>].and(long[<*>] x) => $$reduce_and(x);
|
||||
macro long long[<*>].or(long[<*>] x) => $$reduce_or(x);
|
||||
macro long long[<*>].xor(long[<*>] x) => $$reduce_xor(x);
|
||||
macro long long[<*>].max(long[<*>] x) => $$reduce_max(x);
|
||||
macro long long[<*>].min(long[<*>] x) => $$reduce_min(x);
|
||||
|
||||
macro int128 int128[<*>].sum(int128[<*>] x) = $$reduce_add(x);
|
||||
macro int128 int128[<*>].product(int128[<*>] x) = $$reduce_mul(x);
|
||||
macro int128 int128[<*>].and(int128[<*>] x) = $$reduce_and(x);
|
||||
macro int128 int128[<*>].or(int128[<*>] x) = $$reduce_or(x);
|
||||
macro int128 int128[<*>].xor(int128[<*>] x) = $$reduce_xor(x);
|
||||
macro int128 int128[<*>].max(int128[<*>] x) = $$reduce_max(x);
|
||||
macro int128 int128[<*>].min(int128[<*>] x) = $$reduce_min(x);
|
||||
macro int128 int128[<*>].sum(int128[<*>] x) => $$reduce_add(x);
|
||||
macro int128 int128[<*>].product(int128[<*>] x) => $$reduce_mul(x);
|
||||
macro int128 int128[<*>].and(int128[<*>] x) => $$reduce_and(x);
|
||||
macro int128 int128[<*>].or(int128[<*>] x) => $$reduce_or(x);
|
||||
macro int128 int128[<*>].xor(int128[<*>] x) => $$reduce_xor(x);
|
||||
macro int128 int128[<*>].max(int128[<*>] x) => $$reduce_max(x);
|
||||
macro int128 int128[<*>].min(int128[<*>] x) => $$reduce_min(x);
|
||||
|
||||
macro bool[<*>] bool[<*>].comp_lt(bool[<*>] x, bool[<*>] y) = $$veccomplt(x, y);
|
||||
macro bool[<*>] bool[<*>].comp_le(bool[<*>] x, bool[<*>] y) = $$veccomple(x, y);
|
||||
macro bool[<*>] bool[<*>].comp_eq(bool[<*>] x, bool[<*>] y) = $$veccompeq(x, y);
|
||||
macro bool[<*>] bool[<*>].comp_gt(bool[<*>] x, bool[<*>] y) = $$veccompgt(x, y);
|
||||
macro bool[<*>] bool[<*>].comp_ge(bool[<*>] x, bool[<*>] y) = $$veccompge(x, y);
|
||||
macro bool[<*>] bool[<*>].comp_ne(bool[<*>] x, bool[<*>] y) = $$veccompne(x, y);
|
||||
macro bool[<*>] bool[<*>].comp_lt(bool[<*>] x, bool[<*>] y) => $$veccomplt(x, y);
|
||||
macro bool[<*>] bool[<*>].comp_le(bool[<*>] x, bool[<*>] y) => $$veccomple(x, y);
|
||||
macro bool[<*>] bool[<*>].comp_eq(bool[<*>] x, bool[<*>] y) => $$veccompeq(x, y);
|
||||
macro bool[<*>] bool[<*>].comp_gt(bool[<*>] x, bool[<*>] y) => $$veccompgt(x, y);
|
||||
macro bool[<*>] bool[<*>].comp_ge(bool[<*>] x, bool[<*>] y) => $$veccompge(x, y);
|
||||
macro bool[<*>] bool[<*>].comp_ne(bool[<*>] x, bool[<*>] y) => $$veccompne(x, y);
|
||||
|
||||
macro bool bool[<*>].sum(bool[<*>] x) = $$reduce_add(x);
|
||||
macro bool bool[<*>].product(bool[<*>] x) = $$reduce_mul(x);
|
||||
macro bool bool[<*>].and(bool[<*>] x) = $$reduce_and(x);
|
||||
macro bool bool[<*>].or(bool[<*>] x) = $$reduce_or(x);
|
||||
macro bool bool[<*>].xor(bool[<*>] x) = $$reduce_xor(x);
|
||||
macro bool bool[<*>].max(bool[<*>] x) = $$reduce_max(x);
|
||||
macro bool bool[<*>].min(bool[<*>] x) = $$reduce_min(x);
|
||||
macro bool bool[<*>].sum(bool[<*>] x) => $$reduce_add(x);
|
||||
macro bool bool[<*>].product(bool[<*>] x) => $$reduce_mul(x);
|
||||
macro bool bool[<*>].and(bool[<*>] x) => $$reduce_and(x);
|
||||
macro bool bool[<*>].or(bool[<*>] x) => $$reduce_or(x);
|
||||
macro bool bool[<*>].xor(bool[<*>] x) => $$reduce_xor(x);
|
||||
macro bool bool[<*>].max(bool[<*>] x) => $$reduce_max(x);
|
||||
macro bool bool[<*>].min(bool[<*>] x) => $$reduce_min(x);
|
||||
|
||||
macro char char[<*>].sum(char[<*>] x) = $$reduce_add(x);
|
||||
macro char char[<*>].product(char[<*>] x) = $$reduce_mul(x);
|
||||
macro char char[<*>].and(char[<*>] x) = $$reduce_and(x);
|
||||
macro char char[<*>].or(char[<*>] x) = $$reduce_or(x);
|
||||
macro char char[<*>].xor(char[<*>] x) = $$reduce_xor(x);
|
||||
macro char char[<*>].max(char[<*>] x) = $$reduce_max(x);
|
||||
macro char char[<*>].min(char[<*>] x) = $$reduce_min(x);
|
||||
macro char char[<*>].sum(char[<*>] x) => $$reduce_add(x);
|
||||
macro char char[<*>].product(char[<*>] x) => $$reduce_mul(x);
|
||||
macro char char[<*>].and(char[<*>] x) => $$reduce_and(x);
|
||||
macro char char[<*>].or(char[<*>] x) => $$reduce_or(x);
|
||||
macro char char[<*>].xor(char[<*>] x) => $$reduce_xor(x);
|
||||
macro char char[<*>].max(char[<*>] x) => $$reduce_max(x);
|
||||
macro char char[<*>].min(char[<*>] x) => $$reduce_min(x);
|
||||
|
||||
|
||||
macro ushort ushort[<*>].sum(ushort[<*>] x) = $$reduce_add(x);
|
||||
macro ushort ushort[<*>].product(ushort[<*>] x) = $$reduce_mul(x);
|
||||
macro ushort ushort[<*>].and(ushort[<*>] x) = $$reduce_and(x);
|
||||
macro ushort ushort[<*>].or(ushort[<*>] x) = $$reduce_or(x);
|
||||
macro ushort ushort[<*>].xor(ushort[<*>] x) = $$reduce_xor(x);
|
||||
macro ushort ushort[<*>].max(ushort[<*>] x) = $$reduce_max(x);
|
||||
macro ushort ushort[<*>].min(ushort[<*>] x) = $$reduce_min(x);
|
||||
macro ushort ushort[<*>].sum(ushort[<*>] x) => $$reduce_add(x);
|
||||
macro ushort ushort[<*>].product(ushort[<*>] x) => $$reduce_mul(x);
|
||||
macro ushort ushort[<*>].and(ushort[<*>] x) => $$reduce_and(x);
|
||||
macro ushort ushort[<*>].or(ushort[<*>] x) => $$reduce_or(x);
|
||||
macro ushort ushort[<*>].xor(ushort[<*>] x) => $$reduce_xor(x);
|
||||
macro ushort ushort[<*>].max(ushort[<*>] x) => $$reduce_max(x);
|
||||
macro ushort ushort[<*>].min(ushort[<*>] x) => $$reduce_min(x);
|
||||
|
||||
macro uint uint[<*>].sum(uint[<*>] x) = $$reduce_add(x);
|
||||
macro uint uint[<*>].product(uint[<*>] x) = $$reduce_mul(x);
|
||||
macro uint uint[<*>].and(uint[<*>] x) = $$reduce_and(x);
|
||||
macro uint uint[<*>].or(uint[<*>] x) = $$reduce_or(x);
|
||||
macro uint uint[<*>].xor(uint[<*>] x) = $$reduce_xor(x);
|
||||
macro uint uint[<*>].max(uint[<*>] x) = $$reduce_max(x);
|
||||
macro uint uint[<*>].min(uint[<*>] x) = $$reduce_min(x);
|
||||
macro uint uint[<*>].sum(uint[<*>] x) => $$reduce_add(x);
|
||||
macro uint uint[<*>].product(uint[<*>] x) => $$reduce_mul(x);
|
||||
macro uint uint[<*>].and(uint[<*>] x) => $$reduce_and(x);
|
||||
macro uint uint[<*>].or(uint[<*>] x) => $$reduce_or(x);
|
||||
macro uint uint[<*>].xor(uint[<*>] x) => $$reduce_xor(x);
|
||||
macro uint uint[<*>].max(uint[<*>] x) => $$reduce_max(x);
|
||||
macro uint uint[<*>].min(uint[<*>] x) => $$reduce_min(x);
|
||||
|
||||
macro ulong ulong[<*>].sum(ulong[<*>] x) = $$reduce_add(x);
|
||||
macro ulong ulong[<*>].product(ulong[<*>] x) = $$reduce_mul(x);
|
||||
macro ulong ulong[<*>].and(ulong[<*>] x) = $$reduce_and(x);
|
||||
macro ulong ulong[<*>].or(ulong[<*>] x) = $$reduce_or(x);
|
||||
macro ulong ulong[<*>].xor(ulong[<*>] x) = $$reduce_xor(x);
|
||||
macro ulong ulong[<*>].max(ulong[<*>] x) = $$reduce_max(x);
|
||||
macro ulong ulong[<*>].min(ulong[<*>] x) = $$reduce_min(x);
|
||||
macro ulong ulong[<*>].sum(ulong[<*>] x) => $$reduce_add(x);
|
||||
macro ulong ulong[<*>].product(ulong[<*>] x) => $$reduce_mul(x);
|
||||
macro ulong ulong[<*>].and(ulong[<*>] x) => $$reduce_and(x);
|
||||
macro ulong ulong[<*>].or(ulong[<*>] x) => $$reduce_or(x);
|
||||
macro ulong ulong[<*>].xor(ulong[<*>] x) => $$reduce_xor(x);
|
||||
macro ulong ulong[<*>].max(ulong[<*>] x) => $$reduce_max(x);
|
||||
macro ulong ulong[<*>].min(ulong[<*>] x) => $$reduce_min(x);
|
||||
|
||||
macro uint128 uint128[<*>].sum(uint128[<*>] x) = $$reduce_add(x);
|
||||
macro uint128 uint128[<*>].product(uint128[<*>] x) = $$reduce_mul(x);
|
||||
macro uint128 uint128[<*>].and(uint128[<*>] x) = $$reduce_and(x);
|
||||
macro uint128 uint128[<*>].or(uint128[<*>] x) = $$reduce_or(x);
|
||||
macro uint128 uint128[<*>].xor(uint128[<*>] x) = $$reduce_xor(x);
|
||||
macro uint128 uint128[<*>].max(uint128[<*>] x) = $$reduce_max(x);
|
||||
macro uint128 uint128[<*>].min(uint128[<*>] x) = $$reduce_min(x);
|
||||
macro uint128 uint128[<*>].sum(uint128[<*>] x) => $$reduce_add(x);
|
||||
macro uint128 uint128[<*>].product(uint128[<*>] x) => $$reduce_mul(x);
|
||||
macro uint128 uint128[<*>].and(uint128[<*>] x) => $$reduce_and(x);
|
||||
macro uint128 uint128[<*>].or(uint128[<*>] x) => $$reduce_or(x);
|
||||
macro uint128 uint128[<*>].xor(uint128[<*>] x) => $$reduce_xor(x);
|
||||
macro uint128 uint128[<*>].max(uint128[<*>] x) => $$reduce_max(x);
|
||||
macro uint128 uint128[<*>].min(uint128[<*>] x) => $$reduce_min(x);
|
||||
|
||||
/**
|
||||
* @checked x & 1
|
||||
|
||||
@@ -10,18 +10,15 @@ union Complex
|
||||
}
|
||||
|
||||
|
||||
macro Complex identity() = { 1, 0 };
|
||||
macro Complex Complex.add(Complex a, Complex b) = Complex { .v = a.v + b.v };
|
||||
macro Complex Complex.add_each(Complex a, Real b) = Complex { .v = a.v + b };
|
||||
macro Complex Complex.sub(Complex a, Complex b) = Complex { .v = a.v - b.v };
|
||||
macro Complex Complex.sub_each(Complex a, Real b) = Complex { .v = a.v - b };
|
||||
macro Complex Complex.scale(Complex a, Real s) = Complex { .v = a.v * s };
|
||||
macro Complex Complex.mul(Complex a, Complex b)
|
||||
{
|
||||
return { .r = a.r * b.r - a.c * b.c, .c = a.r * b.c + b.r * a.c };
|
||||
}
|
||||
macro Complex identity() => { 1, 0 };
|
||||
macro Complex Complex.add(Complex a, Complex b) => Complex { .v = a.v + b.v };
|
||||
macro Complex Complex.add_each(Complex a, Real b) => Complex { .v = a.v + b };
|
||||
macro Complex Complex.sub(Complex a, Complex b) => Complex { .v = a.v - b.v };
|
||||
macro Complex Complex.sub_each(Complex a, Real b) => Complex { .v = a.v - b };
|
||||
macro Complex Complex.scale(Complex a, Real s) => Complex { .v = a.v * s };
|
||||
macro Complex Complex.mul(Complex a, Complex b) => { a.r * b.r - a.c * b.c, a.r * b.c + b.r * a.c };
|
||||
macro Complex Complex.div(Complex a, Complex b)
|
||||
{
|
||||
Real div = b.r * b.r + b.c * b.c;
|
||||
return Complex { .r = (a.r * b.r + a.c * b.c) / div, .c = (a.c * b.r - a.r * b.c) / div };
|
||||
Real div = b.v.dot(b.v);
|
||||
return Complex{ (a.r * b.r + a.c * b.c) / div, (a.c * b.r - a.r * b.c) / div };
|
||||
}
|
||||
|
||||
@@ -120,17 +120,17 @@ fn Matrix4x4 Matrix4x4.mul(Matrix4x4* a, Matrix4x4 b)
|
||||
};
|
||||
}
|
||||
|
||||
fn Matrix2x2 Matrix2x2.component_mul(Matrix2x2* mat, Real s) = matrix_component_mul(mat, s);
|
||||
fn Matrix3x3 Matrix3x3.component_mul(Matrix3x3* mat, Real s) = matrix_component_mul(mat, s);
|
||||
fn Matrix4x4 Matrix4x4.component_mul(Matrix4x4* mat, Real s) = matrix_component_mul(mat, s);
|
||||
fn Matrix2x2 Matrix2x2.component_mul(Matrix2x2* mat, Real s) => matrix_component_mul(mat, s);
|
||||
fn Matrix3x3 Matrix3x3.component_mul(Matrix3x3* mat, Real s) => matrix_component_mul(mat, s);
|
||||
fn Matrix4x4 Matrix4x4.component_mul(Matrix4x4* mat, Real s) => matrix_component_mul(mat, s);
|
||||
|
||||
fn Matrix2x2 Matrix2x2.add(Matrix2x2* mat, Matrix2x2 mat2) = matrix_add(mat, mat2);
|
||||
fn Matrix3x3 Matrix3x3.add(Matrix3x3* mat, Matrix3x3 mat2) = matrix_add(mat, mat2);
|
||||
fn Matrix4x4 Matrix4x4.add(Matrix4x4* mat, Matrix4x4 mat2) = matrix_add(mat, mat2);
|
||||
fn Matrix2x2 Matrix2x2.add(Matrix2x2* mat, Matrix2x2 mat2) => matrix_add(mat, mat2);
|
||||
fn Matrix3x3 Matrix3x3.add(Matrix3x3* mat, Matrix3x3 mat2) => matrix_add(mat, mat2);
|
||||
fn Matrix4x4 Matrix4x4.add(Matrix4x4* mat, Matrix4x4 mat2) => matrix_add(mat, mat2);
|
||||
|
||||
fn Matrix2x2 Matrix2x2.sub(Matrix2x2* mat, Matrix2x2 mat2) = matrix_sub(mat, mat2);
|
||||
fn Matrix3x3 Matrix3x3.sub(Matrix3x3* mat, Matrix3x3 mat2) = matrix_sub(mat, mat2);
|
||||
fn Matrix4x4 Matrix4x4.sub(Matrix4x4* mat, Matrix4x4 mat2) = matrix_sub(mat, mat2);
|
||||
fn Matrix2x2 Matrix2x2.sub(Matrix2x2* mat, Matrix2x2 mat2) => matrix_sub(mat, mat2);
|
||||
fn Matrix3x3 Matrix3x3.sub(Matrix3x3* mat, Matrix3x3 mat2) => matrix_sub(mat, mat2);
|
||||
fn Matrix4x4 Matrix4x4.sub(Matrix4x4* mat, Matrix4x4 mat2) => matrix_sub(mat, mat2);
|
||||
|
||||
|
||||
|
||||
@@ -370,9 +370,9 @@ fn Matrix3x3 Matrix3x3.scale(Matrix3x3* m, Real[<2>] v)
|
||||
});
|
||||
}
|
||||
|
||||
fn Real Matrix2x2.trace(Matrix2x2* m) = m.m00 + m.m11;
|
||||
fn Real Matrix3x3.trace(Matrix3x3* m) = m.m00 + m.m11 + m.m22;
|
||||
fn Real Matrix4x4.trace(Matrix4x4* m) = m.m00 + m.m11 + m.m22 + m.m33;
|
||||
fn Real Matrix2x2.trace(Matrix2x2* m) => m.m00 + m.m11;
|
||||
fn Real Matrix3x3.trace(Matrix3x3* m) => m.m00 + m.m11 + m.m22;
|
||||
fn Real Matrix4x4.trace(Matrix4x4* m) => m.m00 + m.m11 + m.m22 + m.m33;
|
||||
|
||||
fn Matrix4x4 Matrix4x4.scale(Matrix4x4* m, Real[<3>] v)
|
||||
{
|
||||
|
||||
@@ -36,19 +36,19 @@ module std::math::easing;
|
||||
*/
|
||||
|
||||
// Linear Easing functions
|
||||
fn float linear_none(float t, float b, float c, float d) @inline = c * t / d + b;
|
||||
fn float linear_in(float t, float b, float c, float d) @inline = c * t / d + b;
|
||||
fn float linear_out(float t, float b, float c, float d) @inline = c * t / d + b;
|
||||
fn float linear_inout(float t, float b, float c, float d) @inline = c * t / d + b;
|
||||
fn float linear_none(float t, float b, float c, float d) @inline => c * t / d + b;
|
||||
fn float linear_in(float t, float b, float c, float d) @inline => c * t / d + b;
|
||||
fn float linear_out(float t, float b, float c, float d) @inline => c * t / d + b;
|
||||
fn float linear_inout(float t, float b, float c, float d) @inline => c * t / d + b;
|
||||
|
||||
// Sine Easing functions
|
||||
fn float sine_in(float t, float b, float c, float d) @inline = -c * math::cos(t / d * (float)math::PI_2) + c + b;
|
||||
fn float sine_out(float t, float b, float c, float d) @inline = c * math::sin(t / d * (float)math::PI_2) + b;
|
||||
fn float sine_inout(float t, float b, float c, float d) @inline = (-c / 2) * (math::cos((float)math::PI * t / d) - 1) + b;
|
||||
fn float sine_in(float t, float b, float c, float d) @inline => -c * math::cos(t / d * (float)math::PI_2) + c + b;
|
||||
fn float sine_out(float t, float b, float c, float d) @inline => c * math::sin(t / d * (float)math::PI_2) + b;
|
||||
fn float sine_inout(float t, float b, float c, float d) @inline => (-c / 2) * (math::cos((float)math::PI * t / d) - 1) + b;
|
||||
|
||||
// Circular Easing functions
|
||||
fn float circ_in(float t, float b, float c, float d) @inline = -c * (math::sqrt(1 - sq(t / d)) - 1) + b;
|
||||
fn float circ_out(float t, float b, float c, float d) @inline = c * math::sqrt(1 - sq(t / d - 1)) + b;
|
||||
fn float circ_in(float t, float b, float c, float d) @inline => -c * (math::sqrt(1 - sq(t / d)) - 1) + b;
|
||||
fn float circ_out(float t, float b, float c, float d) @inline => c * math::sqrt(1 - sq(t / d - 1)) + b;
|
||||
fn float circ_inout(float t, float b, float c, float d) @inline
|
||||
{
|
||||
t /= d / 2;
|
||||
@@ -58,8 +58,8 @@ fn float circ_inout(float t, float b, float c, float d) @inline
|
||||
}
|
||||
|
||||
// Cubic Easing functions
|
||||
fn float cubic_in(float t, float b, float c, float d) @inline = c * cube(t / d) + b;
|
||||
fn float cubic_out(float t, float b, float c, float d) @inline = c * (cube(t / d - 1) + 1) + b;
|
||||
fn float cubic_in(float t, float b, float c, float d) @inline => c * cube(t / d) + b;
|
||||
fn float cubic_out(float t, float b, float c, float d) @inline => c * (cube(t / d - 1) + 1) + b;
|
||||
fn float cubic_inout(float t, float b, float c, float d) @inline
|
||||
{
|
||||
t /= d / 2;
|
||||
@@ -69,7 +69,7 @@ fn float cubic_inout(float t, float b, float c, float d) @inline
|
||||
}
|
||||
|
||||
// Quadratic Easing functions
|
||||
fn float quad_in(float t, float b, float c, float d) @inline = c * sq(t / d) + b;
|
||||
fn float quad_in(float t, float b, float c, float d) @inline => c * sq(t / d) + b;
|
||||
fn float quad_out(float t, float b, float c, float d) @inline
|
||||
{
|
||||
t /= d;
|
||||
@@ -85,7 +85,7 @@ fn float quad_inout(float t, float b, float c, float d) @inline
|
||||
}
|
||||
|
||||
// Exponential Easing functions
|
||||
fn float expo_in(float t, float b, float c, float d) @inline = t ? b : c * math::pow(2.0f, 10 * (t / d - 1)) + b;
|
||||
fn float expo_in(float t, float b, float c, float d) @inline => t ? b : c * math::pow(2.0f, 10 * (t / d - 1)) + b;
|
||||
fn float expo_out(float t, float b, float c, float d) @inline
|
||||
{
|
||||
return (t == d) ? b + c : c * (-math::pow(2.0f, -10 * t / d) + 1) + b;
|
||||
@@ -145,7 +145,7 @@ fn float bounce_out(float t, float b, float c, float d) @inline
|
||||
}
|
||||
}
|
||||
|
||||
fn float bounce_in(float t, float b, float c, float d) @inline = c - bounce_out(d - t, 0, c, d) + b;
|
||||
fn float bounce_in(float t, float b, float c, float d) @inline => c - bounce_out(d - t, 0, c, d) + b;
|
||||
fn float bounce_inout(float t, float b, float c, float d) @inline
|
||||
{
|
||||
return t < d / 2
|
||||
@@ -196,6 +196,6 @@ fn float elastic_inout(float t, float b, float c, float d) @inline
|
||||
: a * math::pow(2.0f, -10 * t) * math::sin((t * d - s) * (2 * (float)math::PI) / p) * 0.5f + c + b;
|
||||
}
|
||||
|
||||
private macro sq(x) = x * x;
|
||||
private macro cube(x) = x * x * x;
|
||||
private macro sq(x) => x * x;
|
||||
private macro cube(x) => x * x * x;
|
||||
|
||||
|
||||
@@ -70,14 +70,14 @@ fn int128 __modti3(int128 a, int128 b) @extname("__modti3") @weak
|
||||
return __umodti3(unsigned_a, unsigned_b) ^ sign + (-sign);
|
||||
}
|
||||
|
||||
fn float __floattisf(int128 a) @extname("__floattisf") @weak = float_from_i128(float, a);
|
||||
fn double __floattidf(int128 a) @extname("__floattidf") @weak = float_from_i128(double, a);
|
||||
fn float __floatuntisf(uint128 a) @extname("__floatuntisf") @weak = float_from_u128(float, a);
|
||||
fn double __floatuntidf(uint128 a) @extname("__floatuntidf") @weak = float_from_u128(double, a);
|
||||
fn uint128 __fixunsdfti(double a) @weak @extname("__fixunsdfti") = fixuint(a);
|
||||
fn uint128 __fixunssfti(float a) @weak @extname("__fixunssfti") = fixuint(a);
|
||||
fn int128 __fixdfti(double a) @weak @extname("__fixdfti") = fixint(a);
|
||||
fn int128 __fixsfti(float a) @weak @extname("__fixsfti") = fixint(a);
|
||||
fn float __floattisf(int128 a) @extname("__floattisf") @weak => float_from_i128(float, a);
|
||||
fn double __floattidf(int128 a) @extname("__floattidf") @weak => float_from_i128(double, a);
|
||||
fn float __floatuntisf(uint128 a) @extname("__floatuntisf") @weak => float_from_u128(float, a);
|
||||
fn double __floatuntidf(uint128 a) @extname("__floatuntidf") @weak => float_from_u128(double, a);
|
||||
fn uint128 __fixunsdfti(double a) @weak @extname("__fixunsdfti") => fixuint(a);
|
||||
fn uint128 __fixunssfti(float a) @weak @extname("__fixunssfti") => fixuint(a);
|
||||
fn int128 __fixdfti(double a) @weak @extname("__fixdfti") => fixint(a);
|
||||
fn int128 __fixsfti(float a) @weak @extname("__fixsfti") => fixint(a);
|
||||
|
||||
|
||||
private macro float_from_i128($Type, a)
|
||||
|
||||
@@ -9,16 +9,16 @@ union Quaternion
|
||||
Real[<4>] v;
|
||||
}
|
||||
|
||||
macro Quaternion identity() = { 0, 0, 0, 1 };
|
||||
macro Quaternion Quaternion.add(Quaternion a, Quaternion b) = Quaternion { .v = a.v + b.v };
|
||||
macro Quaternion Quaternion.add_each(Quaternion a, Real b) = Quaternion { .v = a.v + b };
|
||||
macro Quaternion Quaternion.sub(Quaternion a, Quaternion b) = Quaternion { .v = a.v - b.v };
|
||||
macro Quaternion Quaternion.sub_each(Quaternion a, Real b) = Quaternion { .v = a.v - b };
|
||||
macro Quaternion Quaternion.scale(Quaternion a, Real s) = Quaternion { .v = a.v * s };
|
||||
macro Quaternion Quaternion.normalize(Quaternion q) = { .v = q.v.normalize() };
|
||||
macro Real Quaternion.length(Quaternion q) = q.v.length();
|
||||
macro Quaternion Quaternion.lerp(Quaternion q1, Quaternion q2, Real amount) = { .v = q1.v.lerp(q2.v, amount) };
|
||||
fn Quaternion Quaternion.nlerp(Quaternion q1, Quaternion q2, Real amount) = { .v = q1.v.lerp(q2.v, amount).normalize() };
|
||||
macro Quaternion identity() => { 0, 0, 0, 1 };
|
||||
macro Quaternion Quaternion.add(Quaternion a, Quaternion b) => Quaternion { .v = a.v + b.v };
|
||||
macro Quaternion Quaternion.add_each(Quaternion a, Real b) => Quaternion { .v = a.v + b };
|
||||
macro Quaternion Quaternion.sub(Quaternion a, Quaternion b) => Quaternion { .v = a.v - b.v };
|
||||
macro Quaternion Quaternion.sub_each(Quaternion a, Real b) => Quaternion { .v = a.v - b };
|
||||
macro Quaternion Quaternion.scale(Quaternion a, Real s) => Quaternion { .v = a.v * s };
|
||||
macro Quaternion Quaternion.normalize(Quaternion q) => { .v = q.v.normalize() };
|
||||
macro Real Quaternion.length(Quaternion q) => q.v.length();
|
||||
macro Quaternion Quaternion.lerp(Quaternion q1, Quaternion q2, Real amount) => { .v = q1.v.lerp(q2.v, amount) };
|
||||
fn Quaternion Quaternion.nlerp(Quaternion q1, Quaternion q2, Real amount) => { .v = q1.v.lerp(q2.v, amount).normalize() };
|
||||
|
||||
fn Quaternion Quaternion.invert(Quaternion q)
|
||||
{
|
||||
|
||||
@@ -9,74 +9,74 @@ define Vec2 = double[<2>];
|
||||
define Vec3 = double[<3>];
|
||||
define Vec4 = double[<4>];
|
||||
|
||||
macro Vec2f.length_sq(Vec2f v) = v.dot(v);
|
||||
macro Vec3f.length_sq(Vec3f v) = v.dot(v);
|
||||
macro Vec4f.length_sq(Vec4f v) = v.dot(v);
|
||||
macro Vec2.length_sq(Vec2 v) = v.dot(v);
|
||||
macro Vec3.length_sq(Vec3 v) = v.dot(v);
|
||||
macro Vec4.length_sq(Vec4 v) = v.dot(v);
|
||||
macro Vec2f.length_sq(Vec2f v) => v.dot(v);
|
||||
macro Vec3f.length_sq(Vec3f v) => v.dot(v);
|
||||
macro Vec4f.length_sq(Vec4f v) => v.dot(v);
|
||||
macro Vec2.length_sq(Vec2 v) => v.dot(v);
|
||||
macro Vec3.length_sq(Vec3 v) => v.dot(v);
|
||||
macro Vec4.length_sq(Vec4 v) => v.dot(v);
|
||||
|
||||
macro Vec2f.distance_sq(Vec2f v1, Vec2f v2) = (v1 - v2).length_sq();
|
||||
macro Vec3f.distance_sq(Vec3f v1, Vec3f v2) = (v1 - v2).length_sq();
|
||||
macro Vec4f.distance_sq(Vec4f v1, Vec4f v2) = (v1 - v2).length_sq();
|
||||
macro Vec2.distance_sq(Vec2 v1, Vec2 v2) = (v1 - v2).length_sq();
|
||||
macro Vec3.distance_sq(Vec3 v1, Vec3 v2) = (v1 - v2).length_sq();
|
||||
macro Vec4.distance_sq(Vec4 v1, Vec4 v2) = (v1 - v2).length_sq();
|
||||
macro Vec2f.distance_sq(Vec2f v1, Vec2f v2) => (v1 - v2).length_sq();
|
||||
macro Vec3f.distance_sq(Vec3f v1, Vec3f v2) => (v1 - v2).length_sq();
|
||||
macro Vec4f.distance_sq(Vec4f v1, Vec4f v2) => (v1 - v2).length_sq();
|
||||
macro Vec2.distance_sq(Vec2 v1, Vec2 v2) => (v1 - v2).length_sq();
|
||||
macro Vec3.distance_sq(Vec3 v1, Vec3 v2) => (v1 - v2).length_sq();
|
||||
macro Vec4.distance_sq(Vec4 v1, Vec4 v2) => (v1 - v2).length_sq();
|
||||
|
||||
macro Vec2f.transform(Vec2f v, Matrix4f mat) = transform2(v, mat);
|
||||
macro Vec2f.rotate(Vec2f v, float angle) = rotate(v, angle);
|
||||
macro Vec2f.angle(Vec2f v1, Vec2f v2) = math::atan2(v2[1], v2[0]) - math::atan2(v1[1], v2[0]);
|
||||
macro Vec2f.transform(Vec2f v, Matrix4f mat) => transform2(v, mat);
|
||||
macro Vec2f.rotate(Vec2f v, float angle) => rotate(v, angle);
|
||||
macro Vec2f.angle(Vec2f v1, Vec2f v2) => math::atan2(v2[1], v2[0]) - math::atan2(v1[1], v2[0]);
|
||||
|
||||
macro Vec2.transform(Vec2 v, Matrix4 mat) = transform2(v, mat);
|
||||
macro Vec2.rotate(Vec2 v, double angle) = rotate(v, angle);
|
||||
macro Vec2.angle(Vec2 v1, Vec2 v2) = math::atan2(v2[1], v2[0]) - math::atan2(v1[1], v2[0]);
|
||||
macro Vec2.transform(Vec2 v, Matrix4 mat) => transform2(v, mat);
|
||||
macro Vec2.rotate(Vec2 v, double angle) => rotate(v, angle);
|
||||
macro Vec2.angle(Vec2 v1, Vec2 v2) => math::atan2(v2[1], v2[0]) - math::atan2(v1[1], v2[0]);
|
||||
|
||||
macro Vec2f.clamp_mag(Vec2f v, float min, float max) = clamp_magnitude(v, min, max);
|
||||
macro Vec3f.clamp_mag(Vec3f v, float min, float max) = clamp_magnitude(v, min, max);
|
||||
macro Vec4f.clamp_mag(Vec4f v, float min, float max) = clamp_magnitude(v, min, max);
|
||||
macro Vec2.clamp_mag(Vec2 v, double min, double max) = clamp_magnitude(v, min, max);
|
||||
macro Vec3.clamp_mag(Vec3 v, double min, double max) = clamp_magnitude(v, min, max);
|
||||
macro Vec4.clamp_mag(Vec4 v, double min, double max) = clamp_magnitude(v, min, max);
|
||||
macro Vec2f.clamp_mag(Vec2f v, float min, float max) => clamp_magnitude(v, min, max);
|
||||
macro Vec3f.clamp_mag(Vec3f v, float min, float max) => clamp_magnitude(v, min, max);
|
||||
macro Vec4f.clamp_mag(Vec4f v, float min, float max) => clamp_magnitude(v, min, max);
|
||||
macro Vec2.clamp_mag(Vec2 v, double min, double max) => clamp_magnitude(v, min, max);
|
||||
macro Vec3.clamp_mag(Vec3 v, double min, double max) => clamp_magnitude(v, min, max);
|
||||
macro Vec4.clamp_mag(Vec4 v, double min, double max) => clamp_magnitude(v, min, max);
|
||||
|
||||
fn Vec2f Vec2f.towards(Vec2f v, Vec2f target, float max_distance) = towards(v, target, max_distance);
|
||||
fn Vec3f Vec3f.towards(Vec3f v, Vec3f target, float max_distance) = towards(v, target, max_distance);
|
||||
fn Vec4f Vec4f.towards(Vec4f v, Vec4f target, float max_distance) = towards(v, target, max_distance);
|
||||
fn Vec2 Vec2.towards(Vec2 v, Vec2 target, double max_distance) = towards(v, target, max_distance);
|
||||
fn Vec3 Vec3.towards(Vec3 v, Vec3 target, double max_distance) = towards(v, target, max_distance);
|
||||
fn Vec4 Vec4.towards(Vec4 v, Vec4 target, double max_distance) = towards(v, target, max_distance);
|
||||
fn Vec2f Vec2f.towards(Vec2f v, Vec2f target, float max_distance) => towards(v, target, max_distance);
|
||||
fn Vec3f Vec3f.towards(Vec3f v, Vec3f target, float max_distance) => towards(v, target, max_distance);
|
||||
fn Vec4f Vec4f.towards(Vec4f v, Vec4f target, float max_distance) => towards(v, target, max_distance);
|
||||
fn Vec2 Vec2.towards(Vec2 v, Vec2 target, double max_distance) => towards(v, target, max_distance);
|
||||
fn Vec3 Vec3.towards(Vec3 v, Vec3 target, double max_distance) => towards(v, target, max_distance);
|
||||
fn Vec4 Vec4.towards(Vec4 v, Vec4 target, double max_distance) => towards(v, target, max_distance);
|
||||
|
||||
fn Vec3f Vec3f.cross(Vec3f v1, Vec3f v2) = cross3(v1, v2);
|
||||
fn Vec3 Vec3.cross(Vec3 v1, Vec3 v2) = cross3(v1, v2);
|
||||
fn Vec3f Vec3f.cross(Vec3f v1, Vec3f v2) => cross3(v1, v2);
|
||||
fn Vec3 Vec3.cross(Vec3 v1, Vec3 v2) => cross3(v1, v2);
|
||||
|
||||
fn Vec3f Vec3f.perpendicular(Vec3f v) = perpendicular3(v);
|
||||
fn Vec3 Vec3.perpendicular(Vec3 v) = perpendicular3(v);
|
||||
fn Vec3f Vec3f.perpendicular(Vec3f v) => perpendicular3(v);
|
||||
fn Vec3 Vec3.perpendicular(Vec3 v) => perpendicular3(v);
|
||||
|
||||
fn Vec3f Vec3f.barycenter(Vec3f p, Vec3f a, Vec3f b, Vec3f c) = barycenter3(p, a, b, c);
|
||||
fn Vec3 Vec3.barycenter(Vec3 p, Vec3 a, Vec3 b, Vec3 c) = barycenter3(p, a, b, c);
|
||||
fn Vec3f Vec3f.barycenter(Vec3f p, Vec3f a, Vec3f b, Vec3f c) => barycenter3(p, a, b, c);
|
||||
fn Vec3 Vec3.barycenter(Vec3 p, Vec3 a, Vec3 b, Vec3 c) => barycenter3(p, a, b, c);
|
||||
|
||||
fn Vec3f Vec3f.transform(Vec3f v, Matrix4f mat) = transform3(v, mat);
|
||||
fn Vec3 Vec3.transform(Vec3 v, Matrix4 mat) = transform3(v, mat);
|
||||
fn Vec3f Vec3f.transform(Vec3f v, Matrix4f mat) => transform3(v, mat);
|
||||
fn Vec3 Vec3.transform(Vec3 v, Matrix4 mat) => transform3(v, mat);
|
||||
|
||||
fn float Vec3f.angle(Vec3f v1, Vec3f v2) = angle3(v1, v2);
|
||||
fn double Vec3.angle(Vec3 v1, Vec3 v2) = angle3(v1, v2);
|
||||
fn float Vec3f.angle(Vec3f v1, Vec3f v2) => angle3(v1, v2);
|
||||
fn double Vec3.angle(Vec3 v1, Vec3 v2) => angle3(v1, v2);
|
||||
|
||||
fn Vec3f Vec3f.refract(Vec3f v, Vec3f n, float r) = refract3(v, n, r);
|
||||
fn Vec3 Vec3.refract(Vec3 v, Vec3 n, double r) = refract3(v, n, r);
|
||||
fn Vec3f Vec3f.refract(Vec3f v, Vec3f n, float r) => refract3(v, n, r);
|
||||
fn Vec3 Vec3.refract(Vec3 v, Vec3 n, double r) => refract3(v, n, r);
|
||||
|
||||
fn void ortho_normalize(Vec3f* v1, Vec3f* v2) = ortho_normalize3(v1, v2);
|
||||
fn void ortho_normalized(Vec3* v1, Vec3* v2) = ortho_normalize3(v1, v2);
|
||||
fn void ortho_normalize(Vec3f* v1, Vec3f* v2) => ortho_normalize3(v1, v2);
|
||||
fn void ortho_normalized(Vec3* v1, Vec3* v2) => ortho_normalize3(v1, v2);
|
||||
|
||||
fn Matrix4f matrix4f_look_at(Vec3f eye, Vec3f target, Vec3f up) = matrix_look_at(Matrix4f, eye, target, up);
|
||||
fn Matrix4 matrix4_look_at(Vec3 eye, Vec3 target, Vec3 up) = matrix_look_at(Matrix4, eye, target, up);
|
||||
fn Matrix4f matrix4f_look_at(Vec3f eye, Vec3f target, Vec3f up) => matrix_look_at(Matrix4f, eye, target, up);
|
||||
fn Matrix4 matrix4_look_at(Vec3 eye, Vec3 target, Vec3 up) => matrix_look_at(Matrix4, eye, target, up);
|
||||
|
||||
fn Vec3f Vec3f.rotate_quat(Vec3f v, Quaternionf q) = rotate_by_quat3(v, q);
|
||||
fn Vec3 Vec3.rotate_quat(Vec3 v, Quaternion q) = rotate_by_quat3(v, q);
|
||||
fn Vec3f Vec3f.rotate_quat(Vec3f v, Quaternionf q) => rotate_by_quat3(v, q);
|
||||
fn Vec3 Vec3.rotate_quat(Vec3 v, Quaternion q) => rotate_by_quat3(v, q);
|
||||
|
||||
fn Vec3f Vec3f.rotate_axis(Vec3f v, Vec3f axis, float angle) = rotate_axis_angle(v, axis, angle);
|
||||
fn Vec3 Vec3.rotate_axis(Vec3 v, Vec3 axis, double angle) = rotate_axis_angle(v, axis, angle);
|
||||
fn Vec3f Vec3f.rotate_axis(Vec3f v, Vec3f axis, float angle) => rotate_axis_angle(v, axis, angle);
|
||||
fn Vec3 Vec3.rotate_axis(Vec3 v, Vec3 axis, double angle) => rotate_axis_angle(v, axis, angle);
|
||||
|
||||
fn Vec3f Vec3f.unproject(Vec3f v, Matrix4f projection, Matrix4f view) = unproject3(v, projection, view);
|
||||
fn Vec3 Vec3.unproject(Vec3 v, Matrix4 projection, Matrix4 view) = unproject3(v, projection, view);
|
||||
fn Vec3f Vec3f.unproject(Vec3f v, Matrix4f projection, Matrix4f view) => unproject3(v, projection, view);
|
||||
fn Vec3 Vec3.unproject(Vec3 v, Matrix4 projection, Matrix4 view) => unproject3(v, projection, view);
|
||||
|
||||
private macro towards(v, target, max_distance)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user