Structurefwcd.swift-utils 4.6.2Utils
Vec2
Vec2.swift:1struct Vec2<T>
struct Vec2<T>
import Utils
protocol CustomStringConvertible
A type with a customized textual representation.
init(both value: T)
init(x: T, y: T)
var asTuple: (x: T, y: T) { get }
var description: String { get }
var x: T
var y: T
func map<U>(_ f: (T) throws -> U) rethrows -> Vec2<U>
func mapBoth<U>(_ fx: (T) throws -> U, _ fy: (T) throws -> U) rethrows -> Vec2<U>
func with(x newX: T) -> Vec2<T>
func with(y newY: T) -> Vec2<T>
protocol Absolutable
protocol Multipliable
protocol Subtractable
protocol Addable
protocol Divisible
protocol Negatable
Describes a (signed) type that has an additive inverse.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol ExpressibleByIntegerLiteral
A type that can be initialized with an integer literal.
var asNDArray: NDArray<T> { get }
static func * (lhs: Vec2<T>, rhs: Vec2<T>) -> Vec2<T>
static func * (lhs: Vec2<T>, rhs: T) -> Vec2<T>
static func * (lhs: T, rhs: Vec2<T>) -> Vec2<T>
static func *= (lhs: inout Vec2<T>, rhs: Vec2<T>)
func cross(_ other: Vec2<T>) -> T
func dot(_ other: Vec2<T>) -> T
static func - (lhs: Vec2<T>, rhs: Vec2<T>) -> Vec2<T>
static func -= (lhs: inout Vec2<T>, rhs: Vec2<T>)
static func + (lhs: Vec2<T>, rhs: Vec2<T>) -> Vec2<T>
static func += (lhs: inout Vec2<T>, rhs: Vec2<T>)
static func / (lhs: Vec2<T>, rhs: Vec2<T>) -> Vec2<T>
static func / (lhs: Vec2<T>, rhs: T) -> Vec2<T>
static func /= (lhs: inout Vec2<T>, rhs: Vec2<T>)
protocol BinaryFloatingPoint : ExpressibleByFloatLiteral, FloatingPoint
A radix-2 (binary) floating-point type.
var normalized: Vec2<T> { get }
var xInverted: Vec2<T> { get }
var yInverted: Vec2<T> { get }
static func - (operand: Vec2<T>) -> Vec2<T>
mutating func negate()
var floored: Vec2<Int> { get }
var magnitude: T { get }
var squaredMagnitude: T { get }
protocol Equatable
A type that can be compared for value equality.
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.
protocol BinaryInteger : CustomStringConvertible, Hashable, Numeric, Strideable where Self.Magnitude : BinaryInteger, Self.Magnitude == Self.Magnitude.Magnitude
An integer type with a binary representation.
var asDouble: Vec2<Double> { get }
var magnitude: Double { get }
var squaredMagnitude: Double { get }
init()
init(x: T)
init(y: T)
static func zero() -> Vec2<T>
protocol Copyable
A type whose values can be implicitly or explicitly copied.
protocol Sendable
protocol Escapable