目录
目录README.md

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 ]]
关于
48.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

©Copyright 2023 CCF 开源发展委员会
Powered by Trustie& IntelliDE 京ICP备13000930号