Skip to content

forkercat/MathLib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MathLib

macOS Linux Windows license

platform-compatibility swift-version-compatibility

A simple math library written in Swift. Still in development...

🔧 Install

You package file would be like:

let package = Package(
    name: "YourPackageName",
    
    dependencies: [
        .package(url: "https://github.com/forkercat/MathLib.git", .branch("main")),
    ],
    
    targets: [
        // For Swift 5.5, use .executableTarget
        .target(
            name: "YourPackageName",
            dependencies: [
                .product(name: "MathLib", package: "MathLib")
            ]),
    ]
)

🥲 Usage

import MathLib

let v1 = Float3(x: 1, y: 2, z: 3)
let v2 = Float3(x: 300, y: 20, z: 1)

let v3 = Float4(xyz: v2, w: 4)
let v4 = Float4(1, 123.123, 25, 1344)

print(v1.str)
print(v2.str)

print(v3.str3f)
print(v4.str3f)

// Output
Float3 [   1.0,   2.0,   3.0 ]
Float3 [ 300.0,  20.0,   1.0 ]
Float4 [  300.000,   20.000,    1.000,    4.000 ]
Float4 [    1.000,  123.123,   25.000, 1344.000 ]

Float4x4 [[   1.0,   0.0,   0.0,   0.0 ],
          [   0.0,   1.0,   0.0,   0.0 ],
          [   0.0,   0.0,   1.0,   0.0 ],
          [   0.0,   0.0,   0.0,   1.0 ]]

About

A simple math library written in Swift 🧮

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages