math: add Vec element-wise >,>=,<,<= operators
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
b81e416e02
commit
d23d662adb
1 changed files with 20 additions and 0 deletions
|
|
@ -126,6 +126,26 @@ pub fn Vec(comptime n_value: usize, comptime Scalar: type) type {
|
|||
return .{ .v = a.v * VecN.splat(s).v };
|
||||
}
|
||||
|
||||
/// Element-wise a < b
|
||||
pub inline fn less(a: VecN, b: Scalar) bool {
|
||||
return a.v < b.v;
|
||||
}
|
||||
|
||||
/// Element-wise a <= b
|
||||
pub inline fn lessEq(a: VecN, b: Scalar) bool {
|
||||
return a.v <= b.v;
|
||||
}
|
||||
|
||||
/// Element-wise a > b
|
||||
pub inline fn greater(a: VecN, b: Scalar) bool {
|
||||
return a.v > b.v;
|
||||
}
|
||||
|
||||
/// Element-wise a >= b
|
||||
pub inline fn greaterEq(a: VecN, b: Scalar) bool {
|
||||
return a.v >= b.v;
|
||||
}
|
||||
|
||||
/// Returns a vector with all components set to the `scalar` value:
|
||||
///
|
||||
/// ```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue