id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
20,800
go-gl/mathgl
mgl32/vecn.go
Zero
func (vn *VecN) Zero(n int) { vn.Resize(n) for i := range vn.vec { vn.vec[i] = 0 } }
go
func (vn *VecN) Zero(n int) { vn.Resize(n) for i := range vn.vec { vn.vec[i] = 0 } }
[ "func", "(", "vn", "*", "VecN", ")", "Zero", "(", "n", "int", ")", "{", "vn", ".", "Resize", "(", "n", ")", "\n", "for", "i", ":=", "range", "vn", ".", "vec", "{", "vn", ".", "vec", "[", "i", "]", "=", "0", "\n", "}", "\n", "}" ]
// Zero sets the vector's size to n and zeroes out the vector. // If n is bigger than the vector's size, it will realloc.
[ "Zero", "sets", "the", "vector", "s", "size", "to", "n", "and", "zeroes", "out", "the", "vector", ".", "If", "n", "is", "bigger", "than", "the", "vector", "s", "size", "it", "will", "realloc", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/vecn.go#L131-L136
20,801
go-gl/mathgl
mgl32/vecn.go
Cross
func (vn *VecN) Cross(dst *VecN, other *VecN) *VecN { if vn == nil || other == nil { return nil } if len(vn.vec) != 3 || len(other.vec) != 3 { panic("Cannot take binary cross product of non-3D elements (7D cross product not implemented)") } dst = dst.Resize(3) dst.vec[0], dst.vec[1], dst.vec[2] = vn.vec[1]*o...
go
func (vn *VecN) Cross(dst *VecN, other *VecN) *VecN { if vn == nil || other == nil { return nil } if len(vn.vec) != 3 || len(other.vec) != 3 { panic("Cannot take binary cross product of non-3D elements (7D cross product not implemented)") } dst = dst.Resize(3) dst.vec[0], dst.vec[1], dst.vec[2] = vn.vec[1]*o...
[ "func", "(", "vn", "*", "VecN", ")", "Cross", "(", "dst", "*", "VecN", ",", "other", "*", "VecN", ")", "*", "VecN", "{", "if", "vn", "==", "nil", "||", "other", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "if", "len", "(", "vn", ".", ...
// Cross takes the binary cross product of vn and other, and stores it in dst. // If either vn or other are not of size 3 this function will panic // // If dst is not of sufficient size, or is nil, a new slice is allocated. // Dst is permitted to be one of the other arguments
[ "Cross", "takes", "the", "binary", "cross", "product", "of", "vn", "and", "other", "and", "stores", "it", "in", "dst", ".", "If", "either", "vn", "or", "other", "are", "not", "of", "size", "3", "this", "function", "will", "panic", "If", "dst", "is", ...
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/vecn.go#L185-L197
20,802
go-gl/mathgl
mgl32/vecn.go
Mul
func (vn *VecN) Mul(dst *VecN, c float32) *VecN { if vn == nil { return nil } dst = dst.Resize(len(vn.vec)) for i, el := range vn.vec { dst.vec[i] = el * c } return dst }
go
func (vn *VecN) Mul(dst *VecN, c float32) *VecN { if vn == nil { return nil } dst = dst.Resize(len(vn.vec)) for i, el := range vn.vec { dst.vec[i] = el * c } return dst }
[ "func", "(", "vn", "*", "VecN", ")", "Mul", "(", "dst", "*", "VecN", ",", "c", "float32", ")", "*", "VecN", "{", "if", "vn", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "dst", "=", "dst", ".", "Resize", "(", "len", "(", "vn", ".", "...
// Mul multiplies the vector by some scalar value and stores the result in dst, // which will be returned. Dst will be appropriately resized to the size of vn. // // The destination can be vn itself and nothing will go wrong.
[ "Mul", "multiplies", "the", "vector", "by", "some", "scalar", "value", "and", "stores", "the", "result", "in", "dst", "which", "will", "be", "returned", ".", "Dst", "will", "be", "appropriately", "resized", "to", "the", "size", "of", "vn", ".", "The", "d...
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/vecn.go#L270-L281
20,803
go-gl/mathgl
mgl32/vecn.go
Vec2
func (vn *VecN) Vec2() Vec2 { raw := vn.Raw() return Vec2{raw[0], raw[1]} }
go
func (vn *VecN) Vec2() Vec2 { raw := vn.Raw() return Vec2{raw[0], raw[1]} }
[ "func", "(", "vn", "*", "VecN", ")", "Vec2", "(", ")", "Vec2", "{", "raw", ":=", "vn", ".", "Raw", "(", ")", "\n", "return", "Vec2", "{", "raw", "[", "0", "]", ",", "raw", "[", "1", "]", "}", "\n", "}" ]
// Vec2 constructs a 2-dimensional vector by discarding coordinates.
[ "Vec2", "constructs", "a", "2", "-", "dimensional", "vector", "by", "discarding", "coordinates", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/vecn.go#L356-L359
20,804
go-gl/mathgl
mgl32/vecn.go
Vec3
func (vn *VecN) Vec3() Vec3 { raw := vn.Raw() return Vec3{raw[0], raw[1], raw[2]} }
go
func (vn *VecN) Vec3() Vec3 { raw := vn.Raw() return Vec3{raw[0], raw[1], raw[2]} }
[ "func", "(", "vn", "*", "VecN", ")", "Vec3", "(", ")", "Vec3", "{", "raw", ":=", "vn", ".", "Raw", "(", ")", "\n", "return", "Vec3", "{", "raw", "[", "0", "]", ",", "raw", "[", "1", "]", ",", "raw", "[", "2", "]", "}", "\n", "}" ]
// Vec3 constructs a 3-dimensional vector by discarding coordinates.
[ "Vec3", "constructs", "a", "3", "-", "dimensional", "vector", "by", "discarding", "coordinates", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/vecn.go#L362-L365
20,805
go-gl/mathgl
mgl32/vecn.go
Vec4
func (vn *VecN) Vec4() Vec4 { raw := vn.Raw() return Vec4{raw[0], raw[1], raw[2], raw[3]} }
go
func (vn *VecN) Vec4() Vec4 { raw := vn.Raw() return Vec4{raw[0], raw[1], raw[2], raw[3]} }
[ "func", "(", "vn", "*", "VecN", ")", "Vec4", "(", ")", "Vec4", "{", "raw", ":=", "vn", ".", "Raw", "(", ")", "\n", "return", "Vec4", "{", "raw", "[", "0", "]", ",", "raw", "[", "1", "]", ",", "raw", "[", "2", "]", ",", "raw", "[", "3", ...
// Vec4 constructs a 4-dimensional vector by discarding coordinates.
[ "Vec4", "constructs", "a", "4", "-", "dimensional", "vector", "by", "discarding", "coordinates", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/vecn.go#L368-L371
20,806
go-gl/mathgl
mgl32/matmn.go
CopyMatMN
func CopyMatMN(dst, src *MatMxN) { if dst == nil || src == nil { return } dst.Reshape(src.m, src.n) copy(dst.dat, src.dat) }
go
func CopyMatMN(dst, src *MatMxN) { if dst == nil || src == nil { return } dst.Reshape(src.m, src.n) copy(dst.dat, src.dat) }
[ "func", "CopyMatMN", "(", "dst", ",", "src", "*", "MatMxN", ")", "{", "if", "dst", "==", "nil", "||", "src", "==", "nil", "{", "return", "\n", "}", "\n", "dst", ".", "Reshape", "(", "src", ".", "m", ",", "src", ".", "n", ")", "\n", "copy", "(...
// CopyMatMN copies src into dst. This Reshapes dst // to the same size as src. // // If dst or src is nil, this is a no-op
[ "CopyMatMN", "copies", "src", "into", "dst", ".", "This", "Reshapes", "dst", "to", "the", "same", "size", "as", "src", ".", "If", "dst", "or", "src", "is", "nil", "this", "is", "a", "no", "-", "op" ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matmn.go#L66-L72
20,807
go-gl/mathgl
mgl32/matmn.go
IdentN
func IdentN(dst *MatMxN, n int) *MatMxN { dst = dst.Reshape(n, n) for i := 0; i < n; i++ { for j := 0; j < n; j++ { if i == j { dst.Set(i, j, 1) } else { dst.Set(i, j, 0) } } } return dst }
go
func IdentN(dst *MatMxN, n int) *MatMxN { dst = dst.Reshape(n, n) for i := 0; i < n; i++ { for j := 0; j < n; j++ { if i == j { dst.Set(i, j, 1) } else { dst.Set(i, j, 0) } } } return dst }
[ "func", "IdentN", "(", "dst", "*", "MatMxN", ",", "n", "int", ")", "*", "MatMxN", "{", "dst", "=", "dst", ".", "Reshape", "(", "n", ",", "n", ")", "\n\n", "for", "i", ":=", "0", ";", "i", "<", "n", ";", "i", "++", "{", "for", "j", ":=", "...
// IdentN stores the NxN identity matrix in dst, reallocating as necessary.
[ "IdentN", "stores", "the", "NxN", "identity", "matrix", "in", "dst", "reallocating", "as", "necessary", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matmn.go#L75-L89
20,808
go-gl/mathgl
mgl32/matmn.go
Zero
func (mat *MatMxN) Zero(m, n int) { if mat == nil { return } mat.Reshape(m, n) for i := range mat.dat { mat.dat[i] = 0 } }
go
func (mat *MatMxN) Zero(m, n int) { if mat == nil { return } mat.Reshape(m, n) for i := range mat.dat { mat.dat[i] = 0 } }
[ "func", "(", "mat", "*", "MatMxN", ")", "Zero", "(", "m", ",", "n", "int", ")", "{", "if", "mat", "==", "nil", "{", "return", "\n", "}", "\n\n", "mat", ".", "Reshape", "(", "m", ",", "n", ")", "\n", "for", "i", ":=", "range", "mat", ".", "d...
// Zero reshapes the matrix to m by n and zeroes out all // elements.
[ "Zero", "reshapes", "the", "matrix", "to", "m", "by", "n", "and", "zeroes", "out", "all", "elements", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matmn.go#L116-L125
20,809
go-gl/mathgl
mgl32/matmn.go
destroy
func (mat *MatMxN) destroy() { if mat == nil { return } if shouldPool && mat.dat != nil { returnToPool(mat.dat) } mat.m, mat.n = 0, 0 mat.dat = nil }
go
func (mat *MatMxN) destroy() { if mat == nil { return } if shouldPool && mat.dat != nil { returnToPool(mat.dat) } mat.m, mat.n = 0, 0 mat.dat = nil }
[ "func", "(", "mat", "*", "MatMxN", ")", "destroy", "(", ")", "{", "if", "mat", "==", "nil", "{", "return", "\n", "}", "\n\n", "if", "shouldPool", "&&", "mat", ".", "dat", "!=", "nil", "{", "returnToPool", "(", "mat", ".", "dat", ")", "\n", "}", ...
// destroy returns the underlying matrix slice to the memory pool
[ "destroy", "returns", "the", "underlying", "matrix", "slice", "to", "the", "memory", "pool" ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matmn.go#L128-L138
20,810
go-gl/mathgl
mgl32/matmn.go
Transpose
func (mat *MatMxN) Transpose(dst *MatMxN) (t *MatMxN) { if mat == nil { return nil } if dst == mat { dst = NewMatrix(mat.n, mat.m) // Copy data to correct matrix, // delete temporary buffer, // and set the return value to the // correct one defer func() { copy(mat.dat, dst.dat) mat.m, mat.n = ...
go
func (mat *MatMxN) Transpose(dst *MatMxN) (t *MatMxN) { if mat == nil { return nil } if dst == mat { dst = NewMatrix(mat.n, mat.m) // Copy data to correct matrix, // delete temporary buffer, // and set the return value to the // correct one defer func() { copy(mat.dat, dst.dat) mat.m, mat.n = ...
[ "func", "(", "mat", "*", "MatMxN", ")", "Transpose", "(", "dst", "*", "MatMxN", ")", "(", "t", "*", "MatMxN", ")", "{", "if", "mat", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "if", "dst", "==", "mat", "{", "dst", "=", "NewMatrix", "...
// Transpose takes the transpose of mat and puts it in dst. // // If dst is not of the correct dimensions, it will be Reshaped, // if dst and mat are the same, a temporary matrix of the correct size will // be allocated; these resources will be released via the memory pool. // // This should be improved in the future.
[ "Transpose", "takes", "the", "transpose", "of", "mat", "and", "puts", "it", "in", "dst", ".", "If", "dst", "is", "not", "of", "the", "correct", "dimensions", "it", "will", "be", "Reshaped", "if", "dst", "and", "mat", "are", "the", "same", "a", "tempora...
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matmn.go#L228-L261
20,811
go-gl/mathgl
mgl32/matmn.go
NumRowCols
func (mat *MatMxN) NumRowCols() (rows, cols int) { return mat.m, mat.n }
go
func (mat *MatMxN) NumRowCols() (rows, cols int) { return mat.m, mat.n }
[ "func", "(", "mat", "*", "MatMxN", ")", "NumRowCols", "(", ")", "(", "rows", ",", "cols", "int", ")", "{", "return", "mat", ".", "m", ",", "mat", ".", "n", "\n", "}" ]
// NumRowCols returns the number of rows and columns in this matrix // as a single operation
[ "NumRowCols", "returns", "the", "number", "of", "rows", "and", "columns", "in", "this", "matrix", "as", "a", "single", "operation" ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matmn.go#L284-L286
20,812
go-gl/mathgl
mgl32/matmn.go
Add
func (mat *MatMxN) Add(dst *MatMxN, addend *MatMxN) *MatMxN { if mat == nil || addend == nil || mat.m != addend.m || mat.n != addend.n { return nil } dst = dst.Reshape(mat.m, mat.n) // No need to care about rows and columns // since it's element-wise anyway for i, el := range mat.dat { dst.dat[i] = el + add...
go
func (mat *MatMxN) Add(dst *MatMxN, addend *MatMxN) *MatMxN { if mat == nil || addend == nil || mat.m != addend.m || mat.n != addend.n { return nil } dst = dst.Reshape(mat.m, mat.n) // No need to care about rows and columns // since it's element-wise anyway for i, el := range mat.dat { dst.dat[i] = el + add...
[ "func", "(", "mat", "*", "MatMxN", ")", "Add", "(", "dst", "*", "MatMxN", ",", "addend", "*", "MatMxN", ")", "*", "MatMxN", "{", "if", "mat", "==", "nil", "||", "addend", "==", "nil", "||", "mat", ".", "m", "!=", "addend", ".", "m", "||", "mat"...
// Add is the arithemtic + operator defined on a MatMxN.
[ "Add", "is", "the", "arithemtic", "+", "operator", "defined", "on", "a", "MatMxN", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matmn.go#L305-L319
20,813
go-gl/mathgl
mgl32/matmn.go
Sub
func (mat *MatMxN) Sub(dst *MatMxN, subtrahend *MatMxN) *MatMxN { if mat == nil || subtrahend == nil || mat.m != subtrahend.m || mat.n != subtrahend.n { return nil } dst = dst.Reshape(mat.m, mat.n) // No need to care about rows and columns // since it's element-wise anyway for i, el := range mat.dat { dst.d...
go
func (mat *MatMxN) Sub(dst *MatMxN, subtrahend *MatMxN) *MatMxN { if mat == nil || subtrahend == nil || mat.m != subtrahend.m || mat.n != subtrahend.n { return nil } dst = dst.Reshape(mat.m, mat.n) // No need to care about rows and columns // since it's element-wise anyway for i, el := range mat.dat { dst.d...
[ "func", "(", "mat", "*", "MatMxN", ")", "Sub", "(", "dst", "*", "MatMxN", ",", "subtrahend", "*", "MatMxN", ")", "*", "MatMxN", "{", "if", "mat", "==", "nil", "||", "subtrahend", "==", "nil", "||", "mat", ".", "m", "!=", "subtrahend", ".", "m", "...
// Sub is the arithemtic - operator defined on a MatMxN.
[ "Sub", "is", "the", "arithemtic", "-", "operator", "defined", "on", "a", "MatMxN", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matmn.go#L322-L336
20,814
go-gl/mathgl
mgl32/matmn.go
Mul
func (mat *MatMxN) Mul(dst *MatMxN, c float32) *MatMxN { if mat == nil { return nil } dst = dst.Reshape(mat.m, mat.n) for i, el := range mat.dat { dst.dat[i] = el * c } return dst }
go
func (mat *MatMxN) Mul(dst *MatMxN, c float32) *MatMxN { if mat == nil { return nil } dst = dst.Reshape(mat.m, mat.n) for i, el := range mat.dat { dst.dat[i] = el * c } return dst }
[ "func", "(", "mat", "*", "MatMxN", ")", "Mul", "(", "dst", "*", "MatMxN", ",", "c", "float32", ")", "*", "MatMxN", "{", "if", "mat", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "dst", "=", "dst", ".", "Reshape", "(", "mat", ".", "m", ...
// Mul performs a scalar multiplication between mat and some constant c, // storing the result in dst. Mat and dst can be equal. If dst is not the // correct size, a Reshape will occur.
[ "Mul", "performs", "a", "scalar", "multiplication", "between", "mat", "and", "some", "constant", "c", "storing", "the", "result", "in", "dst", ".", "Mat", "and", "dst", "can", "be", "equal", ".", "If", "dst", "is", "not", "the", "correct", "size", "a", ...
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matmn.go#L387-L399
20,815
go-gl/mathgl
mgl32/matmn.go
MulNx1
func (mat *MatMxN) MulNx1(dst, v *VecN) *VecN { if mat == nil || v == nil || mat.n != len(v.vec) { return nil } if dst == v { v = NewVecN(len(v.vec)) copy(v.vec, dst.vec) defer v.destroy() } dst = dst.Resize(mat.m) for r := 0; r < mat.m; r++ { dst.vec[r] = 0 for c := 0; c < mat.n; c++ { dst.vec...
go
func (mat *MatMxN) MulNx1(dst, v *VecN) *VecN { if mat == nil || v == nil || mat.n != len(v.vec) { return nil } if dst == v { v = NewVecN(len(v.vec)) copy(v.vec, dst.vec) defer v.destroy() } dst = dst.Resize(mat.m) for r := 0; r < mat.m; r++ { dst.vec[r] = 0 for c := 0; c < mat.n; c++ { dst.vec...
[ "func", "(", "mat", "*", "MatMxN", ")", "MulNx1", "(", "dst", ",", "v", "*", "VecN", ")", "*", "VecN", "{", "if", "mat", "==", "nil", "||", "v", "==", "nil", "||", "mat", ".", "n", "!=", "len", "(", "v", ".", "vec", ")", "{", "return", "nil...
// MulNx1 multiplies the matrix by a vector of size n. If mat or v is nil, this // returns nil. If the number of columns in mat does not match the Size of v, // this also returns nil. // // Dst will be resized if it's not big enough. If dst == v; a temporary vector // will be allocated and returned via the realloc call...
[ "MulNx1", "multiplies", "the", "matrix", "by", "a", "vector", "of", "size", "n", ".", "If", "mat", "or", "v", "is", "nil", "this", "returns", "nil", ".", "If", "the", "number", "of", "columns", "in", "mat", "does", "not", "match", "the", "Size", "of"...
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matmn.go#L407-L429
20,816
go-gl/mathgl
mgl64/quat.go
Add
func (q1 Quat) Add(q2 Quat) Quat { return Quat{q1.W + q2.W, q1.V.Add(q2.V)} }
go
func (q1 Quat) Add(q2 Quat) Quat { return Quat{q1.W + q2.W, q1.V.Add(q2.V)} }
[ "func", "(", "q1", "Quat", ")", "Add", "(", "q2", "Quat", ")", "Quat", "{", "return", "Quat", "{", "q1", ".", "W", "+", "q2", ".", "W", ",", "q1", ".", "V", ".", "Add", "(", "q2", ".", "V", ")", "}", "\n", "}" ]
// Add adds two quaternions. It's no more complicated than // adding their W and V components.
[ "Add", "adds", "two", "quaternions", ".", "It", "s", "no", "more", "complicated", "than", "adding", "their", "W", "and", "V", "components", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/quat.go#L83-L85
20,817
go-gl/mathgl
mgl64/quat.go
Sub
func (q1 Quat) Sub(q2 Quat) Quat { return Quat{q1.W - q2.W, q1.V.Sub(q2.V)} }
go
func (q1 Quat) Sub(q2 Quat) Quat { return Quat{q1.W - q2.W, q1.V.Sub(q2.V)} }
[ "func", "(", "q1", "Quat", ")", "Sub", "(", "q2", "Quat", ")", "Quat", "{", "return", "Quat", "{", "q1", ".", "W", "-", "q2", ".", "W", ",", "q1", ".", "V", ".", "Sub", "(", "q2", ".", "V", ")", "}", "\n", "}" ]
// Sub subtracts two quaternions. It's no more complicated than // subtracting their W and V components.
[ "Sub", "subtracts", "two", "quaternions", ".", "It", "s", "no", "more", "complicated", "than", "subtracting", "their", "W", "and", "V", "components", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/quat.go#L89-L91
20,818
go-gl/mathgl
mgl64/quat.go
Len
func (q1 Quat) Len() float64 { return float64(math.Sqrt(float64(q1.W*q1.W + q1.V[0]*q1.V[0] + q1.V[1]*q1.V[1] + q1.V[2]*q1.V[2]))) }
go
func (q1 Quat) Len() float64 { return float64(math.Sqrt(float64(q1.W*q1.W + q1.V[0]*q1.V[0] + q1.V[1]*q1.V[1] + q1.V[2]*q1.V[2]))) }
[ "func", "(", "q1", "Quat", ")", "Len", "(", ")", "float64", "{", "return", "float64", "(", "math", ".", "Sqrt", "(", "float64", "(", "q1", ".", "W", "*", "q1", ".", "W", "+", "q1", ".", "V", "[", "0", "]", "*", "q1", ".", "V", "[", "0", "...
// Len gives the Length of the quaternion, also known as its Norm. This is the // same thing as the Len of a Vec4.
[ "Len", "gives", "the", "Length", "of", "the", "quaternion", "also", "known", "as", "its", "Norm", ".", "This", "is", "the", "same", "thing", "as", "the", "Len", "of", "a", "Vec4", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/quat.go#L113-L115
20,819
go-gl/mathgl
mgl64/quat.go
Mat4
func (q1 Quat) Mat4() Mat4 { w, x, y, z := q1.W, q1.V[0], q1.V[1], q1.V[2] return Mat4{ 1 - 2*y*y - 2*z*z, 2*x*y + 2*w*z, 2*x*z - 2*w*y, 0, 2*x*y - 2*w*z, 1 - 2*x*x - 2*z*z, 2*y*z + 2*w*x, 0, 2*x*z + 2*w*y, 2*y*z - 2*w*x, 1 - 2*x*x - 2*y*y, 0, 0, 0, 0, 1, } }
go
func (q1 Quat) Mat4() Mat4 { w, x, y, z := q1.W, q1.V[0], q1.V[1], q1.V[2] return Mat4{ 1 - 2*y*y - 2*z*z, 2*x*y + 2*w*z, 2*x*z - 2*w*y, 0, 2*x*y - 2*w*z, 1 - 2*x*x - 2*z*z, 2*y*z + 2*w*x, 0, 2*x*z + 2*w*y, 2*y*z - 2*w*x, 1 - 2*x*x - 2*y*y, 0, 0, 0, 0, 1, } }
[ "func", "(", "q1", "Quat", ")", "Mat4", "(", ")", "Mat4", "{", "w", ",", "x", ",", "y", ",", "z", ":=", "q1", ".", "W", ",", "q1", ".", "V", "[", "0", "]", ",", "q1", ".", "V", "[", "1", "]", ",", "q1", ".", "V", "[", "2", "]", "\n"...
// Mat4 returns the homogeneous 3D rotation matrix corresponding to the // quaternion.
[ "Mat4", "returns", "the", "homogeneous", "3D", "rotation", "matrix", "corresponding", "to", "the", "quaternion", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/quat.go#L168-L176
20,820
go-gl/mathgl
mgl64/quat.go
ApproxEqual
func (q1 Quat) ApproxEqual(q2 Quat) bool { return FloatEqual(q1.W, q2.W) && q1.V.ApproxEqual(q2.V) }
go
func (q1 Quat) ApproxEqual(q2 Quat) bool { return FloatEqual(q1.W, q2.W) && q1.V.ApproxEqual(q2.V) }
[ "func", "(", "q1", "Quat", ")", "ApproxEqual", "(", "q2", "Quat", ")", "bool", "{", "return", "FloatEqual", "(", "q1", ".", "W", ",", "q2", ".", "W", ")", "&&", "q1", ".", "V", ".", "ApproxEqual", "(", "q2", ".", "V", ")", "\n", "}" ]
// ApproxEqual returns whether the quaternions are approximately equal, as if // FloatEqual was called on each matching element
[ "ApproxEqual", "returns", "whether", "the", "quaternions", "are", "approximately", "equal", "as", "if", "FloatEqual", "was", "called", "on", "each", "matching", "element" ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/quat.go#L185-L187
20,821
go-gl/mathgl
mgl64/quat.go
Mat4ToQuat
func Mat4ToQuat(m Mat4) Quat { // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm if tr := m[0] + m[5] + m[10]; tr > 0 { s := float64(0.5 / math.Sqrt(float64(tr+1.0))) return Quat{ 0.25 / s, Vec3{ (m[6] - m[9]) * s, (m[8] - m[2]) * s, (m[1] - m[4]...
go
func Mat4ToQuat(m Mat4) Quat { // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm if tr := m[0] + m[5] + m[10]; tr > 0 { s := float64(0.5 / math.Sqrt(float64(tr+1.0))) return Quat{ 0.25 / s, Vec3{ (m[6] - m[9]) * s, (m[8] - m[2]) * s, (m[1] - m[4]...
[ "func", "Mat4ToQuat", "(", "m", "Mat4", ")", "Quat", "{", "// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm", "if", "tr", ":=", "m", "[", "0", "]", "+", "m", "[", "5", "]", "+", "m", "[", "10", "]", ";", "tr", ...
// Mat4ToQuat converts a pure rotation matrix into a quaternion
[ "Mat4ToQuat", "converts", "a", "pure", "rotation", "matrix", "into", "a", "quaternion" ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/quat.go#L354-L403
20,822
go-gl/mathgl
mgl64/quat.go
QuatLookAtV
func QuatLookAtV(eye, center, up Vec3) Quat { // http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-17-quaternions/#I_need_an_equivalent_of_gluLookAt__How_do_I_orient_an_object_towards_a_point__ // https://bitbucket.org/sinbad/ogre/src/d2ef494c4a2f5d6e2f0f17d3bfb9fd936d5423bb/OgreMain/src/OgreCamera.cpp?a...
go
func QuatLookAtV(eye, center, up Vec3) Quat { // http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-17-quaternions/#I_need_an_equivalent_of_gluLookAt__How_do_I_orient_an_object_towards_a_point__ // https://bitbucket.org/sinbad/ogre/src/d2ef494c4a2f5d6e2f0f17d3bfb9fd936d5423bb/OgreMain/src/OgreCamera.cpp?a...
[ "func", "QuatLookAtV", "(", "eye", ",", "center", ",", "up", "Vec3", ")", "Quat", "{", "// http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-17-quaternions/#I_need_an_equivalent_of_gluLookAt__How_do_I_orient_an_object_towards_a_point__", "// https://bitbucket.org/sinbad/ogre/s...
// QuatLookAtV creates a rotation from an eye vector to a center vector // // It assumes the front of the rotated object at Z- and up at Y+
[ "QuatLookAtV", "creates", "a", "rotation", "from", "an", "eye", "vector", "to", "a", "center", "vector", "It", "assumes", "the", "front", "of", "the", "rotated", "object", "at", "Z", "-", "and", "up", "at", "Y", "+" ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/quat.go#L408-L430
20,823
go-gl/mathgl
mgl64/conv.go
SphericalToCylindrical
func SphericalToCylindrical(r, theta, phi float64) (rho, phi2, z float64) { s, c := math.Sincos(float64(theta)) rho = r * float64(s) z = r * float64(c) phi2 = phi return }
go
func SphericalToCylindrical(r, theta, phi float64) (rho, phi2, z float64) { s, c := math.Sincos(float64(theta)) rho = r * float64(s) z = r * float64(c) phi2 = phi return }
[ "func", "SphericalToCylindrical", "(", "r", ",", "theta", ",", "phi", "float64", ")", "(", "rho", ",", "phi2", ",", "z", "float64", ")", "{", "s", ",", "c", ":=", "math", ".", "Sincos", "(", "float64", "(", "theta", ")", ")", "\n\n", "rho", "=", ...
// SphericalToCylindrical converts spherical coordinates with radius r, // inclination theta, and azimuth phi to cylindrical coordinates with radial // distance r, azimuth phi, and height z. // // Angles are in radians
[ "SphericalToCylindrical", "converts", "spherical", "coordinates", "with", "radius", "r", "inclination", "theta", "and", "azimuth", "phi", "to", "cylindrical", "coordinates", "with", "radial", "distance", "r", "azimuth", "phi", "and", "height", "z", ".", "Angles", ...
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/conv.go#L55-L63
20,824
go-gl/mathgl
mgl64/conv.go
CylindircalToSpherical
func CylindircalToSpherical(rho, phi, z float64) (r, theta, phi2 float64) { r = float64(math.Hypot(float64(rho), float64(z))) phi2 = phi theta = float64(math.Atan2(float64(rho), float64(z))) return }
go
func CylindircalToSpherical(rho, phi, z float64) (r, theta, phi2 float64) { r = float64(math.Hypot(float64(rho), float64(z))) phi2 = phi theta = float64(math.Atan2(float64(rho), float64(z))) return }
[ "func", "CylindircalToSpherical", "(", "rho", ",", "phi", ",", "z", "float64", ")", "(", "r", ",", "theta", ",", "phi2", "float64", ")", "{", "r", "=", "float64", "(", "math", ".", "Hypot", "(", "float64", "(", "rho", ")", ",", "float64", "(", "z",...
// CylindircalToSpherical converts cylindrical coordinates with radial distance // r, azimuth phi, and height z to spherical coordinates with radius r, // inclination theta, and azimuth phi. // // Angles are in radians
[ "CylindircalToSpherical", "converts", "cylindrical", "coordinates", "with", "radial", "distance", "r", "azimuth", "phi", "and", "height", "z", "to", "spherical", "coordinates", "with", "radius", "r", "inclination", "theta", "and", "azimuth", "phi", ".", "Angles", ...
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/conv.go#L70-L76
20,825
go-gl/mathgl
mgl32/transform.go
ExtractMaxScale
func ExtractMaxScale(m Mat4) float32 { scaleX := float64(m[0]*m[0] + m[1]*m[1] + m[2]*m[2]) scaleY := float64(m[4]*m[4] + m[5]*m[5] + m[6]*m[6]) scaleZ := float64(m[8]*m[8] + m[9]*m[9] + m[10]*m[10]) return float32(math.Sqrt(math.Max(scaleX, math.Max(scaleY, scaleZ)))) }
go
func ExtractMaxScale(m Mat4) float32 { scaleX := float64(m[0]*m[0] + m[1]*m[1] + m[2]*m[2]) scaleY := float64(m[4]*m[4] + m[5]*m[5] + m[6]*m[6]) scaleZ := float64(m[8]*m[8] + m[9]*m[9] + m[10]*m[10]) return float32(math.Sqrt(math.Max(scaleX, math.Max(scaleY, scaleZ)))) }
[ "func", "ExtractMaxScale", "(", "m", "Mat4", ")", "float32", "{", "scaleX", ":=", "float64", "(", "m", "[", "0", "]", "*", "m", "[", "0", "]", "+", "m", "[", "1", "]", "*", "m", "[", "1", "]", "+", "m", "[", "2", "]", "*", "m", "[", "2", ...
// ExtractMaxScale extracts the maximum scaling from a homogeneous matrix
[ "ExtractMaxScale", "extracts", "the", "maximum", "scaling", "from", "a", "homogeneous", "matrix" ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/transform.go#L175-L181
20,826
go-gl/mathgl
mgl64/project.go
LookAt
func LookAt(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ float64) Mat4 { return LookAtV(Vec3{eyeX, eyeY, eyeZ}, Vec3{centerX, centerY, centerZ}, Vec3{upX, upY, upZ}) }
go
func LookAt(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ float64) Mat4 { return LookAtV(Vec3{eyeX, eyeY, eyeZ}, Vec3{centerX, centerY, centerZ}, Vec3{upX, upY, upZ}) }
[ "func", "LookAt", "(", "eyeX", ",", "eyeY", ",", "eyeZ", ",", "centerX", ",", "centerY", ",", "centerZ", ",", "upX", ",", "upY", ",", "upZ", "float64", ")", "Mat4", "{", "return", "LookAtV", "(", "Vec3", "{", "eyeX", ",", "eyeY", ",", "eyeZ", "}", ...
// LookAt generates a transform matrix from world space to the given eye space.
[ "LookAt", "generates", "a", "transform", "matrix", "from", "world", "space", "to", "the", "given", "eye", "space", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/project.go#L44-L46
20,827
go-gl/mathgl
mgl32/mempool.go
returnToPool
func returnToPool(slice []float32) { if cap(slice) == 0 { return } pool, exact := binLog(cap(slice)) if !exact { panic("attempt to pool slice with non-exact cap. If you're a user, please file an issue with github.com/go-gl/mathgl about this bug. This should never happen.") } getPool(pool).Put(slice) }
go
func returnToPool(slice []float32) { if cap(slice) == 0 { return } pool, exact := binLog(cap(slice)) if !exact { panic("attempt to pool slice with non-exact cap. If you're a user, please file an issue with github.com/go-gl/mathgl about this bug. This should never happen.") } getPool(pool).Put(slice) }
[ "func", "returnToPool", "(", "slice", "[", "]", "float32", ")", "{", "if", "cap", "(", "slice", ")", "==", "0", "{", "return", "\n", "}", "\n\n", "pool", ",", "exact", ":=", "binLog", "(", "cap", "(", "slice", ")", ")", "\n\n", "if", "!", "exact"...
// Returns a slice to the appropriate pool. If the slice does not have a cap that's precisely // a power of 2, this will panic.
[ "Returns", "a", "slice", "to", "the", "appropriate", "pool", ".", "If", "the", "slice", "does", "not", "have", "a", "cap", "that", "s", "precisely", "a", "power", "of", "2", "this", "will", "panic", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/mempool.go#L82-L94
20,828
go-gl/mathgl
mgl32/mempool.go
binLog
func binLog(val int) (int, bool) { if val <= 0 { return -1, false } exact := true l := 0 for ; val > 1; val = val >> 1 { // If the current lsb is 1 and the number // is not equal to 1, this is not an exact // log, but rather a rounding of it if val&1 != 0 { exact = false } l++ } return l, exac...
go
func binLog(val int) (int, bool) { if val <= 0 { return -1, false } exact := true l := 0 for ; val > 1; val = val >> 1 { // If the current lsb is 1 and the number // is not equal to 1, this is not an exact // log, but rather a rounding of it if val&1 != 0 { exact = false } l++ } return l, exac...
[ "func", "binLog", "(", "val", "int", ")", "(", "int", ",", "bool", ")", "{", "if", "val", "<=", "0", "{", "return", "-", "1", ",", "false", "\n", "}", "\n\n", "exact", ":=", "true", "\n", "l", ":=", "0", "\n", "for", ";", "val", ">", "1", "...
// This returns the integer base 2 log of the value // and whether the log is exact or rounded down. // // This is only for positive integers. // // There are faster ways to do this, I'm open to suggestions. Most rely on knowing system endianness // which Go makes hard to do. I'm hesistant to use float conversions and ...
[ "This", "returns", "the", "integer", "base", "2", "log", "of", "the", "value", "and", "whether", "the", "log", "is", "exact", "or", "rounded", "down", ".", "This", "is", "only", "for", "positive", "integers", ".", "There", "are", "faster", "ways", "to", ...
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/mempool.go#L103-L121
20,829
go-gl/mathgl
mgl64/shapes.go
QuadraticBezierCurve2D
func QuadraticBezierCurve2D(t float64, cPoint1, cPoint2, cPoint3 Vec2) Vec2 { if t < 0.0 || t > 1.0 { panic("Can't interpolate on bezier curve with t out of range [0.0,1.0]") } return cPoint1.Mul((1.0 - t) * (1.0 - t)).Add(cPoint2.Mul(2 * (1 - t) * t)).Add(cPoint3.Mul(t * t)) }
go
func QuadraticBezierCurve2D(t float64, cPoint1, cPoint2, cPoint3 Vec2) Vec2 { if t < 0.0 || t > 1.0 { panic("Can't interpolate on bezier curve with t out of range [0.0,1.0]") } return cPoint1.Mul((1.0 - t) * (1.0 - t)).Add(cPoint2.Mul(2 * (1 - t) * t)).Add(cPoint3.Mul(t * t)) }
[ "func", "QuadraticBezierCurve2D", "(", "t", "float64", ",", "cPoint1", ",", "cPoint2", ",", "cPoint3", "Vec2", ")", "Vec2", "{", "if", "t", "<", "0.0", "||", "t", ">", "1.0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "cPoint1",...
// QuadraticBezierCurve2D interpolates the point t on the given bezier curve.
[ "QuadraticBezierCurve2D", "interpolates", "the", "point", "t", "on", "the", "given", "bezier", "curve", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/shapes.go#L68-L74
20,830
go-gl/mathgl
mgl64/shapes.go
QuadraticBezierCurve3D
func QuadraticBezierCurve3D(t float64, cPoint1, cPoint2, cPoint3 Vec3) Vec3 { if t < 0.0 || t > 1.0 { panic("Can't interpolate on bezier curve with t out of range [0.0,1.0]") } return cPoint1.Mul((1.0 - t) * (1.0 - t)).Add(cPoint2.Mul(2 * (1 - t) * t)).Add(cPoint3.Mul(t * t)) }
go
func QuadraticBezierCurve3D(t float64, cPoint1, cPoint2, cPoint3 Vec3) Vec3 { if t < 0.0 || t > 1.0 { panic("Can't interpolate on bezier curve with t out of range [0.0,1.0]") } return cPoint1.Mul((1.0 - t) * (1.0 - t)).Add(cPoint2.Mul(2 * (1 - t) * t)).Add(cPoint3.Mul(t * t)) }
[ "func", "QuadraticBezierCurve3D", "(", "t", "float64", ",", "cPoint1", ",", "cPoint2", ",", "cPoint3", "Vec3", ")", "Vec3", "{", "if", "t", "<", "0.0", "||", "t", ">", "1.0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "cPoint1",...
// QuadraticBezierCurve3D interpolates the point t on the given bezier curve.
[ "QuadraticBezierCurve3D", "interpolates", "the", "point", "t", "on", "the", "given", "bezier", "curve", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/shapes.go#L77-L83
20,831
go-gl/mathgl
mgl64/shapes.go
BezierCurve3D
func BezierCurve3D(t float64, cPoints []Vec3) Vec3 { if t < 0.0 || t > 1.0 { panic("Input to bezier has t not in range [0,1]. If you think this is a precision error, use mathgl.Clamp[f|d] before calling this function") } n := len(cPoints) - 1 point := cPoints[0].Mul(float64(math.Pow(float64(1.0-t), float64(n))))...
go
func BezierCurve3D(t float64, cPoints []Vec3) Vec3 { if t < 0.0 || t > 1.0 { panic("Input to bezier has t not in range [0,1]. If you think this is a precision error, use mathgl.Clamp[f|d] before calling this function") } n := len(cPoints) - 1 point := cPoints[0].Mul(float64(math.Pow(float64(1.0-t), float64(n))))...
[ "func", "BezierCurve3D", "(", "t", "float64", ",", "cPoints", "[", "]", "Vec3", ")", "Vec3", "{", "if", "t", "<", "0.0", "||", "t", ">", "1.0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "n", ":=", "len", "(", "cPoints", ")", "-", ...
// BezierCurve3D same as the 2D version, except the line is in 3D space
[ "BezierCurve3D", "same", "as", "the", "2D", "version", "except", "the", "line", "is", "in", "3D", "space" ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/shapes.go#L126-L139
20,832
go-gl/mathgl
mgl64/shapes.go
MakeBezierCurve3D
func MakeBezierCurve3D(numPoints int, cPoints []Vec3) (line []Vec3) { line = make([]Vec3, numPoints) if numPoints == 0 { return } else if numPoints == 1 { line[0] = cPoints[0] return } else if numPoints == 2 { line[0] = cPoints[0] line[1] = cPoints[len(cPoints)-1] return } line[0] = cPoints[0] for i...
go
func MakeBezierCurve3D(numPoints int, cPoints []Vec3) (line []Vec3) { line = make([]Vec3, numPoints) if numPoints == 0 { return } else if numPoints == 1 { line[0] = cPoints[0] return } else if numPoints == 2 { line[0] = cPoints[0] line[1] = cPoints[len(cPoints)-1] return } line[0] = cPoints[0] for i...
[ "func", "MakeBezierCurve3D", "(", "numPoints", "int", ",", "cPoints", "[", "]", "Vec3", ")", "(", "line", "[", "]", "Vec3", ")", "{", "line", "=", "make", "(", "[", "]", "Vec3", ",", "numPoints", ")", "\n", "if", "numPoints", "==", "0", "{", "retur...
// MakeBezierCurve3D same as the 2D version, except with the line in 3D space.
[ "MakeBezierCurve3D", "same", "as", "the", "2D", "version", "except", "with", "the", "line", "in", "3D", "space", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/shapes.go#L174-L194
20,833
go-gl/mathgl
mgl64/shapes.go
BezierSplineInterpolate2D
func BezierSplineInterpolate2D(t float64, ranges [][2]float64, cPoints [][]Vec2) Vec2 { if len(ranges) != len(cPoints) { panic("Each bezier curve needs a range") } for i, curveRange := range ranges { if t >= curveRange[0] && t <= curveRange[1] { return BezierCurve2D((t-curveRange[0])/(curveRange[1]-curveRang...
go
func BezierSplineInterpolate2D(t float64, ranges [][2]float64, cPoints [][]Vec2) Vec2 { if len(ranges) != len(cPoints) { panic("Each bezier curve needs a range") } for i, curveRange := range ranges { if t >= curveRange[0] && t <= curveRange[1] { return BezierCurve2D((t-curveRange[0])/(curveRange[1]-curveRang...
[ "func", "BezierSplineInterpolate2D", "(", "t", "float64", ",", "ranges", "[", "]", "[", "2", "]", "float64", ",", "cPoints", "[", "]", "[", "]", "Vec2", ")", "Vec2", "{", "if", "len", "(", "ranges", ")", "!=", "len", "(", "cPoints", ")", "{", "pani...
// BezierSplineInterpolate2D does interpolation over a spline of several bezier // curves. Each bezier curve must have a finite range, though the spline may be // disjoint. The bezier curves are not required to be in any particular order. // // If t is out of the range of all given curves, this function will panic
[ "BezierSplineInterpolate2D", "does", "interpolation", "over", "a", "spline", "of", "several", "bezier", "curves", ".", "Each", "bezier", "curve", "must", "have", "a", "finite", "range", "though", "the", "spline", "may", "be", "disjoint", ".", "The", "bezier", ...
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/shapes.go#L230-L242
20,834
go-gl/mathgl
mgl32/matstack/matstack.go
Pop
func (ms *MatStack) Pop() error { if len(*ms) == 1 { return errors.New("Cannot pop from mat stack, at minimum stack length of 1") } (*ms) = (*ms)[:len(*ms)-1] return nil }
go
func (ms *MatStack) Pop() error { if len(*ms) == 1 { return errors.New("Cannot pop from mat stack, at minimum stack length of 1") } (*ms) = (*ms)[:len(*ms)-1] return nil }
[ "func", "(", "ms", "*", "MatStack", ")", "Pop", "(", ")", "error", "{", "if", "len", "(", "*", "ms", ")", "==", "1", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "(", "*", "ms", ")", "=", "(", "*", "ms", ")"...
// Pop removes the first element of the matrix from the stack, if there is only // one element left there is an error.
[ "Pop", "removes", "the", "first", "element", "of", "the", "matrix", "from", "the", "stack", "if", "there", "is", "only", "one", "element", "left", "there", "is", "an", "error", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matstack/matstack.go#L25-L32
20,835
go-gl/mathgl
mgl32/vector.go
ApproxEqual
func (v1 Vec3) ApproxEqual(v2 Vec3) bool { for i := range v1 { if !FloatEqual(v1[i], v2[i]) { return false } } return true }
go
func (v1 Vec3) ApproxEqual(v2 Vec3) bool { for i := range v1 { if !FloatEqual(v1[i], v2[i]) { return false } } return true }
[ "func", "(", "v1", "Vec3", ")", "ApproxEqual", "(", "v2", "Vec3", ")", "bool", "{", "for", "i", ":=", "range", "v1", "{", "if", "!", "FloatEqual", "(", "v1", "[", "i", "]", ",", "v2", "[", "i", "]", ")", "{", "return", "false", "\n", "}", "\n...
// ApproxEqual takes in a vector and does an element-wise approximate float // comparison as if FloatEqual had been used
[ "ApproxEqual", "takes", "in", "a", "vector", "and", "does", "an", "element", "-", "wise", "approximate", "float", "comparison", "as", "if", "FloatEqual", "had", "been", "used" ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/vector.go#L314-L321
20,836
go-gl/mathgl
mgl32/vector.go
ApproxEqualThreshold
func (v1 Vec3) ApproxEqualThreshold(v2 Vec3, threshold float32) bool { for i := range v1 { if !FloatEqualThreshold(v1[i], v2[i], threshold) { return false } } return true }
go
func (v1 Vec3) ApproxEqualThreshold(v2 Vec3, threshold float32) bool { for i := range v1 { if !FloatEqualThreshold(v1[i], v2[i], threshold) { return false } } return true }
[ "func", "(", "v1", "Vec3", ")", "ApproxEqualThreshold", "(", "v2", "Vec3", ",", "threshold", "float32", ")", "bool", "{", "for", "i", ":=", "range", "v1", "{", "if", "!", "FloatEqualThreshold", "(", "v1", "[", "i", "]", ",", "v2", "[", "i", "]", ",...
// ApproxEqualThreshold takes in a threshold for comparing two floats, and uses // it to do an element-wise comparison of the vector to another.
[ "ApproxEqualThreshold", "takes", "in", "a", "threshold", "for", "comparing", "two", "floats", "and", "uses", "it", "to", "do", "an", "element", "-", "wise", "comparison", "of", "the", "vector", "to", "another", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/vector.go#L325-L332
20,837
go-gl/mathgl
mgl32/vector.go
ApproxFuncEqual
func (v1 Vec3) ApproxFuncEqual(v2 Vec3, eq func(float32, float32) bool) bool { for i := range v1 { if !eq(v1[i], v2[i]) { return false } } return true }
go
func (v1 Vec3) ApproxFuncEqual(v2 Vec3, eq func(float32, float32) bool) bool { for i := range v1 { if !eq(v1[i], v2[i]) { return false } } return true }
[ "func", "(", "v1", "Vec3", ")", "ApproxFuncEqual", "(", "v2", "Vec3", ",", "eq", "func", "(", "float32", ",", "float32", ")", "bool", ")", "bool", "{", "for", "i", ":=", "range", "v1", "{", "if", "!", "eq", "(", "v1", "[", "i", "]", ",", "v2", ...
// ApproxFuncEqual takes in a func that compares two floats, and uses it to do an element-wise // comparison of the vector to another. This is intended to be used with FloatEqualFunc
[ "ApproxFuncEqual", "takes", "in", "a", "func", "that", "compares", "two", "floats", "and", "uses", "it", "to", "do", "an", "element", "-", "wise", "comparison", "of", "the", "vector", "to", "another", ".", "This", "is", "intended", "to", "be", "used", "w...
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/vector.go#L336-L343
20,838
go-gl/mathgl
mgl64/matstack/transformStack.go
Push
func (ms *TransformStack) Push(m mgl64.Mat4) { prev := (*ms)[len(*ms)-1] (*ms) = append(*ms, prev.Mul4(m)) }
go
func (ms *TransformStack) Push(m mgl64.Mat4) { prev := (*ms)[len(*ms)-1] (*ms) = append(*ms, prev.Mul4(m)) }
[ "func", "(", "ms", "*", "TransformStack", ")", "Push", "(", "m", "mgl64", ".", "Mat4", ")", "{", "prev", ":=", "(", "*", "ms", ")", "[", "len", "(", "*", "ms", ")", "-", "1", "]", "\n", "(", "*", "ms", ")", "=", "append", "(", "*", "ms", ...
// Push multiplies the current top matrix by m, and pushes the result on the // stack.
[ "Push", "multiplies", "the", "current", "top", "matrix", "by", "m", "and", "pushes", "the", "result", "on", "the", "stack", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/matstack/transformStack.go#L34-L37
20,839
go-gl/mathgl
mgl64/matstack/transformStack.go
Pop
func (ms *TransformStack) Pop() (mgl64.Mat4, error) { if len(*ms) == 1 { return mgl64.Mat4{}, errors.New("attempt to pop last element of the stack; Matrix Stack must have at least one element") } retVal := (*ms)[len(*ms)-1] (*ms) = (*ms)[:len(*ms)-1] return retVal, nil }
go
func (ms *TransformStack) Pop() (mgl64.Mat4, error) { if len(*ms) == 1 { return mgl64.Mat4{}, errors.New("attempt to pop last element of the stack; Matrix Stack must have at least one element") } retVal := (*ms)[len(*ms)-1] (*ms) = (*ms)[:len(*ms)-1] return retVal, nil }
[ "func", "(", "ms", "*", "TransformStack", ")", "Pop", "(", ")", "(", "mgl64", ".", "Mat4", ",", "error", ")", "{", "if", "len", "(", "*", "ms", ")", "==", "1", "{", "return", "mgl64", ".", "Mat4", "{", "}", ",", "errors", ".", "New", "(", "\"...
// Pop the current matrix off the top of the stack and returns it. If the matrix // stack only has one element left, this will return an error.
[ "Pop", "the", "current", "matrix", "off", "the", "top", "of", "the", "stack", "and", "returns", "it", ".", "If", "the", "matrix", "stack", "only", "has", "one", "element", "left", "this", "will", "return", "an", "error", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/matstack/transformStack.go#L41-L51
20,840
go-gl/mathgl
mgl64/matstack/transformStack.go
Unwind
func (ms *TransformStack) Unwind(n int) error { if n > len(*ms)-1 { return errors.New("Cannot unwind a matrix to below 1 value") } (*ms) = (*ms)[:len(*ms)-n] return nil }
go
func (ms *TransformStack) Unwind(n int) error { if n > len(*ms)-1 { return errors.New("Cannot unwind a matrix to below 1 value") } (*ms) = (*ms)[:len(*ms)-n] return nil }
[ "func", "(", "ms", "*", "TransformStack", ")", "Unwind", "(", "n", "int", ")", "error", "{", "if", "n", ">", "len", "(", "*", "ms", ")", "-", "1", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "(", "*", "ms", ...
// Unwind cuts down the matrix as if Pop had been called n times. If n would // bring the matrix down below 1 element, this does nothing and returns an // error.
[ "Unwind", "cuts", "down", "the", "matrix", "as", "if", "Pop", "had", "been", "called", "n", "times", ".", "If", "n", "would", "bring", "the", "matrix", "down", "below", "1", "element", "this", "does", "nothing", "and", "returns", "an", "error", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/matstack/transformStack.go#L68-L75
20,841
go-gl/mathgl
mgl64/matstack/transformStack.go
Rebase
func Rebase(ms *TransformStack, from int, m *TransformStack) (*TransformStack, error) { if from <= 0 || from >= len(*ms) { return nil, errors.New("Cannot rebase, index out of range") } // Shift tmp so that the element immediately // preceding our target is the "top" element of the list. tmp := ms.Copy() if fro...
go
func Rebase(ms *TransformStack, from int, m *TransformStack) (*TransformStack, error) { if from <= 0 || from >= len(*ms) { return nil, errors.New("Cannot rebase, index out of range") } // Shift tmp so that the element immediately // preceding our target is the "top" element of the list. tmp := ms.Copy() if fro...
[ "func", "Rebase", "(", "ms", "*", "TransformStack", ",", "from", "int", ",", "m", "*", "TransformStack", ")", "(", "*", "TransformStack", ",", "error", ")", "{", "if", "from", "<=", "0", "||", "from", ">=", "len", "(", "*", "ms", ")", "{", "return"...
// Rebase replays the current matrix stack as if the transformation that occurred at index "from" // in ms had instead started at the top of m. // // This returns a brand new stack containing all of m followed by all transformations // at from and after on ms as if they has been done on m instead.
[ "Rebase", "replays", "the", "current", "matrix", "stack", "as", "if", "the", "transformation", "that", "occurred", "at", "index", "from", "in", "ms", "had", "instead", "started", "at", "the", "top", "of", "m", ".", "This", "returns", "a", "brand", "new", ...
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/matstack/transformStack.go#L144-L168
20,842
go-gl/mathgl
mgl32/project.go
Frustum
func Frustum(left, right, bottom, top, near, far float32) Mat4 { rml, tmb, fmn := (right - left), (top - bottom), (far - near) A, B, C, D := (right+left)/rml, (top+bottom)/tmb, -(far+near)/fmn, -(2*far*near)/fmn return Mat4{float32((2. * near) / rml), 0, 0, 0, 0, float32((2. * near) / tmb), 0, 0, float32(A), float3...
go
func Frustum(left, right, bottom, top, near, far float32) Mat4 { rml, tmb, fmn := (right - left), (top - bottom), (far - near) A, B, C, D := (right+left)/rml, (top+bottom)/tmb, -(far+near)/fmn, -(2*far*near)/fmn return Mat4{float32((2. * near) / rml), 0, 0, 0, 0, float32((2. * near) / tmb), 0, 0, float32(A), float3...
[ "func", "Frustum", "(", "left", ",", "right", ",", "bottom", ",", "top", ",", "near", ",", "far", "float32", ")", "Mat4", "{", "rml", ",", "tmb", ",", "fmn", ":=", "(", "right", "-", "left", ")", ",", "(", "top", "-", "bottom", ")", ",", "(", ...
// Frustum generates a Frustum Matrix.
[ "Frustum", "generates", "a", "Frustum", "Matrix", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/project.go#L34-L39
20,843
go-gl/mathgl
mgl32/project.go
LookAtV
func LookAtV(eye, center, up Vec3) Mat4 { f := center.Sub(eye).Normalize() s := f.Cross(up.Normalize()).Normalize() u := s.Cross(f) M := Mat4{ s[0], u[0], -f[0], 0, s[1], u[1], -f[1], 0, s[2], u[2], -f[2], 0, 0, 0, 0, 1, } return M.Mul4(Translate3D(float32(-eye[0]), float32(-eye[1]), float32(-eye[2]))) ...
go
func LookAtV(eye, center, up Vec3) Mat4 { f := center.Sub(eye).Normalize() s := f.Cross(up.Normalize()).Normalize() u := s.Cross(f) M := Mat4{ s[0], u[0], -f[0], 0, s[1], u[1], -f[1], 0, s[2], u[2], -f[2], 0, 0, 0, 0, 1, } return M.Mul4(Translate3D(float32(-eye[0]), float32(-eye[1]), float32(-eye[2]))) ...
[ "func", "LookAtV", "(", "eye", ",", "center", ",", "up", "Vec3", ")", "Mat4", "{", "f", ":=", "center", ".", "Sub", "(", "eye", ")", ".", "Normalize", "(", ")", "\n", "s", ":=", "f", ".", "Cross", "(", "up", ".", "Normalize", "(", ")", ")", "...
// LookAtV generates a transform matrix from world space into the specific eye // space.
[ "LookAtV", "generates", "a", "transform", "matrix", "from", "world", "space", "into", "the", "specific", "eye", "space", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/project.go#L48-L61
20,844
go-gl/mathgl
mgl64/transform.go
Extract3DScale
func Extract3DScale(m Mat4) (x, y, z float64) { return float64(math.Sqrt(float64(m[0]*m[0] + m[1]*m[1] + m[2]*m[2]))), float64(math.Sqrt(float64(m[4]*m[4] + m[5]*m[5] + m[6]*m[6]))), float64(math.Sqrt(float64(m[8]*m[8] + m[9]*m[9] + m[10]*m[10]))) }
go
func Extract3DScale(m Mat4) (x, y, z float64) { return float64(math.Sqrt(float64(m[0]*m[0] + m[1]*m[1] + m[2]*m[2]))), float64(math.Sqrt(float64(m[4]*m[4] + m[5]*m[5] + m[6]*m[6]))), float64(math.Sqrt(float64(m[8]*m[8] + m[9]*m[9] + m[10]*m[10]))) }
[ "func", "Extract3DScale", "(", "m", "Mat4", ")", "(", "x", ",", "y", ",", "z", "float64", ")", "{", "return", "float64", "(", "math", ".", "Sqrt", "(", "float64", "(", "m", "[", "0", "]", "*", "m", "[", "0", "]", "+", "m", "[", "1", "]", "*...
// Extract3DScale extracts the 3d scaling from a homogeneous matrix
[ "Extract3DScale", "extracts", "the", "3d", "scaling", "from", "a", "homogeneous", "matrix" ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/transform.go#L170-L174
20,845
go-gl/mathgl
mgl32/quat.go
QuatRotate
func QuatRotate(angle float32, axis Vec3) Quat { // angle = (float32(math.Pi) * angle) / 180.0 c, s := float32(math.Cos(float64(angle/2))), float32(math.Sin(float64(angle/2))) return Quat{c, axis.Mul(s)} }
go
func QuatRotate(angle float32, axis Vec3) Quat { // angle = (float32(math.Pi) * angle) / 180.0 c, s := float32(math.Cos(float64(angle/2))), float32(math.Sin(float64(angle/2))) return Quat{c, axis.Mul(s)} }
[ "func", "QuatRotate", "(", "angle", "float32", ",", "axis", "Vec3", ")", "Quat", "{", "// angle = (float32(math.Pi) * angle) / 180.0", "c", ",", "s", ":=", "float32", "(", "math", ".", "Cos", "(", "float64", "(", "angle", "/", "2", ")", ")", ")", ",", "f...
// QuatRotate creates an angle from an axis and an angle relative to that axis. // // This is cheaper than HomogRotate3D.
[ "QuatRotate", "creates", "an", "angle", "from", "an", "axis", "and", "an", "angle", "relative", "to", "that", "axis", ".", "This", "is", "cheaper", "than", "HomogRotate3D", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/quat.go#L56-L62
20,846
go-gl/mathgl
mgl32/quat.go
ApproxEqualThreshold
func (q1 Quat) ApproxEqualThreshold(q2 Quat, epsilon float32) bool { return FloatEqualThreshold(q1.W, q2.W, epsilon) && q1.V.ApproxEqualThreshold(q2.V, epsilon) }
go
func (q1 Quat) ApproxEqualThreshold(q2 Quat, epsilon float32) bool { return FloatEqualThreshold(q1.W, q2.W, epsilon) && q1.V.ApproxEqualThreshold(q2.V, epsilon) }
[ "func", "(", "q1", "Quat", ")", "ApproxEqualThreshold", "(", "q2", "Quat", ",", "epsilon", "float32", ")", "bool", "{", "return", "FloatEqualThreshold", "(", "q1", ".", "W", ",", "q2", ".", "W", ",", "epsilon", ")", "&&", "q1", ".", "V", ".", "Approx...
// ApproxEqualThreshold returns whether the quaternions are approximately equal with a given tolerence, as if // FloatEqualThreshold was called on each matching element with the given epsilon
[ "ApproxEqualThreshold", "returns", "whether", "the", "quaternions", "are", "approximately", "equal", "with", "a", "given", "tolerence", "as", "if", "FloatEqualThreshold", "was", "called", "on", "each", "matching", "element", "with", "the", "given", "epsilon" ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/quat.go#L189-L191
20,847
go-gl/mathgl
mgl32/quat.go
ApproxEqualFunc
func (q1 Quat) ApproxEqualFunc(q2 Quat, f func(float32, float32) bool) bool { return f(q1.W, q2.W) && q1.V.ApproxFuncEqual(q2.V, f) }
go
func (q1 Quat) ApproxEqualFunc(q2 Quat, f func(float32, float32) bool) bool { return f(q1.W, q2.W) && q1.V.ApproxFuncEqual(q2.V, f) }
[ "func", "(", "q1", "Quat", ")", "ApproxEqualFunc", "(", "q2", "Quat", ",", "f", "func", "(", "float32", ",", "float32", ")", "bool", ")", "bool", "{", "return", "f", "(", "q1", ".", "W", ",", "q2", ".", "W", ")", "&&", "q1", ".", "V", ".", "A...
// ApproxEqualFunc returns whether the quaternions are approximately equal using the given comparison function, as if // the function had been called on each individual element
[ "ApproxEqualFunc", "returns", "whether", "the", "quaternions", "are", "approximately", "equal", "using", "the", "given", "comparison", "function", "as", "if", "the", "function", "had", "been", "called", "on", "each", "individual", "element" ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/quat.go#L195-L197
20,848
go-gl/mathgl
mgl32/quat.go
OrientationEqualThreshold
func (q1 Quat) OrientationEqualThreshold(q2 Quat, epsilon float32) bool { return Abs(q1.Normalize().Dot(q2.Normalize())) > 1-epsilon }
go
func (q1 Quat) OrientationEqualThreshold(q2 Quat, epsilon float32) bool { return Abs(q1.Normalize().Dot(q2.Normalize())) > 1-epsilon }
[ "func", "(", "q1", "Quat", ")", "OrientationEqualThreshold", "(", "q2", "Quat", ",", "epsilon", "float32", ")", "bool", "{", "return", "Abs", "(", "q1", ".", "Normalize", "(", ")", ".", "Dot", "(", "q2", ".", "Normalize", "(", ")", ")", ")", ">", "...
// OrientationEqualThreshold returns whether the quaternions represents the same orientation with a given tolerence
[ "OrientationEqualThreshold", "returns", "whether", "the", "quaternions", "represents", "the", "same", "orientation", "with", "a", "given", "tolerence" ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/quat.go#L208-L210
20,849
go-gl/mathgl
mgl32/quat.go
QuatBetweenVectors
func QuatBetweenVectors(start, dest Vec3) Quat { // http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-17-quaternions/#I_need_an_equivalent_of_gluLookAt__How_do_I_orient_an_object_towards_a_point__ // https://github.com/g-truc/glm/blob/0.9.5/glm/gtx/quaternion.inl#L225 // https://bitbucket.org/sinbad/ogr...
go
func QuatBetweenVectors(start, dest Vec3) Quat { // http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-17-quaternions/#I_need_an_equivalent_of_gluLookAt__How_do_I_orient_an_object_towards_a_point__ // https://github.com/g-truc/glm/blob/0.9.5/glm/gtx/quaternion.inl#L225 // https://bitbucket.org/sinbad/ogr...
[ "func", "QuatBetweenVectors", "(", "start", ",", "dest", "Vec3", ")", "Quat", "{", "// http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-17-quaternions/#I_need_an_equivalent_of_gluLookAt__How_do_I_orient_an_object_towards_a_point__", "// https://github.com/g-truc/glm/blob/0.9.5/gl...
// QuatBetweenVectors calculates the rotation between two vectors
[ "QuatBetweenVectors", "calculates", "the", "rotation", "between", "two", "vectors" ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/quat.go#L431-L461
20,850
go-gl/mathgl
mgl32/matrix.go
Mat2FromRows
func Mat2FromRows(row0, row1 Vec2) Mat2 { return Mat2{row0[0], row1[0], row0[1], row1[1]} }
go
func Mat2FromRows(row0, row1 Vec2) Mat2 { return Mat2{row0[0], row1[0], row0[1], row1[1]} }
[ "func", "Mat2FromRows", "(", "row0", ",", "row1", "Vec2", ")", "Mat2", "{", "return", "Mat2", "{", "row0", "[", "0", "]", ",", "row1", "[", "0", "]", ",", "row0", "[", "1", "]", ",", "row1", "[", "1", "]", "}", "\n", "}" ]
// Mat2FromRows builds a new matrix from row vectors. // The resulting matrix will still be in column major order, but this can be // good for hand-building matrices.
[ "Mat2FromRows", "builds", "a", "new", "matrix", "from", "row", "vectors", ".", "The", "resulting", "matrix", "will", "still", "be", "in", "column", "major", "order", "but", "this", "can", "be", "good", "for", "hand", "-", "building", "matrices", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matrix.go#L119-L121
20,851
go-gl/mathgl
mgl32/matrix.go
Mat2FromCols
func Mat2FromCols(col0, col1 Vec2) Mat2 { return Mat2{col0[0], col0[1], col1[0], col1[1]} }
go
func Mat2FromCols(col0, col1 Vec2) Mat2 { return Mat2{col0[0], col0[1], col1[0], col1[1]} }
[ "func", "Mat2FromCols", "(", "col0", ",", "col1", "Vec2", ")", "Mat2", "{", "return", "Mat2", "{", "col0", "[", "0", "]", ",", "col0", "[", "1", "]", ",", "col1", "[", "0", "]", ",", "col1", "[", "1", "]", "}", "\n", "}" ]
// Mat2FromCols builds a new matrix from column vectors.
[ "Mat2FromCols", "builds", "a", "new", "matrix", "from", "column", "vectors", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matrix.go#L124-L126
20,852
go-gl/mathgl
mgl32/matrix.go
Mat2x3FromRows
func Mat2x3FromRows(row0, row1 Vec3) Mat2x3 { return Mat2x3{row0[0], row1[0], row0[1], row1[1], row0[2], row1[2]} }
go
func Mat2x3FromRows(row0, row1 Vec3) Mat2x3 { return Mat2x3{row0[0], row1[0], row0[1], row1[1], row0[2], row1[2]} }
[ "func", "Mat2x3FromRows", "(", "row0", ",", "row1", "Vec3", ")", "Mat2x3", "{", "return", "Mat2x3", "{", "row0", "[", "0", "]", ",", "row1", "[", "0", "]", ",", "row0", "[", "1", "]", ",", "row1", "[", "1", "]", ",", "row0", "[", "2", "]", ",...
// Mat2x3FromRows builds a new matrix from row vectors. // The resulting matrix will still be in column major order, but this can be // good for hand-building matrices.
[ "Mat2x3FromRows", "builds", "a", "new", "matrix", "from", "row", "vectors", ".", "The", "resulting", "matrix", "will", "still", "be", "in", "column", "major", "order", "but", "this", "can", "be", "good", "for", "hand", "-", "building", "matrices", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matrix.go#L374-L376
20,853
go-gl/mathgl
mgl32/matrix.go
Mat2x3FromCols
func Mat2x3FromCols(col0, col1, col2 Vec2) Mat2x3 { return Mat2x3{col0[0], col0[1], col1[0], col1[1], col2[0], col2[1]} }
go
func Mat2x3FromCols(col0, col1, col2 Vec2) Mat2x3 { return Mat2x3{col0[0], col0[1], col1[0], col1[1], col2[0], col2[1]} }
[ "func", "Mat2x3FromCols", "(", "col0", ",", "col1", ",", "col2", "Vec2", ")", "Mat2x3", "{", "return", "Mat2x3", "{", "col0", "[", "0", "]", ",", "col0", "[", "1", "]", ",", "col1", "[", "0", "]", ",", "col1", "[", "1", "]", ",", "col2", "[", ...
// Mat2x3FromCols builds a new matrix from column vectors.
[ "Mat2x3FromCols", "builds", "a", "new", "matrix", "from", "column", "vectors", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matrix.go#L379-L381
20,854
go-gl/mathgl
mgl32/matrix.go
Mat2x4FromRows
func Mat2x4FromRows(row0, row1 Vec4) Mat2x4 { return Mat2x4{row0[0], row1[0], row0[1], row1[1], row0[2], row1[2], row0[3], row1[3]} }
go
func Mat2x4FromRows(row0, row1 Vec4) Mat2x4 { return Mat2x4{row0[0], row1[0], row0[1], row1[1], row0[2], row1[2], row0[3], row1[3]} }
[ "func", "Mat2x4FromRows", "(", "row0", ",", "row1", "Vec4", ")", "Mat2x4", "{", "return", "Mat2x4", "{", "row0", "[", "0", "]", ",", "row1", "[", "0", "]", ",", "row0", "[", "1", "]", ",", "row1", "[", "1", "]", ",", "row0", "[", "2", "]", ",...
// Mat2x4FromRows builds a new matrix from row vectors. // The resulting matrix will still be in column major order, but this can be // good for hand-building matrices.
[ "Mat2x4FromRows", "builds", "a", "new", "matrix", "from", "row", "vectors", ".", "The", "resulting", "matrix", "will", "still", "be", "in", "column", "major", "order", "but", "this", "can", "be", "good", "for", "hand", "-", "building", "matrices", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matrix.go#L592-L594
20,855
go-gl/mathgl
mgl32/matrix.go
Mat2x4FromCols
func Mat2x4FromCols(col0, col1, col2, col3 Vec2) Mat2x4 { return Mat2x4{col0[0], col0[1], col1[0], col1[1], col2[0], col2[1], col3[0], col3[1]} }
go
func Mat2x4FromCols(col0, col1, col2, col3 Vec2) Mat2x4 { return Mat2x4{col0[0], col0[1], col1[0], col1[1], col2[0], col2[1], col3[0], col3[1]} }
[ "func", "Mat2x4FromCols", "(", "col0", ",", "col1", ",", "col2", ",", "col3", "Vec2", ")", "Mat2x4", "{", "return", "Mat2x4", "{", "col0", "[", "0", "]", ",", "col0", "[", "1", "]", ",", "col1", "[", "0", "]", ",", "col1", "[", "1", "]", ",", ...
// Mat2x4FromCols builds a new matrix from column vectors.
[ "Mat2x4FromCols", "builds", "a", "new", "matrix", "from", "column", "vectors", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matrix.go#L597-L599
20,856
go-gl/mathgl
mgl32/matrix.go
Mat3x2FromRows
func Mat3x2FromRows(row0, row1, row2 Vec2) Mat3x2 { return Mat3x2{row0[0], row1[0], row2[0], row0[1], row1[1], row2[1]} }
go
func Mat3x2FromRows(row0, row1, row2 Vec2) Mat3x2 { return Mat3x2{row0[0], row1[0], row2[0], row0[1], row1[1], row2[1]} }
[ "func", "Mat3x2FromRows", "(", "row0", ",", "row1", ",", "row2", "Vec2", ")", "Mat3x2", "{", "return", "Mat3x2", "{", "row0", "[", "0", "]", ",", "row1", "[", "0", "]", ",", "row2", "[", "0", "]", ",", "row0", "[", "1", "]", ",", "row1", "[", ...
// Mat3x2FromRows builds a new matrix from row vectors. // The resulting matrix will still be in column major order, but this can be // good for hand-building matrices.
[ "Mat3x2FromRows", "builds", "a", "new", "matrix", "from", "row", "vectors", ".", "The", "resulting", "matrix", "will", "still", "be", "in", "column", "major", "order", "but", "this", "can", "be", "good", "for", "hand", "-", "building", "matrices", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matrix.go#L810-L812
20,857
go-gl/mathgl
mgl32/matrix.go
Mat3x2FromCols
func Mat3x2FromCols(col0, col1 Vec3) Mat3x2 { return Mat3x2{col0[0], col0[1], col0[2], col1[0], col1[1], col1[2]} }
go
func Mat3x2FromCols(col0, col1 Vec3) Mat3x2 { return Mat3x2{col0[0], col0[1], col0[2], col1[0], col1[1], col1[2]} }
[ "func", "Mat3x2FromCols", "(", "col0", ",", "col1", "Vec3", ")", "Mat3x2", "{", "return", "Mat3x2", "{", "col0", "[", "0", "]", ",", "col0", "[", "1", "]", ",", "col0", "[", "2", "]", ",", "col1", "[", "0", "]", ",", "col1", "[", "1", "]", ",...
// Mat3x2FromCols builds a new matrix from column vectors.
[ "Mat3x2FromCols", "builds", "a", "new", "matrix", "from", "column", "vectors", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matrix.go#L815-L817
20,858
go-gl/mathgl
mgl32/matrix.go
Mat3FromRows
func Mat3FromRows(row0, row1, row2 Vec3) Mat3 { return Mat3{row0[0], row1[0], row2[0], row0[1], row1[1], row2[1], row0[2], row1[2], row2[2]} }
go
func Mat3FromRows(row0, row1, row2 Vec3) Mat3 { return Mat3{row0[0], row1[0], row2[0], row0[1], row1[1], row2[1], row0[2], row1[2], row2[2]} }
[ "func", "Mat3FromRows", "(", "row0", ",", "row1", ",", "row2", "Vec3", ")", "Mat3", "{", "return", "Mat3", "{", "row0", "[", "0", "]", ",", "row1", "[", "0", "]", ",", "row2", "[", "0", "]", ",", "row0", "[", "1", "]", ",", "row1", "[", "1", ...
// Mat3FromRows builds a new matrix from row vectors. // The resulting matrix will still be in column major order, but this can be // good for hand-building matrices.
[ "Mat3FromRows", "builds", "a", "new", "matrix", "from", "row", "vectors", ".", "The", "resulting", "matrix", "will", "still", "be", "in", "column", "major", "order", "but", "this", "can", "be", "good", "for", "hand", "-", "building", "matrices", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matrix.go#L1062-L1064
20,859
go-gl/mathgl
mgl32/matrix.go
Mat3FromCols
func Mat3FromCols(col0, col1, col2 Vec3) Mat3 { return Mat3{col0[0], col0[1], col0[2], col1[0], col1[1], col1[2], col2[0], col2[1], col2[2]} }
go
func Mat3FromCols(col0, col1, col2 Vec3) Mat3 { return Mat3{col0[0], col0[1], col0[2], col1[0], col1[1], col1[2], col2[0], col2[1], col2[2]} }
[ "func", "Mat3FromCols", "(", "col0", ",", "col1", ",", "col2", "Vec3", ")", "Mat3", "{", "return", "Mat3", "{", "col0", "[", "0", "]", ",", "col0", "[", "1", "]", ",", "col0", "[", "2", "]", ",", "col1", "[", "0", "]", ",", "col1", "[", "1", ...
// Mat3FromCols builds a new matrix from column vectors.
[ "Mat3FromCols", "builds", "a", "new", "matrix", "from", "column", "vectors", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matrix.go#L1067-L1069
20,860
go-gl/mathgl
mgl32/matrix.go
Mat3x4FromRows
func Mat3x4FromRows(row0, row1, row2 Vec4) Mat3x4 { return Mat3x4{row0[0], row1[0], row2[0], row0[1], row1[1], row2[1], row0[2], row1[2], row2[2], row0[3], row1[3], row2[3]} }
go
func Mat3x4FromRows(row0, row1, row2 Vec4) Mat3x4 { return Mat3x4{row0[0], row1[0], row2[0], row0[1], row1[1], row2[1], row0[2], row1[2], row2[2], row0[3], row1[3], row2[3]} }
[ "func", "Mat3x4FromRows", "(", "row0", ",", "row1", ",", "row2", "Vec4", ")", "Mat3x4", "{", "return", "Mat3x4", "{", "row0", "[", "0", "]", ",", "row1", "[", "0", "]", ",", "row2", "[", "0", "]", ",", "row0", "[", "1", "]", ",", "row1", "[", ...
// Mat3x4FromRows builds a new matrix from row vectors. // The resulting matrix will still be in column major order, but this can be // good for hand-building matrices.
[ "Mat3x4FromRows", "builds", "a", "new", "matrix", "from", "row", "vectors", ".", "The", "resulting", "matrix", "will", "still", "be", "in", "column", "major", "order", "but", "this", "can", "be", "good", "for", "hand", "-", "building", "matrices", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matrix.go#L1337-L1339
20,861
go-gl/mathgl
mgl32/matrix.go
Mat3x4FromCols
func Mat3x4FromCols(col0, col1, col2, col3 Vec3) Mat3x4 { return Mat3x4{col0[0], col0[1], col0[2], col1[0], col1[1], col1[2], col2[0], col2[1], col2[2], col3[0], col3[1], col3[2]} }
go
func Mat3x4FromCols(col0, col1, col2, col3 Vec3) Mat3x4 { return Mat3x4{col0[0], col0[1], col0[2], col1[0], col1[1], col1[2], col2[0], col2[1], col2[2], col3[0], col3[1], col3[2]} }
[ "func", "Mat3x4FromCols", "(", "col0", ",", "col1", ",", "col2", ",", "col3", "Vec3", ")", "Mat3x4", "{", "return", "Mat3x4", "{", "col0", "[", "0", "]", ",", "col0", "[", "1", "]", ",", "col0", "[", "2", "]", ",", "col1", "[", "0", "]", ",", ...
// Mat3x4FromCols builds a new matrix from column vectors.
[ "Mat3x4FromCols", "builds", "a", "new", "matrix", "from", "column", "vectors", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matrix.go#L1342-L1344
20,862
go-gl/mathgl
mgl32/matrix.go
Mat4x2FromRows
func Mat4x2FromRows(row0, row1, row2, row3 Vec2) Mat4x2 { return Mat4x2{row0[0], row1[0], row2[0], row3[0], row0[1], row1[1], row2[1], row3[1]} }
go
func Mat4x2FromRows(row0, row1, row2, row3 Vec2) Mat4x2 { return Mat4x2{row0[0], row1[0], row2[0], row3[0], row0[1], row1[1], row2[1], row3[1]} }
[ "func", "Mat4x2FromRows", "(", "row0", ",", "row1", ",", "row2", ",", "row3", "Vec2", ")", "Mat4x2", "{", "return", "Mat4x2", "{", "row0", "[", "0", "]", ",", "row1", "[", "0", "]", ",", "row2", "[", "0", "]", ",", "row3", "[", "0", "]", ",", ...
// Mat4x2FromRows builds a new matrix from row vectors. // The resulting matrix will still be in column major order, but this can be // good for hand-building matrices.
[ "Mat4x2FromRows", "builds", "a", "new", "matrix", "from", "row", "vectors", ".", "The", "resulting", "matrix", "will", "still", "be", "in", "column", "major", "order", "but", "this", "can", "be", "good", "for", "hand", "-", "building", "matrices", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matrix.go#L1565-L1567
20,863
go-gl/mathgl
mgl32/matrix.go
Mat4x2FromCols
func Mat4x2FromCols(col0, col1 Vec4) Mat4x2 { return Mat4x2{col0[0], col0[1], col0[2], col0[3], col1[0], col1[1], col1[2], col1[3]} }
go
func Mat4x2FromCols(col0, col1 Vec4) Mat4x2 { return Mat4x2{col0[0], col0[1], col0[2], col0[3], col1[0], col1[1], col1[2], col1[3]} }
[ "func", "Mat4x2FromCols", "(", "col0", ",", "col1", "Vec4", ")", "Mat4x2", "{", "return", "Mat4x2", "{", "col0", "[", "0", "]", ",", "col0", "[", "1", "]", ",", "col0", "[", "2", "]", ",", "col0", "[", "3", "]", ",", "col1", "[", "0", "]", ",...
// Mat4x2FromCols builds a new matrix from column vectors.
[ "Mat4x2FromCols", "builds", "a", "new", "matrix", "from", "column", "vectors", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matrix.go#L1570-L1572
20,864
go-gl/mathgl
mgl32/matrix.go
ApproxEqual
func (m1 Mat4x2) ApproxEqual(m2 Mat4x2) bool { for i := range m1 { if !FloatEqual(m1[i], m2[i]) { return false } } return true }
go
func (m1 Mat4x2) ApproxEqual(m2 Mat4x2) bool { for i := range m1 { if !FloatEqual(m1[i], m2[i]) { return false } } return true }
[ "func", "(", "m1", "Mat4x2", ")", "ApproxEqual", "(", "m2", "Mat4x2", ")", "bool", "{", "for", "i", ":=", "range", "m1", "{", "if", "!", "FloatEqual", "(", "m1", "[", "i", "]", ",", "m2", "[", "i", "]", ")", "{", "return", "false", "\n", "}", ...
// ApproxEqual performs an element-wise approximate equality test between two matrices, // as if FloatEqual had been used.
[ "ApproxEqual", "performs", "an", "element", "-", "wise", "approximate", "equality", "test", "between", "two", "matrices", "as", "if", "FloatEqual", "had", "been", "used", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matrix.go#L1681-L1688
20,865
go-gl/mathgl
mgl32/matrix.go
Mat4x3FromRows
func Mat4x3FromRows(row0, row1, row2, row3 Vec3) Mat4x3 { return Mat4x3{row0[0], row1[0], row2[0], row3[0], row0[1], row1[1], row2[1], row3[1], row0[2], row1[2], row2[2], row3[2]} }
go
func Mat4x3FromRows(row0, row1, row2, row3 Vec3) Mat4x3 { return Mat4x3{row0[0], row1[0], row2[0], row3[0], row0[1], row1[1], row2[1], row3[1], row0[2], row1[2], row2[2], row3[2]} }
[ "func", "Mat4x3FromRows", "(", "row0", ",", "row1", ",", "row2", ",", "row3", "Vec3", ")", "Mat4x3", "{", "return", "Mat4x3", "{", "row0", "[", "0", "]", ",", "row1", "[", "0", "]", ",", "row2", "[", "0", "]", ",", "row3", "[", "0", "]", ",", ...
// Mat4x3FromRows builds a new matrix from row vectors. // The resulting matrix will still be in column major order, but this can be // good for hand-building matrices.
[ "Mat4x3FromRows", "builds", "a", "new", "matrix", "from", "row", "vectors", ".", "The", "resulting", "matrix", "will", "still", "be", "in", "column", "major", "order", "but", "this", "can", "be", "good", "for", "hand", "-", "building", "matrices", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matrix.go#L1803-L1805
20,866
go-gl/mathgl
mgl32/matrix.go
Mat4x3FromCols
func Mat4x3FromCols(col0, col1, col2 Vec4) Mat4x3 { return Mat4x3{col0[0], col0[1], col0[2], col0[3], col1[0], col1[1], col1[2], col1[3], col2[0], col2[1], col2[2], col2[3]} }
go
func Mat4x3FromCols(col0, col1, col2 Vec4) Mat4x3 { return Mat4x3{col0[0], col0[1], col0[2], col0[3], col1[0], col1[1], col1[2], col1[3], col2[0], col2[1], col2[2], col2[3]} }
[ "func", "Mat4x3FromCols", "(", "col0", ",", "col1", ",", "col2", "Vec4", ")", "Mat4x3", "{", "return", "Mat4x3", "{", "col0", "[", "0", "]", ",", "col0", "[", "1", "]", ",", "col0", "[", "2", "]", ",", "col0", "[", "3", "]", ",", "col1", "[", ...
// Mat4x3FromCols builds a new matrix from column vectors.
[ "Mat4x3FromCols", "builds", "a", "new", "matrix", "from", "column", "vectors", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matrix.go#L1808-L1810
20,867
go-gl/mathgl
mgl32/matrix.go
Mat4FromRows
func Mat4FromRows(row0, row1, row2, row3 Vec4) Mat4 { return Mat4{row0[0], row1[0], row2[0], row3[0], row0[1], row1[1], row2[1], row3[1], row0[2], row1[2], row2[2], row3[2], row0[3], row1[3], row2[3], row3[3]} }
go
func Mat4FromRows(row0, row1, row2, row3 Vec4) Mat4 { return Mat4{row0[0], row1[0], row2[0], row3[0], row0[1], row1[1], row2[1], row3[1], row0[2], row1[2], row2[2], row3[2], row0[3], row1[3], row2[3], row3[3]} }
[ "func", "Mat4FromRows", "(", "row0", ",", "row1", ",", "row2", ",", "row3", "Vec4", ")", "Mat4", "{", "return", "Mat4", "{", "row0", "[", "0", "]", ",", "row1", "[", "0", "]", ",", "row2", "[", "0", "]", ",", "row3", "[", "0", "]", ",", "row0...
// Mat4FromRows builds a new matrix from row vectors. // The resulting matrix will still be in column major order, but this can be // good for hand-building matrices.
[ "Mat4FromRows", "builds", "a", "new", "matrix", "from", "row", "vectors", ".", "The", "resulting", "matrix", "will", "still", "be", "in", "column", "major", "order", "but", "this", "can", "be", "good", "for", "hand", "-", "building", "matrices", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matrix.go#L2065-L2067
20,868
go-gl/mathgl
mgl32/matrix.go
Mat4FromCols
func Mat4FromCols(col0, col1, col2, col3 Vec4) Mat4 { return Mat4{col0[0], col0[1], col0[2], col0[3], col1[0], col1[1], col1[2], col1[3], col2[0], col2[1], col2[2], col2[3], col3[0], col3[1], col3[2], col3[3]} }
go
func Mat4FromCols(col0, col1, col2, col3 Vec4) Mat4 { return Mat4{col0[0], col0[1], col0[2], col0[3], col1[0], col1[1], col1[2], col1[3], col2[0], col2[1], col2[2], col2[3], col3[0], col3[1], col3[2], col3[3]} }
[ "func", "Mat4FromCols", "(", "col0", ",", "col1", ",", "col2", ",", "col3", "Vec4", ")", "Mat4", "{", "return", "Mat4", "{", "col0", "[", "0", "]", ",", "col0", "[", "1", "]", ",", "col0", "[", "2", "]", ",", "col0", "[", "3", "]", ",", "col1...
// Mat4FromCols builds a new matrix from column vectors.
[ "Mat4FromCols", "builds", "a", "new", "matrix", "from", "column", "vectors", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matrix.go#L2070-L2072
20,869
go-gl/mathgl
mgl32/matrix.go
String
func (m Mat4) String() string { buf := new(bytes.Buffer) w := tabwriter.NewWriter(buf, 4, 4, 1, ' ', tabwriter.AlignRight) for i := 0; i < 4; i++ { for _, col := range m.Row(i) { fmt.Fprintf(w, "%f\t", col) } fmt.Fprintln(w, "") } w.Flush() return buf.String() }
go
func (m Mat4) String() string { buf := new(bytes.Buffer) w := tabwriter.NewWriter(buf, 4, 4, 1, ' ', tabwriter.AlignRight) for i := 0; i < 4; i++ { for _, col := range m.Row(i) { fmt.Fprintf(w, "%f\t", col) } fmt.Fprintln(w, "") } w.Flush() return buf.String() }
[ "func", "(", "m", "Mat4", ")", "String", "(", ")", "string", "{", "buf", ":=", "new", "(", "bytes", ".", "Buffer", ")", "\n", "w", ":=", "tabwriter", ".", "NewWriter", "(", "buf", ",", "4", ",", "4", ",", "1", ",", "' '", ",", "tabwriter", ".",...
// Pretty prints the matrix
[ "Pretty", "prints", "the", "matrix" ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matrix.go#L2328-L2341
20,870
go-gl/mathgl
mgl32/matstack/transformStack.go
reseed
func (ms *TransformStack) reseed(n int, change mgl32.Mat4) error { backup := []mgl32.Mat4((*ms)[n:]) backup = append([]mgl32.Mat4{}, backup...) // copy into new slice curr := (*ms)[n] (*ms)[n] = (*ms)[n-1].Mul4(change) for i := n + 1; i < len(*ms); i++ { inv := curr.Inv() blank := mgl32.Mat4{} if inv == b...
go
func (ms *TransformStack) reseed(n int, change mgl32.Mat4) error { backup := []mgl32.Mat4((*ms)[n:]) backup = append([]mgl32.Mat4{}, backup...) // copy into new slice curr := (*ms)[n] (*ms)[n] = (*ms)[n-1].Mul4(change) for i := n + 1; i < len(*ms); i++ { inv := curr.Inv() blank := mgl32.Mat4{} if inv == b...
[ "func", "(", "ms", "*", "TransformStack", ")", "reseed", "(", "n", "int", ",", "change", "mgl32", ".", "Mat4", ")", "error", "{", "backup", ":=", "[", "]", "mgl32", ".", "Mat4", "(", "(", "*", "ms", ")", "[", "n", ":", "]", ")", "\n", "backup",...
// Operates like reseed with no bounds checking; allows us to overwrite // the leading identity matrix with Rebase.
[ "Operates", "like", "reseed", "with", "no", "bounds", "checking", ";", "allows", "us", "to", "overwrite", "the", "leading", "identity", "matrix", "with", "Rebase", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/matstack/transformStack.go#L106-L129
20,871
go-gl/mathgl
mgl32/shapes.go
CubicBezierCurve2D
func CubicBezierCurve2D(t float32, cPoint1, cPoint2, cPoint3, cPoint4 Vec2) Vec2 { if t < 0.0 || t > 1.0 { panic("Can't interpolate on bezier curve with t out of range [0.0,1.0]") } return cPoint1.Mul((1 - t) * (1 - t) * (1 - t)).Add(cPoint2.Mul(3 * (1 - t) * (1 - t) * t)).Add(cPoint3.Mul(3 * (1 - t) * t * t)).Ad...
go
func CubicBezierCurve2D(t float32, cPoint1, cPoint2, cPoint3, cPoint4 Vec2) Vec2 { if t < 0.0 || t > 1.0 { panic("Can't interpolate on bezier curve with t out of range [0.0,1.0]") } return cPoint1.Mul((1 - t) * (1 - t) * (1 - t)).Add(cPoint2.Mul(3 * (1 - t) * (1 - t) * t)).Add(cPoint3.Mul(3 * (1 - t) * t * t)).Ad...
[ "func", "CubicBezierCurve2D", "(", "t", "float32", ",", "cPoint1", ",", "cPoint2", ",", "cPoint3", ",", "cPoint4", "Vec2", ")", "Vec2", "{", "if", "t", "<", "0.0", "||", "t", ">", "1.0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "retur...
// CubicBezierCurve2D interpolates the point t on the given bezier curve.
[ "CubicBezierCurve2D", "interpolates", "the", "point", "t", "on", "the", "given", "bezier", "curve", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/shapes.go#L84-L90
20,872
go-gl/mathgl
mgl32/shapes.go
CubicBezierCurve3D
func CubicBezierCurve3D(t float32, cPoint1, cPoint2, cPoint3, cPoint4 Vec3) Vec3 { if t < 0.0 || t > 1.0 { panic("Can't interpolate on bezier curve with t out of range [0.0,1.0]") } return cPoint1.Mul((1 - t) * (1 - t) * (1 - t)).Add(cPoint2.Mul(3 * (1 - t) * (1 - t) * t)).Add(cPoint3.Mul(3 * (1 - t) * t * t)).Ad...
go
func CubicBezierCurve3D(t float32, cPoint1, cPoint2, cPoint3, cPoint4 Vec3) Vec3 { if t < 0.0 || t > 1.0 { panic("Can't interpolate on bezier curve with t out of range [0.0,1.0]") } return cPoint1.Mul((1 - t) * (1 - t) * (1 - t)).Add(cPoint2.Mul(3 * (1 - t) * (1 - t) * t)).Add(cPoint3.Mul(3 * (1 - t) * t * t)).Ad...
[ "func", "CubicBezierCurve3D", "(", "t", "float32", ",", "cPoint1", ",", "cPoint2", ",", "cPoint3", ",", "cPoint4", "Vec3", ")", "Vec3", "{", "if", "t", "<", "0.0", "||", "t", ">", "1.0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "retur...
// CubicBezierCurve3D interpolates the point t on the given bezier curve.
[ "CubicBezierCurve3D", "interpolates", "the", "point", "t", "on", "the", "given", "bezier", "curve", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/shapes.go#L93-L99
20,873
go-gl/mathgl
mgl32/shapes.go
BezierSplineInterpolate3D
func BezierSplineInterpolate3D(t float32, ranges [][2]float32, cPoints [][]Vec3) Vec3 { if len(ranges) != len(cPoints) { panic("Each bezier curve needs a range") } for i, curveRange := range ranges { if t >= curveRange[0] && t <= curveRange[1] { return BezierCurve3D((t-curveRange[0])/(curveRange[1]-curveRang...
go
func BezierSplineInterpolate3D(t float32, ranges [][2]float32, cPoints [][]Vec3) Vec3 { if len(ranges) != len(cPoints) { panic("Each bezier curve needs a range") } for i, curveRange := range ranges { if t >= curveRange[0] && t <= curveRange[1] { return BezierCurve3D((t-curveRange[0])/(curveRange[1]-curveRang...
[ "func", "BezierSplineInterpolate3D", "(", "t", "float32", ",", "ranges", "[", "]", "[", "2", "]", "float32", ",", "cPoints", "[", "]", "[", "]", "Vec3", ")", "Vec3", "{", "if", "len", "(", "ranges", ")", "!=", "len", "(", "cPoints", ")", "{", "pani...
// BezierSplineInterpolate3D does interpolation over a spline of several bezier // curves. Each bezier curve must have a finite range, though the spline may be // disjoint. The bezier curves are not required to be in any particular order. // // If t is out of the range of all given curves, this function will panic
[ "BezierSplineInterpolate3D", "does", "interpolation", "over", "a", "spline", "of", "several", "bezier", "curves", ".", "Each", "bezier", "curve", "must", "have", "a", "finite", "range", "though", "the", "spline", "may", "be", "disjoint", ".", "The", "bezier", ...
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl32/shapes.go#L247-L259
20,874
go-gl/mathgl
mgl64/matrix.go
ApproxEqualThreshold
func (m1 Mat2) ApproxEqualThreshold(m2 Mat2, threshold float64) bool { for i := range m1 { if !FloatEqualThreshold(m1[i], m2[i], threshold) { return false } } return true }
go
func (m1 Mat2) ApproxEqualThreshold(m2 Mat2, threshold float64) bool { for i := range m1 { if !FloatEqualThreshold(m1[i], m2[i], threshold) { return false } } return true }
[ "func", "(", "m1", "Mat2", ")", "ApproxEqualThreshold", "(", "m2", "Mat2", ",", "threshold", "float64", ")", "bool", "{", "for", "i", ":=", "range", "m1", "{", "if", "!", "FloatEqualThreshold", "(", "m1", "[", "i", "]", ",", "m2", "[", "i", "]", ",...
// ApproxEqualThreshold performs an element-wise approximate equality test between two matrices // with a given epsilon threshold, as if FloatEqualThreshold had been used.
[ "ApproxEqualThreshold", "performs", "an", "element", "-", "wise", "approximate", "equality", "test", "between", "two", "matrices", "with", "a", "given", "epsilon", "threshold", "as", "if", "FloatEqualThreshold", "had", "been", "used", "." ]
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/matrix.go#L260-L267
20,875
go-gl/mathgl
mgl64/matrix.go
ApproxFuncEqual
func (m1 Mat2) ApproxFuncEqual(m2 Mat2, eq func(float64, float64) bool) bool { for i := range m1 { if !eq(m1[i], m2[i]) { return false } } return true }
go
func (m1 Mat2) ApproxFuncEqual(m2 Mat2, eq func(float64, float64) bool) bool { for i := range m1 { if !eq(m1[i], m2[i]) { return false } } return true }
[ "func", "(", "m1", "Mat2", ")", "ApproxFuncEqual", "(", "m2", "Mat2", ",", "eq", "func", "(", "float64", ",", "float64", ")", "bool", ")", "bool", "{", "for", "i", ":=", "range", "m1", "{", "if", "!", "eq", "(", "m1", "[", "i", "]", ",", "m2", ...
// ApproxFuncEqual performs an element-wise approximate equality test between two matrices // with a given equality functions, intended to be used with FloatEqualFunc; although and comparison // function may be used in practice.
[ "ApproxFuncEqual", "performs", "an", "element", "-", "wise", "approximate", "equality", "test", "between", "two", "matrices", "with", "a", "given", "equality", "functions", "intended", "to", "be", "used", "with", "FloatEqualFunc", ";", "although", "and", "comparis...
c4601bc793c7a480dab005cf969aab0d7a7fb07d
https://github.com/go-gl/mathgl/blob/c4601bc793c7a480dab005cf969aab0d7a7fb07d/mgl64/matrix.go#L272-L279
20,876
rkt/rkt
tools/depsgen/main.go
getAllDepTypes
func getAllDepTypes() []string { depTypes := make([]string, 0, len(cmds)) for depType := range cmds { depTypes = append(depTypes, depType) } sort.Strings(depTypes) return depTypes }
go
func getAllDepTypes() []string { depTypes := make([]string, 0, len(cmds)) for depType := range cmds { depTypes = append(depTypes, depType) } sort.Strings(depTypes) return depTypes }
[ "func", "getAllDepTypes", "(", ")", "[", "]", "string", "{", "depTypes", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "cmds", ")", ")", "\n", "for", "depType", ":=", "range", "cmds", "{", "depTypes", "=", "append", "(", "depTyp...
// getAllDepTypes returns a sorted list of names of all dep type // commands.
[ "getAllDepTypes", "returns", "a", "sorted", "list", "of", "names", "of", "all", "dep", "type", "commands", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/tools/depsgen/main.go#L47-L54
20,877
rkt/rkt
rkt/image/io.go
getIoProgressReader
func getIoProgressReader(label string, res *http.Response) io.Reader { prefix := "Downloading " + label fmtBytesSize := 18 barSize := int64(80 - len(prefix) - fmtBytesSize) bar := ioprogress.DrawTextFormatBarForW(barSize, os.Stderr) fmtfunc := func(progress, total int64) string { // Content-Length is set to -1 w...
go
func getIoProgressReader(label string, res *http.Response) io.Reader { prefix := "Downloading " + label fmtBytesSize := 18 barSize := int64(80 - len(prefix) - fmtBytesSize) bar := ioprogress.DrawTextFormatBarForW(barSize, os.Stderr) fmtfunc := func(progress, total int64) string { // Content-Length is set to -1 w...
[ "func", "getIoProgressReader", "(", "label", "string", ",", "res", "*", "http", ".", "Response", ")", "io", ".", "Reader", "{", "prefix", ":=", "\"", "\"", "+", "label", "\n", "fmtBytesSize", ":=", "18", "\n", "barSize", ":=", "int64", "(", "80", "-", ...
// getIoProgressReader returns a reader that wraps the HTTP response // body, so it prints a pretty progress bar when reading data from it.
[ "getIoProgressReader", "returns", "a", "reader", "that", "wraps", "the", "HTTP", "response", "body", "so", "it", "prints", "a", "pretty", "progress", "bar", "when", "reading", "data", "from", "it", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/image/io.go#L60-L87
20,878
rkt/rkt
rkt/image/io.go
Close
func (f *removeOnClose) Close() error { if f == nil || f.File == nil { return nil } name := f.File.Name() if err := f.File.Close(); err != nil { return err } if err := os.Remove(name); err != nil && !os.IsNotExist(err) { return err } return nil }
go
func (f *removeOnClose) Close() error { if f == nil || f.File == nil { return nil } name := f.File.Name() if err := f.File.Close(); err != nil { return err } if err := os.Remove(name); err != nil && !os.IsNotExist(err) { return err } return nil }
[ "func", "(", "f", "*", "removeOnClose", ")", "Close", "(", ")", "error", "{", "if", "f", "==", "nil", "||", "f", ".", "File", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "name", ":=", "f", ".", "File", ".", "Name", "(", ")", "\n", "if...
// Close closes the file and then removes it from disk. No error is // returned if the file did not exist at the point of removal.
[ "Close", "closes", "the", "file", "and", "then", "removes", "it", "from", "disk", ".", "No", "error", "is", "returned", "if", "the", "file", "did", "not", "exist", "at", "the", "point", "of", "removal", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/image/io.go#L107-L119
20,879
rkt/rkt
rkt/image/io.go
getTmpROC
func getTmpROC(s *imagestore.Store, path string) (*removeOnClose, error) { h := sha512.New() h.Write([]byte(path)) pathHash := s.HashToKey(h) tmp, err := s.TmpNamedFile(pathHash) if err != nil { return nil, errwrap.Wrap(errors.New("error setting up temporary file"), err) } // let's lock the file to avoid con...
go
func getTmpROC(s *imagestore.Store, path string) (*removeOnClose, error) { h := sha512.New() h.Write([]byte(path)) pathHash := s.HashToKey(h) tmp, err := s.TmpNamedFile(pathHash) if err != nil { return nil, errwrap.Wrap(errors.New("error setting up temporary file"), err) } // let's lock the file to avoid con...
[ "func", "getTmpROC", "(", "s", "*", "imagestore", ".", "Store", ",", "path", "string", ")", "(", "*", "removeOnClose", ",", "error", ")", "{", "h", ":=", "sha512", ".", "New", "(", ")", "\n", "h", ".", "Write", "(", "[", "]", "byte", "(", "path",...
// getTmpROC returns a removeOnClose instance wrapping a temporary // file provided by the passed store. The actual file name is based on // a hash of the passed path.
[ "getTmpROC", "returns", "a", "removeOnClose", "instance", "wrapping", "a", "temporary", "file", "provided", "by", "the", "passed", "store", ".", "The", "actual", "file", "name", "is", "based", "on", "a", "hash", "of", "the", "passed", "path", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/image/io.go#L124-L149
20,880
rkt/rkt
stage0/manifest.go
getStage1Entrypoint
func getStage1Entrypoint(cdir string, entrypoint string) (string, error) { b, err := ioutil.ReadFile(common.Stage1ManifestPath(cdir)) if err != nil { return "", errwrap.Wrap(errors.New("error reading pod manifest"), err) } s1m := schema.ImageManifest{} if err := json.Unmarshal(b, &s1m); err != nil { return ""...
go
func getStage1Entrypoint(cdir string, entrypoint string) (string, error) { b, err := ioutil.ReadFile(common.Stage1ManifestPath(cdir)) if err != nil { return "", errwrap.Wrap(errors.New("error reading pod manifest"), err) } s1m := schema.ImageManifest{} if err := json.Unmarshal(b, &s1m); err != nil { return ""...
[ "func", "getStage1Entrypoint", "(", "cdir", "string", ",", "entrypoint", "string", ")", "(", "string", ",", "error", ")", "{", "b", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "common", ".", "Stage1ManifestPath", "(", "cdir", ")", ")", "\n", "if", ...
// getStage1Entrypoint retrieves the named entrypoint from the stage1 manifest for a given pod
[ "getStage1Entrypoint", "retrieves", "the", "named", "entrypoint", "from", "the", "stage1", "manifest", "for", "a", "given", "pod" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage0/manifest.go#L69-L85
20,881
rkt/rkt
stage0/manifest.go
getStage1InterfaceVersion
func getStage1InterfaceVersion(cdir string) (int, error) { b, err := ioutil.ReadFile(common.Stage1ManifestPath(cdir)) if err != nil { return -1, errwrap.Wrap(errors.New("error reading pod manifest"), err) } s1m := schema.ImageManifest{} if err := json.Unmarshal(b, &s1m); err != nil { return -1, errwrap.Wrap(e...
go
func getStage1InterfaceVersion(cdir string) (int, error) { b, err := ioutil.ReadFile(common.Stage1ManifestPath(cdir)) if err != nil { return -1, errwrap.Wrap(errors.New("error reading pod manifest"), err) } s1m := schema.ImageManifest{} if err := json.Unmarshal(b, &s1m); err != nil { return -1, errwrap.Wrap(e...
[ "func", "getStage1InterfaceVersion", "(", "cdir", "string", ")", "(", "int", ",", "error", ")", "{", "b", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "common", ".", "Stage1ManifestPath", "(", "cdir", ")", ")", "\n", "if", "err", "!=", "nil", "{",...
// getStage1InterfaceVersion retrieves the interface version from the stage1 // manifest for a given pod
[ "getStage1InterfaceVersion", "retrieves", "the", "interface", "version", "from", "the", "stage1", "manifest", "for", "a", "given", "pod" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage0/manifest.go#L89-L110
20,882
rkt/rkt
networking/podenv.go
loadNets
func (e *podEnv) loadNets() ([]activeNet, error) { if e.netsLoadList.None() { stderr.Printf("networking namespace with loopback only") return nil, nil } nets, err := e.newNetLoader().loadNets(e.netsLoadList) if err != nil { return nil, err } netSlice := make([]activeNet, 0, len(nets)) for _, net := range ...
go
func (e *podEnv) loadNets() ([]activeNet, error) { if e.netsLoadList.None() { stderr.Printf("networking namespace with loopback only") return nil, nil } nets, err := e.newNetLoader().loadNets(e.netsLoadList) if err != nil { return nil, err } netSlice := make([]activeNet, 0, len(nets)) for _, net := range ...
[ "func", "(", "e", "*", "podEnv", ")", "loadNets", "(", ")", "(", "[", "]", "activeNet", ",", "error", ")", "{", "if", "e", ".", "netsLoadList", ".", "None", "(", ")", "{", "stderr", ".", "Printf", "(", "\"", "\"", ")", "\n", "return", "nil", ",...
// Loads nets specified by user, both from a configurable user location and builtin from stage1. User supplied network // configs override what is built into stage1. // The order in which networks are applied to pods will be defined by their filenames.
[ "Loads", "nets", "specified", "by", "user", "both", "from", "a", "configurable", "user", "location", "and", "builtin", "from", "stage1", ".", "User", "supplied", "network", "configs", "override", "what", "is", "built", "into", "stage1", ".", "The", "order", ...
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/networking/podenv.go#L75-L102
20,883
rkt/rkt
stage1/init/common/app.go
prepareApp
func prepareApp(p *stage1commontypes.Pod, ra *schema.RuntimeApp) (*preparedApp, error) { pa := preparedApp{ app: ra, env: ra.App.Environment, noNewPrivileges: getAppNoNewPrivileges(ra.App.Isolators), } var err error // Determine numeric uid and gid u, g, err := ParseUserGroup(p, ra) ...
go
func prepareApp(p *stage1commontypes.Pod, ra *schema.RuntimeApp) (*preparedApp, error) { pa := preparedApp{ app: ra, env: ra.App.Environment, noNewPrivileges: getAppNoNewPrivileges(ra.App.Isolators), } var err error // Determine numeric uid and gid u, g, err := ParseUserGroup(p, ra) ...
[ "func", "prepareApp", "(", "p", "*", "stage1commontypes", ".", "Pod", ",", "ra", "*", "schema", ".", "RuntimeApp", ")", "(", "*", "preparedApp", ",", "error", ")", "{", "pa", ":=", "preparedApp", "{", "app", ":", "ra", ",", "env", ":", "ra", ".", "...
// prepareApp sets up the internal runtime context for a specific app.
[ "prepareApp", "sets", "up", "the", "internal", "runtime", "context", "for", "a", "specific", "app", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/init/common/app.go#L98-L166
20,884
rkt/rkt
stage1/init/common/app.go
computeAppResources
func computeAppResources(isolators types.Isolators) (appResources, error) { res := appResources{} var err error withIsolator := func(name string, f func() error) error { ok, err := cgroup.IsIsolatorSupported(name) if err != nil { return errwrap.Wrapf("could not check for isolator "+name, err) } if !ok {...
go
func computeAppResources(isolators types.Isolators) (appResources, error) { res := appResources{} var err error withIsolator := func(name string, f func() error) error { ok, err := cgroup.IsIsolatorSupported(name) if err != nil { return errwrap.Wrapf("could not check for isolator "+name, err) } if !ok {...
[ "func", "computeAppResources", "(", "isolators", "types", ".", "Isolators", ")", "(", "appResources", ",", "error", ")", "{", "res", ":=", "appResources", "{", "}", "\n", "var", "err", "error", "\n\n", "withIsolator", ":=", "func", "(", "name", "string", "...
// computeAppResources processes any isolators that manipulate cgroups.
[ "computeAppResources", "processes", "any", "isolators", "that", "manipulate", "cgroups", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/init/common/app.go#L169-L229
20,885
rkt/rkt
store/imagestore/aciinfo.go
GetACIInfosWithKeyPrefix
func GetACIInfosWithKeyPrefix(tx *sql.Tx, prefix string) ([]*ACIInfo, error) { var aciinfos []*ACIInfo rows, err := tx.Query("SELECT * from aciinfo WHERE hasPrefix(blobkey, $1)", prefix) if err != nil { return nil, err } defer rows.Close() for rows.Next() { aciinfo := &ACIInfo{} if err := aciinfoRowScan(row...
go
func GetACIInfosWithKeyPrefix(tx *sql.Tx, prefix string) ([]*ACIInfo, error) { var aciinfos []*ACIInfo rows, err := tx.Query("SELECT * from aciinfo WHERE hasPrefix(blobkey, $1)", prefix) if err != nil { return nil, err } defer rows.Close() for rows.Next() { aciinfo := &ACIInfo{} if err := aciinfoRowScan(row...
[ "func", "GetACIInfosWithKeyPrefix", "(", "tx", "*", "sql", ".", "Tx", ",", "prefix", "string", ")", "(", "[", "]", "*", "ACIInfo", ",", "error", ")", "{", "var", "aciinfos", "[", "]", "*", "ACIInfo", "\n", "rows", ",", "err", ":=", "tx", ".", "Quer...
// GetAciInfosWithKeyPrefix returns all the ACIInfos with a blobkey starting with the given prefix.
[ "GetAciInfosWithKeyPrefix", "returns", "all", "the", "ACIInfos", "with", "a", "blobkey", "starting", "with", "the", "given", "prefix", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/store/imagestore/aciinfo.go#L68-L86
20,886
rkt/rkt
store/imagestore/aciinfo.go
GetACIInfosWithName
func GetACIInfosWithName(tx *sql.Tx, name string) ([]*ACIInfo, bool, error) { var aciinfos []*ACIInfo found := false rows, err := tx.Query("SELECT * from aciinfo WHERE name == $1", name) if err != nil { return nil, false, err } defer rows.Close() for rows.Next() { found = true aciinfo := &ACIInfo{} if er...
go
func GetACIInfosWithName(tx *sql.Tx, name string) ([]*ACIInfo, bool, error) { var aciinfos []*ACIInfo found := false rows, err := tx.Query("SELECT * from aciinfo WHERE name == $1", name) if err != nil { return nil, false, err } defer rows.Close() for rows.Next() { found = true aciinfo := &ACIInfo{} if er...
[ "func", "GetACIInfosWithName", "(", "tx", "*", "sql", ".", "Tx", ",", "name", "string", ")", "(", "[", "]", "*", "ACIInfo", ",", "bool", ",", "error", ")", "{", "var", "aciinfos", "[", "]", "*", "ACIInfo", "\n", "found", ":=", "false", "\n", "rows"...
// GetAciInfosWithName returns all the ACIInfos for a given name. found will be // false if no aciinfo exists.
[ "GetAciInfosWithName", "returns", "all", "the", "ACIInfos", "for", "a", "given", "name", ".", "found", "will", "be", "false", "if", "no", "aciinfo", "exists", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/store/imagestore/aciinfo.go#L90-L110
20,887
rkt/rkt
store/imagestore/aciinfo.go
GetACIInfoWithBlobKey
func GetACIInfoWithBlobKey(tx *sql.Tx, blobKey string) (*ACIInfo, bool, error) { aciinfo := &ACIInfo{} found := false rows, err := tx.Query("SELECT * from aciinfo WHERE blobkey == $1", blobKey) if err != nil { return nil, false, err } defer rows.Close() for rows.Next() { found = true if err := aciinfoRowSc...
go
func GetACIInfoWithBlobKey(tx *sql.Tx, blobKey string) (*ACIInfo, bool, error) { aciinfo := &ACIInfo{} found := false rows, err := tx.Query("SELECT * from aciinfo WHERE blobkey == $1", blobKey) if err != nil { return nil, false, err } defer rows.Close() for rows.Next() { found = true if err := aciinfoRowSc...
[ "func", "GetACIInfoWithBlobKey", "(", "tx", "*", "sql", ".", "Tx", ",", "blobKey", "string", ")", "(", "*", "ACIInfo", ",", "bool", ",", "error", ")", "{", "aciinfo", ":=", "&", "ACIInfo", "{", "}", "\n", "found", ":=", "false", "\n", "rows", ",", ...
// GetAciInfosWithBlobKey returns the ACIInfo with the given blobKey. found will be // false if no aciinfo exists.
[ "GetAciInfosWithBlobKey", "returns", "the", "ACIInfo", "with", "the", "given", "blobKey", ".", "found", "will", "be", "false", "if", "no", "aciinfo", "exists", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/store/imagestore/aciinfo.go#L114-L134
20,888
rkt/rkt
store/imagestore/aciinfo.go
GetAllACIInfos
func GetAllACIInfos(tx *sql.Tx, sortfields []string, ascending bool) ([]*ACIInfo, error) { var aciinfos []*ACIInfo query := "SELECT * from aciinfo" if len(sortfields) > 0 { query += fmt.Sprintf(" ORDER BY %s ", strings.Join(sortfields, ", ")) if ascending { query += "ASC" } else { query += "DESC" } } ...
go
func GetAllACIInfos(tx *sql.Tx, sortfields []string, ascending bool) ([]*ACIInfo, error) { var aciinfos []*ACIInfo query := "SELECT * from aciinfo" if len(sortfields) > 0 { query += fmt.Sprintf(" ORDER BY %s ", strings.Join(sortfields, ", ")) if ascending { query += "ASC" } else { query += "DESC" } } ...
[ "func", "GetAllACIInfos", "(", "tx", "*", "sql", ".", "Tx", ",", "sortfields", "[", "]", "string", ",", "ascending", "bool", ")", "(", "[", "]", "*", "ACIInfo", ",", "error", ")", "{", "var", "aciinfos", "[", "]", "*", "ACIInfo", "\n", "query", ":=...
// GetAllACIInfos returns all the ACIInfos sorted by optional sortfields and // with ascending or descending order.
[ "GetAllACIInfos", "returns", "all", "the", "ACIInfos", "sorted", "by", "optional", "sortfields", "and", "with", "ascending", "or", "descending", "order", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/store/imagestore/aciinfo.go#L138-L165
20,889
rkt/rkt
store/imagestore/aciinfo.go
WriteACIInfo
func WriteACIInfo(tx *sql.Tx, aciinfo *ACIInfo) error { // ql doesn't have an INSERT OR UPDATE function so // it's faster to remove and reinsert the row _, err := tx.Exec("DELETE from aciinfo where blobkey == $1", aciinfo.BlobKey) if err != nil { return err } _, err = tx.Exec("INSERT into aciinfo (blobkey, name...
go
func WriteACIInfo(tx *sql.Tx, aciinfo *ACIInfo) error { // ql doesn't have an INSERT OR UPDATE function so // it's faster to remove and reinsert the row _, err := tx.Exec("DELETE from aciinfo where blobkey == $1", aciinfo.BlobKey) if err != nil { return err } _, err = tx.Exec("INSERT into aciinfo (blobkey, name...
[ "func", "WriteACIInfo", "(", "tx", "*", "sql", ".", "Tx", ",", "aciinfo", "*", "ACIInfo", ")", "error", "{", "// ql doesn't have an INSERT OR UPDATE function so", "// it's faster to remove and reinsert the row", "_", ",", "err", ":=", "tx", ".", "Exec", "(", "\"", ...
// WriteACIInfo adds or updates the provided aciinfo.
[ "WriteACIInfo", "adds", "or", "updates", "the", "provided", "aciinfo", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/store/imagestore/aciinfo.go#L168-L181
20,890
rkt/rkt
stage1/init/kvm/hypervisor/hvqemu/qemu_driver.go
StartCmd
func StartCmd(wdPath, name, kernelPath string, nds []kvm.NetDescriber, cpu, mem int64, debug bool) []string { var ( driverConfiguration = hypervisor.KvmHypervisor{ Bin: "./qemu", KernelParams: []string{ "root=/dev/root", "rootfstype=9p", "rootflags=trans=virtio,version=9p2000.L,cache=mmap", "rw...
go
func StartCmd(wdPath, name, kernelPath string, nds []kvm.NetDescriber, cpu, mem int64, debug bool) []string { var ( driverConfiguration = hypervisor.KvmHypervisor{ Bin: "./qemu", KernelParams: []string{ "root=/dev/root", "rootfstype=9p", "rootflags=trans=virtio,version=9p2000.L,cache=mmap", "rw...
[ "func", "StartCmd", "(", "wdPath", ",", "name", ",", "kernelPath", "string", ",", "nds", "[", "]", "kvm", ".", "NetDescriber", ",", "cpu", ",", "mem", "int64", ",", "debug", "bool", ")", "[", "]", "string", "{", "var", "(", "driverConfiguration", "=", ...
// StartCmd takes path to stage1, name of the machine, path to kernel, network describers, memory in megabytes // and quantity of cpus and prepares command line to run QEMU process
[ "StartCmd", "takes", "path", "to", "stage1", "name", "of", "the", "machine", "path", "to", "kernel", "network", "describers", "memory", "in", "megabytes", "and", "quantity", "of", "cpus", "and", "prepares", "command", "line", "to", "run", "QEMU", "process" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/init/kvm/hypervisor/hvqemu/qemu_driver.go#L29-L63
20,891
rkt/rkt
stage1/init/kvm/hypervisor/hvqemu/qemu_driver.go
kvmNetArgs
func kvmNetArgs(nds []kvm.NetDescriber) []string { var qemuArgs []string for _, nd := range nds { qemuArgs = append(qemuArgs, []string{"-net", "nic,model=virtio"}...) qemuNic := fmt.Sprintf("tap,ifname=%s,script=no,downscript=no,vhost=on", nd.IfName()) qemuArgs = append(qemuArgs, []string{"-net", qemuNic}...) ...
go
func kvmNetArgs(nds []kvm.NetDescriber) []string { var qemuArgs []string for _, nd := range nds { qemuArgs = append(qemuArgs, []string{"-net", "nic,model=virtio"}...) qemuNic := fmt.Sprintf("tap,ifname=%s,script=no,downscript=no,vhost=on", nd.IfName()) qemuArgs = append(qemuArgs, []string{"-net", qemuNic}...) ...
[ "func", "kvmNetArgs", "(", "nds", "[", "]", "kvm", ".", "NetDescriber", ")", "[", "]", "string", "{", "var", "qemuArgs", "[", "]", "string", "\n\n", "for", "_", ",", "nd", ":=", "range", "nds", "{", "qemuArgs", "=", "append", "(", "qemuArgs", ",", ...
// kvmNetArgs returns additional arguments that need to be passed // to qemu to configure networks properly. Logic is based on // network configuration extracted from Networking struct // and essentially from activeNets that expose NetDescriber behavior
[ "kvmNetArgs", "returns", "additional", "arguments", "that", "need", "to", "be", "passed", "to", "qemu", "to", "configure", "networks", "properly", ".", "Logic", "is", "based", "on", "network", "configuration", "extracted", "from", "Networking", "struct", "and", ...
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/init/kvm/hypervisor/hvqemu/qemu_driver.go#L69-L79
20,892
rkt/rkt
stage1/init/kvm/hypervisor/hypervisor.go
InitKernelParams
func (hv *KvmHypervisor) InitKernelParams(isDebug bool) { hv.KernelParams = append(hv.KernelParams, []string{ "console=hvc0", "init=/usr/lib/systemd/systemd", "no_timer_check", "noreplace-smp", "tsc=reliable"}...) if isDebug { hv.KernelParams = append(hv.KernelParams, []string{ "debug", "systemd.lo...
go
func (hv *KvmHypervisor) InitKernelParams(isDebug bool) { hv.KernelParams = append(hv.KernelParams, []string{ "console=hvc0", "init=/usr/lib/systemd/systemd", "no_timer_check", "noreplace-smp", "tsc=reliable"}...) if isDebug { hv.KernelParams = append(hv.KernelParams, []string{ "debug", "systemd.lo...
[ "func", "(", "hv", "*", "KvmHypervisor", ")", "InitKernelParams", "(", "isDebug", "bool", ")", "{", "hv", ".", "KernelParams", "=", "append", "(", "hv", ".", "KernelParams", ",", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ...
// InitKernelParams sets debug and common parameters passed to the kernel
[ "InitKernelParams", "sets", "debug", "and", "common", "parameters", "passed", "to", "the", "kernel" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/init/kvm/hypervisor/hypervisor.go#L26-L54
20,893
rkt/rkt
rkt/image/dockerfetcher.go
Hash
func (f *dockerFetcher) Hash(u *url.URL) (string, error) { ensureLogger(f.Debug) dockerURL, err := d2acommon.ParseDockerURL(path.Join(u.Host, u.Path)) if err != nil { return "", fmt.Errorf(`invalid docker URL %q; expected syntax is "docker://[REGISTRY_HOST[:REGISTRY_PORT]/]IMAGE_NAME[:TAG]"`, u) } latest := dock...
go
func (f *dockerFetcher) Hash(u *url.URL) (string, error) { ensureLogger(f.Debug) dockerURL, err := d2acommon.ParseDockerURL(path.Join(u.Host, u.Path)) if err != nil { return "", fmt.Errorf(`invalid docker URL %q; expected syntax is "docker://[REGISTRY_HOST[:REGISTRY_PORT]/]IMAGE_NAME[:TAG]"`, u) } latest := dock...
[ "func", "(", "f", "*", "dockerFetcher", ")", "Hash", "(", "u", "*", "url", ".", "URL", ")", "(", "string", ",", "error", ")", "{", "ensureLogger", "(", "f", ".", "Debug", ")", "\n", "dockerURL", ",", "err", ":=", "d2acommon", ".", "ParseDockerURL", ...
// Hash uses docker2aci to download the image and convert it to // ACI, then stores it in the store and returns the hash.
[ "Hash", "uses", "docker2aci", "to", "download", "the", "image", "and", "convert", "it", "to", "ACI", "then", "stores", "it", "in", "the", "store", "and", "returns", "the", "hash", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/image/dockerfetcher.go#L51-L59
20,894
rkt/rkt
stage0/registration.go
registerPod
func registerPod(root string, uuid *types.UUID, apps schema.AppList) (token string, rerr error) { u := uuid.String() var err error token, err = generateMDSToken() if err != nil { rerr = errwrap.Wrap(errors.New("failed to generate MDS token"), err) return } pmfPath := common.PodManifestPath(root) pmf, err :...
go
func registerPod(root string, uuid *types.UUID, apps schema.AppList) (token string, rerr error) { u := uuid.String() var err error token, err = generateMDSToken() if err != nil { rerr = errwrap.Wrap(errors.New("failed to generate MDS token"), err) return } pmfPath := common.PodManifestPath(root) pmf, err :...
[ "func", "registerPod", "(", "root", "string", ",", "uuid", "*", "types", ".", "UUID", ",", "apps", "schema", ".", "AppList", ")", "(", "token", "string", ",", "rerr", "error", ")", "{", "u", ":=", "uuid", ".", "String", "(", ")", "\n\n", "var", "er...
// registerPod registers pod with metadata service. // Returns authentication token to be passed in the URL
[ "registerPod", "registers", "pod", "with", "metadata", "service", ".", "Returns", "authentication", "token", "to", "be", "passed", "in", "the", "URL" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage0/registration.go#L54-L109
20,895
rkt/rkt
stage0/registration.go
unregisterPod
func unregisterPod(root string, uuid *types.UUID) error { _, err := os.Stat(filepath.Join(root, mdsRegisteredFile)) switch { case err == nil: pth := path.Join("/pods", uuid.String()) return httpRequest("DELETE", pth, nil) case os.IsNotExist(err): return nil default: return err } }
go
func unregisterPod(root string, uuid *types.UUID) error { _, err := os.Stat(filepath.Join(root, mdsRegisteredFile)) switch { case err == nil: pth := path.Join("/pods", uuid.String()) return httpRequest("DELETE", pth, nil) case os.IsNotExist(err): return nil default: return err } }
[ "func", "unregisterPod", "(", "root", "string", ",", "uuid", "*", "types", ".", "UUID", ")", "error", "{", "_", ",", "err", ":=", "os", ".", "Stat", "(", "filepath", ".", "Join", "(", "root", ",", "mdsRegisteredFile", ")", ")", "\n", "switch", "{", ...
// unregisterPod unregisters pod with the metadata service.
[ "unregisterPod", "unregisters", "pod", "with", "the", "metadata", "service", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage0/registration.go#L112-L125
20,896
rkt/rkt
stage0/registration.go
CheckMdsAvailability
func CheckMdsAvailability() error { if conn, err := net.Dial("unix", common.MetadataServiceRegSock); err != nil { return errUnreachable } else { conn.Close() return nil } }
go
func CheckMdsAvailability() error { if conn, err := net.Dial("unix", common.MetadataServiceRegSock); err != nil { return errUnreachable } else { conn.Close() return nil } }
[ "func", "CheckMdsAvailability", "(", ")", "error", "{", "if", "conn", ",", "err", ":=", "net", ".", "Dial", "(", "\"", "\"", ",", "common", ".", "MetadataServiceRegSock", ")", ";", "err", "!=", "nil", "{", "return", "errUnreachable", "\n", "}", "else", ...
// CheckMdsAvailability checks whether a local metadata service can be reached.
[ "CheckMdsAvailability", "checks", "whether", "a", "local", "metadata", "service", "can", "be", "reached", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage0/registration.go#L196-L203
20,897
rkt/rkt
networking/netinfo/netinfo.go
MergeCNIResult
func (ni *NetInfo) MergeCNIResult(result types.Result) { ni.IP = result.IP4.IP.IP ni.Mask = net.IP(result.IP4.IP.Mask) ni.HostIP = result.IP4.Gateway ni.IP4 = result.IP4 ni.DNS = result.DNS }
go
func (ni *NetInfo) MergeCNIResult(result types.Result) { ni.IP = result.IP4.IP.IP ni.Mask = net.IP(result.IP4.IP.Mask) ni.HostIP = result.IP4.Gateway ni.IP4 = result.IP4 ni.DNS = result.DNS }
[ "func", "(", "ni", "*", "NetInfo", ")", "MergeCNIResult", "(", "result", "types", ".", "Result", ")", "{", "ni", ".", "IP", "=", "result", ".", "IP4", ".", "IP", ".", "IP", "\n", "ni", ".", "Mask", "=", "net", ".", "IP", "(", "result", ".", "IP...
// MergeCNIResult will incorporate the result of a CNI plugin's execution
[ "MergeCNIResult", "will", "incorporate", "the", "result", "of", "a", "CNI", "plugin", "s", "execution" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/networking/netinfo/netinfo.go#L74-L80
20,898
rkt/rkt
pkg/multicall/multicall.go
Add
func Add(name string, fn commandFn) Entrypoint { if _, ok := commands[name]; ok { panic(fmt.Errorf("command with name %q already exists", name)) } commands[name] = fn return Entrypoint(name) }
go
func Add(name string, fn commandFn) Entrypoint { if _, ok := commands[name]; ok { panic(fmt.Errorf("command with name %q already exists", name)) } commands[name] = fn return Entrypoint(name) }
[ "func", "Add", "(", "name", "string", ",", "fn", "commandFn", ")", "Entrypoint", "{", "if", "_", ",", "ok", ":=", "commands", "[", "name", "]", ";", "ok", "{", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ")", ")", "\n", "}...
// Add adds a new multicall command. name is the command name and fn is the // function that will be executed for the specified command. It returns the // related Entrypoint. // Packages adding new multicall commands should call Add in their init // function.
[ "Add", "adds", "a", "new", "multicall", "command", ".", "name", "is", "the", "command", "name", "and", "fn", "is", "the", "function", "that", "will", "be", "executed", "for", "the", "specified", "command", ".", "It", "returns", "the", "related", "Entrypoin...
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/pkg/multicall/multicall.go#L52-L58
20,899
rkt/rkt
rkt/stage1hash.go
addStage1ImageFlags
func addStage1ImageFlags(flags *pflag.FlagSet) { for _, data := range stage1FlagsData { wrapper := &stage1ImageLocationFlag{ loc: &overriddenStage1Location, kind: data.kind, } flags.Var(wrapper, data.flag, data.help) } }
go
func addStage1ImageFlags(flags *pflag.FlagSet) { for _, data := range stage1FlagsData { wrapper := &stage1ImageLocationFlag{ loc: &overriddenStage1Location, kind: data.kind, } flags.Var(wrapper, data.flag, data.help) } }
[ "func", "addStage1ImageFlags", "(", "flags", "*", "pflag", ".", "FlagSet", ")", "{", "for", "_", ",", "data", ":=", "range", "stage1FlagsData", "{", "wrapper", ":=", "&", "stage1ImageLocationFlag", "{", "loc", ":", "&", "overriddenStage1Location", ",", "kind",...
// addStage1ImageFlags adds flags for specifying custom stage1 image
[ "addStage1ImageFlags", "adds", "flags", "for", "specifying", "custom", "stage1", "image" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/stage1hash.go#L157-L165