• Stars
    star
    288
  • Rank 138,484 (Top 3 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 13 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A performance oriented 2D/3D math package for Go

Package go3d is a performance oriented vector and matrix math package for 2D and 3D graphics.

Every type has its own sub-package and is named T. So vec3.T is the 3D vector type. For every vector and matrix type there is a String() method and a Parse() function. Besides methods of T there are also functions in the packages, like vec3.Dot(a, b).

Packages under the float64 directory are using float64 values instead of float32.

Matrices are organized as arrays of columns which is also the way OpenGL expects matrices. DirectX expects "arrays of rows" matrices, use the Transpose() to convert.

Methods that don't return a specific value, return a pointer to the struct to allow method call chaining.

Example:

a := vec3.Zero
b := vec3.UnitX
a.Add(&b).Scale(5)

Method names in the past tense return a copy of the struct instead of a pointer to it.

Example:

a := vec3.UnitX
b := a.Scaled(5) // a still equals vec3.UnitX

Note that the package is designed for performance over usability where necessary. This is the reason why many arguments are passed by pointer reference instead of by value. Sticking either to passing and returning everything by value or by pointer would lead to a nicer API, but it would be slower as demonstrated in mat4/mat4_test.go

cd mat4
go test -bench=BenchmarkMulAddVec4_PassBy*

Documentation: https://pkg.go.dev/github.com/ungerik/go3d

More Repositories

1

go-dry

DRY (don't repeat yourself) package for Go
Go
490
star
2

go-start

A high level web-framework for Go
Go
266
star
3

go-cairo

Go binding for the cairo graphics library
Go
138
star
4

go-rest

A small and evil REST framework for Go
Go
128
star
5

pkgreflect

A Go preprocessor for package scoped reflection
Go
105
star
6

go-rss

Simple RSS parser for Go
Go
73
star
7

go-mail

Email utilities for Go
Go
31
star
8

go-gravatar

Go wrapper for the Gravatar API
Go
24
star
9

http

A HTTP command line interface for humans
Go
17
star
10

go-mavlink

MAVLink protocol implementation for Go
Go
17
star
11

mdgo

Markdown Go: Literate Programming for Go
Go
16
star
12

go-sysfs

Go package for Linux sysfs
Go
10
star
13

go-json-tree

JSON tree representation for Go
Go
6
star
14

ephesoft

Ephesoft Community, Linux Edition Version 4.0
HTML
6
star
15

react-dmodel

Exploit JSX syntax to define data models and auto generate form UI for it
JavaScript
6
star
16

go-pool

Go sync.Pool applications
Go
5
star
17

go-email

Sending Emails with Go
Go
5
star
18

go-fs

Unified file system for Go
Go
5
star
19

BaseLib

C++ BaseLib
C++
5
star
20

react-inputs

Input components for react
JavaScript
4
star
21

go-bbio

Go package for Beagle Bone IO (port of Adafruit_BBIO)
Go
4
star
22

gosync

Go
1
star
23

go-reflection

Utilities extending the Go reflect package
Go
1
star
24

ungerik.github.io

HTML
1
star
25

go-structflag

Use the Go flag package on config structs
Go
1
star
26

gitstat

Global git status command
Go
1
star
27

go-amiando

Go library for the Amiando event API
Go
1
star
28

html5-info

Collection of HTML5 related development information
1
star
29

go-command

Wrap Go functions as commands callable from CLI and REST endpoints
Go
1
star
30

chrome-netconn

ES6 classes for Chrome socket, serial, and bluetooth APIs
JavaScript
1
star
31

gen-version-info

Creates a Go source file with a constant containing the source version taken from Git or SVN
Go
1
star
32

go-string

Defines the type String with methods from the strings package
Go
1
star