Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/technohippy/go-glmatrix
go-glmatrix is a golang version of glMatrix, which is "designed to perform vector and matrix operations stupidly fast".
https://github.com/technohippy/go-glmatrix
3d matrix vector
Last synced: about 2 months ago
JSON representation
go-glmatrix is a golang version of glMatrix, which is "designed to perform vector and matrix operations stupidly fast".
- Host: GitHub
- URL: https://github.com/technohippy/go-glmatrix
- Owner: technohippy
- License: mit
- Created: 2020-07-02T13:40:40.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-02-05T02:33:06.000Z (almost 4 years ago)
- Last Synced: 2024-07-31T20:52:38.033Z (4 months ago)
- Topics: 3d, matrix, vector
- Language: Go
- Homepage: https://github.com/technohippy/go-glmatrix
- Size: 154 KB
- Stars: 9
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-go - go-glmatrix - Go port of [glMatrix](https://glmatrix.net/) library. (OpenGL / HTTP Clients)
- zero-alloc-awesome-go - go-glmatrix - Go port of [glMatrix](https://glmatrix.net/) library. (OpenGL / HTTP Clients)
- awesome-go-extra - go-glmatrix - glmatrix is a golang version of glMatrix, which is "designed to perform vector and matrix operations stupidly fast".|4|3|0|2020-07-02T13:40:40Z|2021-02-05T02:33:06Z| (OpenGL / HTTP Clients)
README
[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)
[![Build Status](https://secure.travis-ci.org/technohippy/go-glmatrix.png?branch=master)](http://travis-ci.org/technohippy/go-glmatrix)
[![Coverage Status](https://coveralls.io/repos/technohippy/go-glmatrix/badge.svg?branch=master)](https://coveralls.io/r/technohippy/go-glmatrix?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/technohippy/go-glmatrix)](https://goreportcard.com/report/github.com/technohippy/go-glmatrix)
[![GoDoc](https://godoc.org/github.com/technohippy/go-glmatrix?status.svg)](https://godoc.org/github.com/technohippy/go-glmatrix)
[![license](https://img.shields.io/badge/license-MIT-4183c4.svg)](https://github.com/technohippy/go-glmatrix/blob/master/LICENSE.txt)# go-glmatrix
go-glmatrix is a golang version of [glMatrix](http://glmatrix.net/), which is ``designed to perform vector and matrix operations stupidly fast''.
## Usage
```go
package mainimport (
"fmt"
glm "github.com/technohippy/go-glmatrix"
)func main() {
// config
rotateQuat := glm.QuatFromValues(1, 2, 3, 4)
translateVec3 := glm.Vec3FromValues(1, 2, 3)
scale := []float64{4, 5, 6}
rotateOrigin := []float64{7, 8, 9}// construct matrix
transMat := glm.Mat4Create()
glm.Mat4Identity(transMat)
glm.Mat4Translate(transMat, transMat, translateVec3)
glm.Mat4Translate(transMat, transMat, rotateOrigin)
rotateMat := glm.Mat4Create()
rotateMat = glm.Mat4FromQuat(rotateMat, rotateQuat)
matrix := glm.Mat4Multiply(glm.Mat4Create(), transMat, rotateMat)
glm.Mat4Scale(matrix, matrix, scale)
negativeOrigin := glm.Vec3Negate(glm.Vec3Create(), rotateOrigin)
glm.Mat4Translate(matrix, matrix, negativeOrigin)// transform position
position := glm.Vec3FromValues(10, 20, 30)
glm.Vec3TransformMat4(position, position, matrix)
fmt.Printf(glm.Vec3Str(position)) // => vec3(1280, -290, -42)
}
```## Document
- See [https://pkg.go.dev/](https://pkg.go.dev/github.com/technohippy/go-glmatrix)
- or See [the documentation for glMatrix](http://glmatrix.net/docs/)## License
MIT