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
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
28,900
go-gl/glfw
v3.2/glfw/input.go
SetCursorPosCallback
func (w *Window) SetCursorPosCallback(cbfun CursorPosCallback) (previous CursorPosCallback) { previous = w.fCursorPosHolder w.fCursorPosHolder = cbfun if cbfun == nil { C.glfwSetCursorPosCallback(w.data, nil) } else { C.glfwSetCursorPosCallbackCB(w.data) } panicError() return previous }
go
func (w *Window) SetCursorPosCallback(cbfun CursorPosCallback) (previous CursorPosCallback) { previous = w.fCursorPosHolder w.fCursorPosHolder = cbfun if cbfun == nil { C.glfwSetCursorPosCallback(w.data, nil) } else { C.glfwSetCursorPosCallbackCB(w.data) } panicError() return previous }
[ "func", "(", "w", "*", "Window", ")", "SetCursorPosCallback", "(", "cbfun", "CursorPosCallback", ")", "(", "previous", "CursorPosCallback", ")", "{", "previous", "=", "w", ".", "fCursorPosHolder", "\n", "w", ".", "fCursorPosHolder", "=", "cbfun", "\n", "if", ...
// SetCursorPosCallback sets the cursor position callback which is called // when the cursor is moved. The callback is provided with the position relative // to the upper-left corner of the client area of the window.
[ "SetCursorPosCallback", "sets", "the", "cursor", "position", "callback", "which", "is", "called", "when", "the", "cursor", "is", "moved", ".", "The", "callback", "is", "provided", "with", "the", "position", "relative", "to", "the", "upper", "-", "left", "corne...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/input.go#L588-L598
28,901
go-gl/glfw
v3.2/glfw/input.go
SetDropCallback
func (w *Window) SetDropCallback(cbfun DropCallback) (previous DropCallback) { previous = w.fDropHolder w.fDropHolder = cbfun if cbfun == nil { C.glfwSetDropCallback(w.data, nil) } else { C.glfwSetDropCallbackCB(w.data) } panicError() return previous }
go
func (w *Window) SetDropCallback(cbfun DropCallback) (previous DropCallback) { previous = w.fDropHolder w.fDropHolder = cbfun if cbfun == nil { C.glfwSetDropCallback(w.data, nil) } else { C.glfwSetDropCallbackCB(w.data) } panicError() return previous }
[ "func", "(", "w", "*", "Window", ")", "SetDropCallback", "(", "cbfun", "DropCallback", ")", "(", "previous", "DropCallback", ")", "{", "previous", "=", "w", ".", "fDropHolder", "\n", "w", ".", "fDropHolder", "=", "cbfun", "\n", "if", "cbfun", "==", "nil"...
// SetDropCallback sets the drop callback which is called when an object // is dropped over the window.
[ "SetDropCallback", "sets", "the", "drop", "callback", "which", "is", "called", "when", "an", "object", "is", "dropped", "over", "the", "window", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/input.go#L639-L649
28,902
go-gl/glfw
v3.2/glfw/input.go
JoystickPresent
func JoystickPresent(joy Joystick) bool { ret := glfwbool(C.glfwJoystickPresent(C.int(joy))) panicError() return ret }
go
func JoystickPresent(joy Joystick) bool { ret := glfwbool(C.glfwJoystickPresent(C.int(joy))) panicError() return ret }
[ "func", "JoystickPresent", "(", "joy", "Joystick", ")", "bool", "{", "ret", ":=", "glfwbool", "(", "C", ".", "glfwJoystickPresent", "(", "C", ".", "int", "(", "joy", ")", ")", ")", "\n", "panicError", "(", ")", "\n", "return", "ret", "\n", "}" ]
// JoystickPresent reports whether the specified joystick is present.
[ "JoystickPresent", "reports", "whether", "the", "specified", "joystick", "is", "present", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/input.go#L652-L656
28,903
go-gl/glfw
v3.2/glfw/input.go
GetJoystickAxes
func GetJoystickAxes(joy Joystick) []float32 { var length int axis := C.glfwGetJoystickAxes(C.int(joy), (*C.int)(unsafe.Pointer(&length))) panicError() if axis == nil { return nil } a := make([]float32, length) for i := 0; i < length; i++ { a[i] = float32(C.GetAxisAtIndex(axis, C.int(i))) } return a }
go
func GetJoystickAxes(joy Joystick) []float32 { var length int axis := C.glfwGetJoystickAxes(C.int(joy), (*C.int)(unsafe.Pointer(&length))) panicError() if axis == nil { return nil } a := make([]float32, length) for i := 0; i < length; i++ { a[i] = float32(C.GetAxisAtIndex(axis, C.int(i))) } return a }
[ "func", "GetJoystickAxes", "(", "joy", "Joystick", ")", "[", "]", "float32", "{", "var", "length", "int", "\n\n", "axis", ":=", "C", ".", "glfwGetJoystickAxes", "(", "C", ".", "int", "(", "joy", ")", ",", "(", "*", "C", ".", "int", ")", "(", "unsaf...
// GetJoystickAxes returns a slice of axis values.
[ "GetJoystickAxes", "returns", "a", "slice", "of", "axis", "values", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/input.go#L659-L673
28,904
go-gl/glfw
v3.2/glfw/error.go
Error
func (e *Error) Error() string { return fmt.Sprintf("%s: %s", e.Code.String(), e.Desc) }
go
func (e *Error) Error() string { return fmt.Sprintf("%s: %s", e.Code.String(), e.Desc) }
[ "func", "(", "e", "*", "Error", ")", "Error", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "e", ".", "Code", ".", "String", "(", ")", ",", "e", ".", "Desc", ")", "\n", "}" ]
// Error prints the error code and description in a readable format.
[ "Error", "prints", "the", "error", "code", "and", "description", "in", "a", "readable", "format", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/error.go#L104-L106
28,905
go-gl/glfw
v3.2/glfw/error.go
flushErrors
func flushErrors() { err := fetchError() if err != nil { fmt.Println("GLFW: An uncaught error has occurred:", err) fmt.Println("GLFW: Please report this bug in the Go package immediately.") } }
go
func flushErrors() { err := fetchError() if err != nil { fmt.Println("GLFW: An uncaught error has occurred:", err) fmt.Println("GLFW: Please report this bug in the Go package immediately.") } }
[ "func", "flushErrors", "(", ")", "{", "err", ":=", "fetchError", "(", ")", "\n", "if", "err", "!=", "nil", "{", "fmt", ".", "Println", "(", "\"", "\"", ",", "err", ")", "\n", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n", "}", "\n", "}" ]
// flushErrors is called by Terminate before it actually calls C.glfwTerminate, // this ensures that any uncaught errors buffered in lastError are printed // before the program exits.
[ "flushErrors", "is", "called", "by", "Terminate", "before", "it", "actually", "calls", "C", ".", "glfwTerminate", "this", "ensures", "that", "any", "uncaught", "errors", "buffered", "in", "lastError", "are", "printed", "before", "the", "program", "exits", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/error.go#L134-L140
28,906
go-gl/glfw
v3.0/glfw/glfw.go
GetVersion
func GetVersion() (major, minor, revision int) { var ( maj C.int min C.int rev C.int ) C.glfwGetVersion(&maj, &min, &rev) return int(maj), int(min), int(rev) }
go
func GetVersion() (major, minor, revision int) { var ( maj C.int min C.int rev C.int ) C.glfwGetVersion(&maj, &min, &rev) return int(maj), int(min), int(rev) }
[ "func", "GetVersion", "(", ")", "(", "major", ",", "minor", ",", "revision", "int", ")", "{", "var", "(", "maj", "C", ".", "int", "\n", "min", "C", ".", "int", "\n", "rev", "C", ".", "int", "\n", ")", "\n\n", "C", ".", "glfwGetVersion", "(", "&...
//GetVersion retrieves the major, minor and revision numbers of the GLFW //library. It is intended for when you are using GLFW as a shared library and //want to ensure that you are using the minimum required version. // //This function may be called before Init.
[ "GetVersion", "retrieves", "the", "major", "minor", "and", "revision", "numbers", "of", "the", "GLFW", "library", ".", "It", "is", "intended", "for", "when", "you", "are", "using", "GLFW", "as", "a", "shared", "library", "and", "want", "to", "ensure", "tha...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.0/glfw/glfw.go#L67-L76
28,907
go-gl/glfw
v3.0/glfw/input.go
GetKey
func (w *Window) GetKey(key Key) Action { return Action(C.glfwGetKey(w.data, C.int(key))) }
go
func (w *Window) GetKey(key Key) Action { return Action(C.glfwGetKey(w.data, C.int(key))) }
[ "func", "(", "w", "*", "Window", ")", "GetKey", "(", "key", "Key", ")", "Action", "{", "return", "Action", "(", "C", ".", "glfwGetKey", "(", "w", ".", "data", ",", "C", ".", "int", "(", "key", ")", ")", ")", "\n", "}" ]
//GetKey returns the last reported state of a keyboard key. The returned state //is one of Press or Release. The higher-level state Repeat is only reported to //the key callback. // //If the StickyKeys input mode is enabled, this function returns Press the first //time you call this function after a key has been presse...
[ "GetKey", "returns", "the", "last", "reported", "state", "of", "a", "keyboard", "key", ".", "The", "returned", "state", "is", "one", "of", "Press", "or", "Release", ".", "The", "higher", "-", "level", "state", "Repeat", "is", "only", "reported", "to", "t...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.0/glfw/input.go#L290-L292
28,908
go-gl/glfw
v3.0/glfw/input.go
GetMouseButton
func (w *Window) GetMouseButton(button MouseButton) Action { return Action(C.glfwGetMouseButton(w.data, C.int(button))) }
go
func (w *Window) GetMouseButton(button MouseButton) Action { return Action(C.glfwGetMouseButton(w.data, C.int(button))) }
[ "func", "(", "w", "*", "Window", ")", "GetMouseButton", "(", "button", "MouseButton", ")", "Action", "{", "return", "Action", "(", "C", ".", "glfwGetMouseButton", "(", "w", ".", "data", ",", "C", ".", "int", "(", "button", ")", ")", ")", "\n", "}" ]
//GetMouseButton returns the last state reported for the specified mouse button. // //If the StickyMouseButtons input mode is enabled, this function returns Press //the first time you call this function after a mouse button has been pressed, //even if the mouse button has already been released.
[ "GetMouseButton", "returns", "the", "last", "state", "reported", "for", "the", "specified", "mouse", "button", ".", "If", "the", "StickyMouseButtons", "input", "mode", "is", "enabled", "this", "function", "returns", "Press", "the", "first", "time", "you", "call"...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.0/glfw/input.go#L299-L301
28,909
go-gl/glfw
v3.0/glfw/input.go
SetCharacterCallback
func (w *Window) SetCharacterCallback(cbfun func(w *Window, char uint)) { if cbfun == nil { C.glfwSetCharCallback(w.data, nil) } else { w.fCharHolder = cbfun C.glfwSetCharCallbackCB(w.data) } }
go
func (w *Window) SetCharacterCallback(cbfun func(w *Window, char uint)) { if cbfun == nil { C.glfwSetCharCallback(w.data, nil) } else { w.fCharHolder = cbfun C.glfwSetCharCallbackCB(w.data) } }
[ "func", "(", "w", "*", "Window", ")", "SetCharacterCallback", "(", "cbfun", "func", "(", "w", "*", "Window", ",", "char", "uint", ")", ")", "{", "if", "cbfun", "==", "nil", "{", "C", ".", "glfwSetCharCallback", "(", "w", ".", "data", ",", "nil", ")...
//SetCharacterCallback sets the character callback which is called when a //Unicode character is input. // //The character callback is intended for text input. If you want to know whether //a specific key was pressed or released, use the key callback instead.
[ "SetCharacterCallback", "sets", "the", "character", "callback", "which", "is", "called", "when", "a", "Unicode", "character", "is", "input", ".", "The", "character", "callback", "is", "intended", "for", "text", "input", ".", "If", "you", "want", "to", "know", ...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.0/glfw/input.go#L354-L361
28,910
go-gl/glfw
v3.0/glfw/input.go
SetCursorPositionCallback
func (w *Window) SetCursorPositionCallback(cbfun func(w *Window, xpos float64, ypos float64)) { if cbfun == nil { C.glfwSetCursorPosCallback(w.data, nil) } else { w.fCursorPosHolder = cbfun C.glfwSetCursorPosCallbackCB(w.data) } }
go
func (w *Window) SetCursorPositionCallback(cbfun func(w *Window, xpos float64, ypos float64)) { if cbfun == nil { C.glfwSetCursorPosCallback(w.data, nil) } else { w.fCursorPosHolder = cbfun C.glfwSetCursorPosCallbackCB(w.data) } }
[ "func", "(", "w", "*", "Window", ")", "SetCursorPositionCallback", "(", "cbfun", "func", "(", "w", "*", "Window", ",", "xpos", "float64", ",", "ypos", "float64", ")", ")", "{", "if", "cbfun", "==", "nil", "{", "C", ".", "glfwSetCursorPosCallback", "(", ...
//SetCursorPositionCallback sets the cursor position callback which is called //when the cursor is moved. The callback is provided with the position relative //to the upper-left corner of the client area of the window.
[ "SetCursorPositionCallback", "sets", "the", "cursor", "position", "callback", "which", "is", "called", "when", "the", "cursor", "is", "moved", ".", "The", "callback", "is", "provided", "with", "the", "position", "relative", "to", "the", "upper", "-", "left", "...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.0/glfw/input.go#L383-L390
28,911
go-gl/glfw
v3.0/glfw/input.go
GetJoystickButtons
func GetJoystickButtons(joy Joystick) ([]byte, error) { var length int buttons := C.glfwGetJoystickButtons(C.int(joy), (*C.int)(unsafe.Pointer(&length))) if buttons == nil { return nil, errors.New("Joystick is not present.") } b := make([]byte, length) for i := 0; i < length; i++ { b[i] = byte(C.GetButtonsA...
go
func GetJoystickButtons(joy Joystick) ([]byte, error) { var length int buttons := C.glfwGetJoystickButtons(C.int(joy), (*C.int)(unsafe.Pointer(&length))) if buttons == nil { return nil, errors.New("Joystick is not present.") } b := make([]byte, length) for i := 0; i < length; i++ { b[i] = byte(C.GetButtonsA...
[ "func", "GetJoystickButtons", "(", "joy", "Joystick", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "length", "int", "\n\n", "buttons", ":=", "C", ".", "glfwGetJoystickButtons", "(", "C", ".", "int", "(", "joy", ")", ",", "(", "*", "C", ...
//GetJoystickButtons returns a slice of button values.
[ "GetJoystickButtons", "returns", "a", "slice", "of", "button", "values", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.0/glfw/input.go#L437-L451
28,912
go-gl/glfw
v3.0/glfw/window.go
GetPosition
func (w *Window) GetPosition() (x, y int) { var xpos, ypos C.int C.glfwGetWindowPos(w.data, &xpos, &ypos) return int(xpos), int(ypos) }
go
func (w *Window) GetPosition() (x, y int) { var xpos, ypos C.int C.glfwGetWindowPos(w.data, &xpos, &ypos) return int(xpos), int(ypos) }
[ "func", "(", "w", "*", "Window", ")", "GetPosition", "(", ")", "(", "x", ",", "y", "int", ")", "{", "var", "xpos", ",", "ypos", "C", ".", "int", "\n\n", "C", ".", "glfwGetWindowPos", "(", "w", ".", "data", ",", "&", "xpos", ",", "&", "ypos", ...
//GetPosition returns the position, in screen coordinates, of the upper-left //corner of the client area of the window.
[ "GetPosition", "returns", "the", "position", "in", "screen", "coordinates", "of", "the", "upper", "-", "left", "corner", "of", "the", "client", "area", "of", "the", "window", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.0/glfw/window.go#L300-L305
28,913
go-gl/glfw
v3.0/glfw/window.go
GetSize
func (w *Window) GetSize() (width, height int) { var wi, h C.int C.glfwGetWindowSize(w.data, &wi, &h) return int(wi), int(h) }
go
func (w *Window) GetSize() (width, height int) { var wi, h C.int C.glfwGetWindowSize(w.data, &wi, &h) return int(wi), int(h) }
[ "func", "(", "w", "*", "Window", ")", "GetSize", "(", ")", "(", "width", ",", "height", "int", ")", "{", "var", "wi", ",", "h", "C", ".", "int", "\n", "C", ".", "glfwGetWindowSize", "(", "w", ".", "data", ",", "&", "wi", ",", "&", "h", ")", ...
//GetSize returns the size, in screen coordinates, of the client area of the //specified window.
[ "GetSize", "returns", "the", "size", "in", "screen", "coordinates", "of", "the", "client", "area", "of", "the", "specified", "window", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.0/glfw/window.go#L328-L332
28,914
go-gl/glfw
v3.0/glfw/window.go
GetFramebufferSize
func (w *Window) GetFramebufferSize() (width, height int) { var wi, h C.int C.glfwGetFramebufferSize(w.data, &wi, &h) return int(wi), int(h) }
go
func (w *Window) GetFramebufferSize() (width, height int) { var wi, h C.int C.glfwGetFramebufferSize(w.data, &wi, &h) return int(wi), int(h) }
[ "func", "(", "w", "*", "Window", ")", "GetFramebufferSize", "(", ")", "(", "width", ",", "height", "int", ")", "{", "var", "wi", ",", "h", "C", ".", "int", "\n", "C", ".", "glfwGetFramebufferSize", "(", "w", ".", "data", ",", "&", "wi", ",", "&",...
//GetFramebufferSize retrieves the size, in pixels, of the framebuffer of the //specified window.
[ "GetFramebufferSize", "retrieves", "the", "size", "in", "pixels", "of", "the", "framebuffer", "of", "the", "specified", "window", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.0/glfw/window.go#L351-L355
28,915
go-gl/glfw
v3.0/glfw/window.go
GetMonitor
func (w *Window) GetMonitor() (*Monitor, error) { m := C.glfwGetWindowMonitor(w.data) if m == nil { return nil, errors.New("Can't get the monitor.") } return &Monitor{m}, nil }
go
func (w *Window) GetMonitor() (*Monitor, error) { m := C.glfwGetWindowMonitor(w.data) if m == nil { return nil, errors.New("Can't get the monitor.") } return &Monitor{m}, nil }
[ "func", "(", "w", "*", "Window", ")", "GetMonitor", "(", ")", "(", "*", "Monitor", ",", "error", ")", "{", "m", ":=", "C", ".", "glfwGetWindowMonitor", "(", "w", ".", "data", ")", "\n\n", "if", "m", "==", "nil", "{", "return", "nil", ",", "errors...
//GetMonitor returns the handle of the monitor that the window is in //fullscreen on.
[ "GetMonitor", "returns", "the", "handle", "of", "the", "monitor", "that", "the", "window", "is", "in", "fullscreen", "on", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.0/glfw/window.go#L399-L406
28,916
go-gl/glfw
v3.0/glfw/window.go
GetAttribute
func (w *Window) GetAttribute(attrib Hint) int { return int(C.glfwGetWindowAttrib(w.data, C.int(attrib))) }
go
func (w *Window) GetAttribute(attrib Hint) int { return int(C.glfwGetWindowAttrib(w.data, C.int(attrib))) }
[ "func", "(", "w", "*", "Window", ")", "GetAttribute", "(", "attrib", "Hint", ")", "int", "{", "return", "int", "(", "C", ".", "glfwGetWindowAttrib", "(", "w", ".", "data", ",", "C", ".", "int", "(", "attrib", ")", ")", ")", "\n", "}" ]
//GetAttribute returns an attribute of the window. There are many attributes, //some related to the window and others to its context.
[ "GetAttribute", "returns", "an", "attribute", "of", "the", "window", ".", "There", "are", "many", "attributes", "some", "related", "to", "the", "window", "and", "others", "to", "its", "context", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.0/glfw/window.go#L410-L412
28,917
go-gl/glfw
v3.0/glfw/window.go
SetPositionCallback
func (w *Window) SetPositionCallback(cbfun func(w *Window, xpos int, ypos int)) { if cbfun == nil { C.glfwSetWindowPosCallback(w.data, nil) } else { w.fPosHolder = cbfun C.glfwSetWindowPosCallbackCB(w.data) } }
go
func (w *Window) SetPositionCallback(cbfun func(w *Window, xpos int, ypos int)) { if cbfun == nil { C.glfwSetWindowPosCallback(w.data, nil) } else { w.fPosHolder = cbfun C.glfwSetWindowPosCallbackCB(w.data) } }
[ "func", "(", "w", "*", "Window", ")", "SetPositionCallback", "(", "cbfun", "func", "(", "w", "*", "Window", ",", "xpos", "int", ",", "ypos", "int", ")", ")", "{", "if", "cbfun", "==", "nil", "{", "C", ".", "glfwSetWindowPosCallback", "(", "w", ".", ...
//SetPositionCallback sets the position callback of the window, which is called //when the window is moved. The callback is provided with the screen position //of the upper-left corner of the client area of the window.
[ "SetPositionCallback", "sets", "the", "position", "callback", "of", "the", "window", "which", "is", "called", "when", "the", "window", "is", "moved", ".", "The", "callback", "is", "provided", "with", "the", "screen", "position", "of", "the", "upper", "-", "l...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.0/glfw/window.go#L429-L436
28,918
go-gl/glfw
v3.2/glfw/window.go
WindowHint
func WindowHint(target Hint, hint int) { C.glfwWindowHint(C.int(target), C.int(hint)) panicError() }
go
func WindowHint(target Hint, hint int) { C.glfwWindowHint(C.int(target), C.int(hint)) panicError() }
[ "func", "WindowHint", "(", "target", "Hint", ",", "hint", "int", ")", "{", "C", ".", "glfwWindowHint", "(", "C", ".", "int", "(", "target", ")", ",", "C", ".", "int", "(", "hint", ")", ")", "\n", "panicError", "(", ")", "\n", "}" ]
// WindowHint sets hints for the next call to CreateWindow. The hints, // once set, retain their values until changed by a call to WindowHint or // DefaultWindowHints, or until the library is terminated with Terminate. // // This function may only be called from the main thread.
[ "WindowHint", "sets", "hints", "for", "the", "next", "call", "to", "CreateWindow", ".", "The", "hints", "once", "set", "retain", "their", "values", "until", "changed", "by", "a", "call", "to", "WindowHint", "or", "DefaultWindowHints", "or", "until", "the", "...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/window.go#L234-L237
28,919
go-gl/glfw
v3.2/glfw/window.go
Destroy
func (w *Window) Destroy() { windows.remove(w.data) C.glfwDestroyWindow(w.data) panicError() }
go
func (w *Window) Destroy() { windows.remove(w.data) C.glfwDestroyWindow(w.data) panicError() }
[ "func", "(", "w", "*", "Window", ")", "Destroy", "(", ")", "{", "windows", ".", "remove", "(", "w", ".", "data", ")", "\n", "C", ".", "glfwDestroyWindow", "(", "w", ".", "data", ")", "\n", "panicError", "(", ")", "\n", "}" ]
// Destroy destroys the specified window and its context. On calling this // function, no further callbacks will be called for that window. // // This function may only be called from the main thread.
[ "Destroy", "destroys", "the", "specified", "window", "and", "its", "context", ".", "On", "calling", "this", "function", "no", "further", "callbacks", "will", "be", "called", "for", "that", "window", ".", "This", "function", "may", "only", "be", "called", "fr...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/window.go#L301-L305
28,920
go-gl/glfw
v3.2/glfw/window.go
ShouldClose
func (w *Window) ShouldClose() bool { ret := glfwbool(C.glfwWindowShouldClose(w.data)) panicError() return ret }
go
func (w *Window) ShouldClose() bool { ret := glfwbool(C.glfwWindowShouldClose(w.data)) panicError() return ret }
[ "func", "(", "w", "*", "Window", ")", "ShouldClose", "(", ")", "bool", "{", "ret", ":=", "glfwbool", "(", "C", ".", "glfwWindowShouldClose", "(", "w", ".", "data", ")", ")", "\n", "panicError", "(", ")", "\n", "return", "ret", "\n", "}" ]
// ShouldClose reports the value of the close flag of the specified window.
[ "ShouldClose", "reports", "the", "value", "of", "the", "close", "flag", "of", "the", "specified", "window", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/window.go#L308-L312
28,921
go-gl/glfw
v3.2/glfw/window.go
SetShouldClose
func (w *Window) SetShouldClose(value bool) { if !value { C.glfwSetWindowShouldClose(w.data, C.int(False)) } else { C.glfwSetWindowShouldClose(w.data, C.int(True)) } panicError() }
go
func (w *Window) SetShouldClose(value bool) { if !value { C.glfwSetWindowShouldClose(w.data, C.int(False)) } else { C.glfwSetWindowShouldClose(w.data, C.int(True)) } panicError() }
[ "func", "(", "w", "*", "Window", ")", "SetShouldClose", "(", "value", "bool", ")", "{", "if", "!", "value", "{", "C", ".", "glfwSetWindowShouldClose", "(", "w", ".", "data", ",", "C", ".", "int", "(", "False", ")", ")", "\n", "}", "else", "{", "C...
// SetShouldClose sets the value of the close flag of the window. This can be // used to override the user's attempt to close the window, or to signal that it // should be closed.
[ "SetShouldClose", "sets", "the", "value", "of", "the", "close", "flag", "of", "the", "window", ".", "This", "can", "be", "used", "to", "override", "the", "user", "s", "attempt", "to", "close", "the", "window", "or", "to", "signal", "that", "it", "should"...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/window.go#L317-L324
28,922
go-gl/glfw
v3.2/glfw/window.go
GetPos
func (w *Window) GetPos() (x, y int) { var xpos, ypos C.int C.glfwGetWindowPos(w.data, &xpos, &ypos) panicError() return int(xpos), int(ypos) }
go
func (w *Window) GetPos() (x, y int) { var xpos, ypos C.int C.glfwGetWindowPos(w.data, &xpos, &ypos) panicError() return int(xpos), int(ypos) }
[ "func", "(", "w", "*", "Window", ")", "GetPos", "(", ")", "(", "x", ",", "y", "int", ")", "{", "var", "xpos", ",", "ypos", "C", ".", "int", "\n", "C", ".", "glfwGetWindowPos", "(", "w", ".", "data", ",", "&", "xpos", ",", "&", "ypos", ")", ...
// GetPos returns the position, in screen coordinates, of the upper-left // corner of the client area of the window.
[ "GetPos", "returns", "the", "position", "in", "screen", "coordinates", "of", "the", "upper", "-", "left", "corner", "of", "the", "client", "area", "of", "the", "window", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/window.go#L389-L394
28,923
go-gl/glfw
v3.2/glfw/window.go
SetSizeLimits
func (w *Window) SetSizeLimits(minw, minh, maxw, maxh int) { C.glfwSetWindowSizeLimits(w.data, C.int(minw), C.int(minh), C.int(maxw), C.int(maxh)) panicError() }
go
func (w *Window) SetSizeLimits(minw, minh, maxw, maxh int) { C.glfwSetWindowSizeLimits(w.data, C.int(minw), C.int(minh), C.int(maxw), C.int(maxh)) panicError() }
[ "func", "(", "w", "*", "Window", ")", "SetSizeLimits", "(", "minw", ",", "minh", ",", "maxw", ",", "maxh", "int", ")", "{", "C", ".", "glfwSetWindowSizeLimits", "(", "w", ".", "data", ",", "C", ".", "int", "(", "minw", ")", ",", "C", ".", "int", ...
// SetSizeLimits sets the size limits of the client area of the specified window. // If the window is full screen or not resizable, this function does nothing. // // The size limits are applied immediately and may cause the window to be resized.
[ "SetSizeLimits", "sets", "the", "size", "limits", "of", "the", "client", "area", "of", "the", "specified", "window", ".", "If", "the", "window", "is", "full", "screen", "or", "not", "resizable", "this", "function", "does", "nothing", ".", "The", "size", "l...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/window.go#L443-L446
28,924
go-gl/glfw
v3.2/glfw/window.go
GetFrameSize
func (w *Window) GetFrameSize() (left, top, right, bottom int) { var l, t, r, b C.int C.glfwGetWindowFrameSize(w.data, &l, &t, &r, &b) panicError() return int(l), int(t), int(r), int(b) }
go
func (w *Window) GetFrameSize() (left, top, right, bottom int) { var l, t, r, b C.int C.glfwGetWindowFrameSize(w.data, &l, &t, &r, &b) panicError() return int(l), int(t), int(r), int(b) }
[ "func", "(", "w", "*", "Window", ")", "GetFrameSize", "(", ")", "(", "left", ",", "top", ",", "right", ",", "bottom", "int", ")", "{", "var", "l", ",", "t", ",", "r", ",", "b", "C", ".", "int", "\n", "C", ".", "glfwGetWindowFrameSize", "(", "w"...
// GetFrameSize retrieves the size, in screen coordinates, of each edge of the frame // of the specified window. This size includes the title bar, if the window has one. // The size of the frame may vary depending on the window-related hints used to create it. // // Because this function retrieves the size of each wind...
[ "GetFrameSize", "retrieves", "the", "size", "in", "screen", "coordinates", "of", "each", "edge", "of", "the", "frame", "of", "the", "specified", "window", ".", "This", "size", "includes", "the", "title", "bar", "if", "the", "window", "has", "one", ".", "Th...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/window.go#L477-L482
28,925
go-gl/glfw
v3.2/glfw/window.go
Focus
func (w *Window) Focus() error { C.glfwFocusWindow(w.data) return acceptError(APIUnavailable) }
go
func (w *Window) Focus() error { C.glfwFocusWindow(w.data) return acceptError(APIUnavailable) }
[ "func", "(", "w", "*", "Window", ")", "Focus", "(", ")", "error", "{", "C", ".", "glfwFocusWindow", "(", "w", ".", "data", ")", "\n", "return", "acceptError", "(", "APIUnavailable", ")", "\n", "}" ]
// Focus brings the specified window to front and sets input focus. // The window should already be visible and not iconified. // // By default, both windowed and full screen mode windows are focused when initially created. // Set the glfw.Focused to disable this behavior. // // Do not use this function to steal focus ...
[ "Focus", "brings", "the", "specified", "window", "to", "front", "and", "sets", "input", "focus", ".", "The", "window", "should", "already", "be", "visible", "and", "not", "iconified", ".", "By", "default", "both", "windowed", "and", "full", "screen", "mode",...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/window.go#L492-L495
28,926
go-gl/glfw
v3.2/glfw/window.go
Maximize
func (w *Window) Maximize() error { C.glfwMaximizeWindow(w.data) return acceptError(APIUnavailable) }
go
func (w *Window) Maximize() error { C.glfwMaximizeWindow(w.data) return acceptError(APIUnavailable) }
[ "func", "(", "w", "*", "Window", ")", "Maximize", "(", ")", "error", "{", "C", ".", "glfwMaximizeWindow", "(", "w", ".", "data", ")", "\n", "return", "acceptError", "(", "APIUnavailable", ")", "\n", "}" ]
// Maximize maximizes the specified window if it was previously not maximized. // If the window is already maximized, this function does nothing. // // If the specified window is a full screen window, this function does nothing.
[ "Maximize", "maximizes", "the", "specified", "window", "if", "it", "was", "previously", "not", "maximized", ".", "If", "the", "window", "is", "already", "maximized", "this", "function", "does", "nothing", ".", "If", "the", "specified", "window", "is", "a", "...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/window.go#L512-L515
28,927
go-gl/glfw
v3.2/glfw/window.go
GetMonitor
func (w *Window) GetMonitor() *Monitor { m := C.glfwGetWindowMonitor(w.data) panicError() if m == nil { return nil } return &Monitor{m} }
go
func (w *Window) GetMonitor() *Monitor { m := C.glfwGetWindowMonitor(w.data) panicError() if m == nil { return nil } return &Monitor{m} }
[ "func", "(", "w", "*", "Window", ")", "GetMonitor", "(", ")", "*", "Monitor", "{", "m", ":=", "C", ".", "glfwGetWindowMonitor", "(", "w", ".", "data", ")", "\n", "panicError", "(", ")", "\n", "if", "m", "==", "nil", "{", "return", "nil", "\n", "}...
// GetMonitor returns the handle of the monitor that the window is in // fullscreen on. // // Returns nil if the window is in windowed mode.
[ "GetMonitor", "returns", "the", "handle", "of", "the", "monitor", "that", "the", "window", "is", "in", "fullscreen", "on", ".", "Returns", "nil", "if", "the", "window", "is", "in", "windowed", "mode", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/window.go#L550-L557
28,928
go-gl/glfw
v3.2/glfw/window.go
SetMonitor
func (w *Window) SetMonitor(monitor *Monitor, xpos, ypos, width, height, refreshRate int) { var m *C.GLFWmonitor if monitor == nil { m = nil } else { m = monitor.data } C.glfwSetWindowMonitor(w.data, m, C.int(xpos), C.int(ypos), C.int(width), C.int(height), C.int(refreshRate)) panicError() }
go
func (w *Window) SetMonitor(monitor *Monitor, xpos, ypos, width, height, refreshRate int) { var m *C.GLFWmonitor if monitor == nil { m = nil } else { m = monitor.data } C.glfwSetWindowMonitor(w.data, m, C.int(xpos), C.int(ypos), C.int(width), C.int(height), C.int(refreshRate)) panicError() }
[ "func", "(", "w", "*", "Window", ")", "SetMonitor", "(", "monitor", "*", "Monitor", ",", "xpos", ",", "ypos", ",", "width", ",", "height", ",", "refreshRate", "int", ")", "{", "var", "m", "*", "C", ".", "GLFWmonitor", "\n", "if", "monitor", "==", "...
// SetMonitor sets the monitor that the window uses for full screen mode or, // if the monitor is NULL, makes it windowed mode. // // When setting a monitor, this function updates the width, height and refresh // rate of the desired video mode and switches to the video mode closest to it. // The window position is igno...
[ "SetMonitor", "sets", "the", "monitor", "that", "the", "window", "uses", "for", "full", "screen", "mode", "or", "if", "the", "monitor", "is", "NULL", "makes", "it", "windowed", "mode", ".", "When", "setting", "a", "monitor", "this", "function", "updates", ...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/window.go#L574-L583
28,929
go-gl/glfw
v3.2/glfw/window.go
GetAttrib
func (w *Window) GetAttrib(attrib Hint) int { ret := int(C.glfwGetWindowAttrib(w.data, C.int(attrib))) panicError() return ret }
go
func (w *Window) GetAttrib(attrib Hint) int { ret := int(C.glfwGetWindowAttrib(w.data, C.int(attrib))) panicError() return ret }
[ "func", "(", "w", "*", "Window", ")", "GetAttrib", "(", "attrib", "Hint", ")", "int", "{", "ret", ":=", "int", "(", "C", ".", "glfwGetWindowAttrib", "(", "w", ".", "data", ",", "C", ".", "int", "(", "attrib", ")", ")", ")", "\n", "panicError", "(...
// GetAttrib returns an attribute of the window. There are many attributes, // some related to the window and others to its context.
[ "GetAttrib", "returns", "an", "attribute", "of", "the", "window", ".", "There", "are", "many", "attributes", "some", "related", "to", "the", "window", "and", "others", "to", "its", "context", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/window.go#L587-L591
28,930
go-gl/glfw
v3.2/glfw/window.go
SetUserPointer
func (w *Window) SetUserPointer(pointer unsafe.Pointer) { C.glfwSetWindowUserPointer(w.data, pointer) panicError() }
go
func (w *Window) SetUserPointer(pointer unsafe.Pointer) { C.glfwSetWindowUserPointer(w.data, pointer) panicError() }
[ "func", "(", "w", "*", "Window", ")", "SetUserPointer", "(", "pointer", "unsafe", ".", "Pointer", ")", "{", "C", ".", "glfwSetWindowUserPointer", "(", "w", ".", "data", ",", "pointer", ")", "\n", "panicError", "(", ")", "\n", "}" ]
// SetUserPointer sets the user-defined pointer of the window. The current value // is retained until the window is destroyed. The initial value is nil.
[ "SetUserPointer", "sets", "the", "user", "-", "defined", "pointer", "of", "the", "window", ".", "The", "current", "value", "is", "retained", "until", "the", "window", "is", "destroyed", ".", "The", "initial", "value", "is", "nil", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/window.go#L595-L598
28,931
go-gl/glfw
v3.2/glfw/window.go
GetUserPointer
func (w *Window) GetUserPointer() unsafe.Pointer { ret := C.glfwGetWindowUserPointer(w.data) panicError() return ret }
go
func (w *Window) GetUserPointer() unsafe.Pointer { ret := C.glfwGetWindowUserPointer(w.data) panicError() return ret }
[ "func", "(", "w", "*", "Window", ")", "GetUserPointer", "(", ")", "unsafe", ".", "Pointer", "{", "ret", ":=", "C", ".", "glfwGetWindowUserPointer", "(", "w", ".", "data", ")", "\n", "panicError", "(", ")", "\n", "return", "ret", "\n", "}" ]
// GetUserPointer returns the current value of the user-defined pointer of the // window. The initial value is nil.
[ "GetUserPointer", "returns", "the", "current", "value", "of", "the", "user", "-", "defined", "pointer", "of", "the", "window", ".", "The", "initial", "value", "is", "nil", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/window.go#L602-L606
28,932
go-gl/glfw
v3.2/glfw/window.go
SetPosCallback
func (w *Window) SetPosCallback(cbfun PosCallback) (previous PosCallback) { previous = w.fPosHolder w.fPosHolder = cbfun if cbfun == nil { C.glfwSetWindowPosCallback(w.data, nil) } else { C.glfwSetWindowPosCallbackCB(w.data) } panicError() return previous }
go
func (w *Window) SetPosCallback(cbfun PosCallback) (previous PosCallback) { previous = w.fPosHolder w.fPosHolder = cbfun if cbfun == nil { C.glfwSetWindowPosCallback(w.data, nil) } else { C.glfwSetWindowPosCallbackCB(w.data) } panicError() return previous }
[ "func", "(", "w", "*", "Window", ")", "SetPosCallback", "(", "cbfun", "PosCallback", ")", "(", "previous", "PosCallback", ")", "{", "previous", "=", "w", ".", "fPosHolder", "\n", "w", ".", "fPosHolder", "=", "cbfun", "\n", "if", "cbfun", "==", "nil", "...
// SetPosCallback sets the position callback of the window, which is called // when the window is moved. The callback is provided with the screen position // of the upper-left corner of the client area of the window.
[ "SetPosCallback", "sets", "the", "position", "callback", "of", "the", "window", "which", "is", "called", "when", "the", "window", "is", "moved", ".", "The", "callback", "is", "provided", "with", "the", "screen", "position", "of", "the", "upper", "-", "left",...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/window.go#L614-L624
28,933
go-gl/glfw
v3.2/glfw/window.go
SetClipboardString
func (w *Window) SetClipboardString(str string) { cp := C.CString(str) defer C.free(unsafe.Pointer(cp)) C.glfwSetClipboardString(w.data, cp) panicError() }
go
func (w *Window) SetClipboardString(str string) { cp := C.CString(str) defer C.free(unsafe.Pointer(cp)) C.glfwSetClipboardString(w.data, cp) panicError() }
[ "func", "(", "w", "*", "Window", ")", "SetClipboardString", "(", "str", "string", ")", "{", "cp", ":=", "C", ".", "CString", "(", "str", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cp", ")", ")", "\n", "C", ".", "...
// SetClipboardString sets the system clipboard to the specified UTF-8 encoded // string. // // This function may only be called from the main thread.
[ "SetClipboardString", "sets", "the", "system", "clipboard", "to", "the", "specified", "UTF", "-", "8", "encoded", "string", ".", "This", "function", "may", "only", "be", "called", "from", "the", "main", "thread", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/window.go#L749-L754
28,934
go-gl/glfw
v3.2/glfw/window.go
GetClipboardString
func (w *Window) GetClipboardString() (string, error) { cs := C.glfwGetClipboardString(w.data) if cs == nil { return "", acceptError(FormatUnavailable) } return C.GoString(cs), nil }
go
func (w *Window) GetClipboardString() (string, error) { cs := C.glfwGetClipboardString(w.data) if cs == nil { return "", acceptError(FormatUnavailable) } return C.GoString(cs), nil }
[ "func", "(", "w", "*", "Window", ")", "GetClipboardString", "(", ")", "(", "string", ",", "error", ")", "{", "cs", ":=", "C", ".", "glfwGetClipboardString", "(", "w", ".", "data", ")", "\n", "if", "cs", "==", "nil", "{", "return", "\"", "\"", ",", ...
// GetClipboardString returns the contents of the system clipboard, if it // contains or is convertible to a UTF-8 encoded string. // // This function may only be called from the main thread.
[ "GetClipboardString", "returns", "the", "contents", "of", "the", "system", "clipboard", "if", "it", "contains", "or", "is", "convertible", "to", "a", "UTF", "-", "8", "encoded", "string", ".", "This", "function", "may", "only", "be", "called", "from", "the",...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/window.go#L760-L766
28,935
go-gl/glfw
v3.2/glfw/native_darwin.go
GetCocoaMonitor
func (m *Monitor) GetCocoaMonitor() uintptr { ret := uintptr(C.glfwGetCocoaMonitor(m.data)) panicError() return ret }
go
func (m *Monitor) GetCocoaMonitor() uintptr { ret := uintptr(C.glfwGetCocoaMonitor(m.data)) panicError() return ret }
[ "func", "(", "m", "*", "Monitor", ")", "GetCocoaMonitor", "(", ")", "uintptr", "{", "ret", ":=", "uintptr", "(", "C", ".", "glfwGetCocoaMonitor", "(", "m", ".", "data", ")", ")", "\n", "panicError", "(", ")", "\n", "return", "ret", "\n", "}" ]
// GetCocoaMonitor returns the CGDirectDisplayID of the monitor.
[ "GetCocoaMonitor", "returns", "the", "CGDirectDisplayID", "of", "the", "monitor", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/native_darwin.go#L21-L25
28,936
go-gl/glfw
v3.2/glfw/native_darwin.go
GetCocoaWindow
func (w *Window) GetCocoaWindow() uintptr { ret := uintptr(C.workaround_glfwGetCocoaWindow(w.data)) panicError() return ret }
go
func (w *Window) GetCocoaWindow() uintptr { ret := uintptr(C.workaround_glfwGetCocoaWindow(w.data)) panicError() return ret }
[ "func", "(", "w", "*", "Window", ")", "GetCocoaWindow", "(", ")", "uintptr", "{", "ret", ":=", "uintptr", "(", "C", ".", "workaround_glfwGetCocoaWindow", "(", "w", ".", "data", ")", ")", "\n", "panicError", "(", ")", "\n", "return", "ret", "\n", "}" ]
// GetCocoaWindow returns the NSWindow of the window.
[ "GetCocoaWindow", "returns", "the", "NSWindow", "of", "the", "window", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/native_darwin.go#L28-L32
28,937
go-gl/glfw
v3.2/glfw/native_darwin.go
GetNSGLContext
func (w *Window) GetNSGLContext() uintptr { ret := uintptr(C.workaround_glfwGetNSGLContext(w.data)) panicError() return ret }
go
func (w *Window) GetNSGLContext() uintptr { ret := uintptr(C.workaround_glfwGetNSGLContext(w.data)) panicError() return ret }
[ "func", "(", "w", "*", "Window", ")", "GetNSGLContext", "(", ")", "uintptr", "{", "ret", ":=", "uintptr", "(", "C", ".", "workaround_glfwGetNSGLContext", "(", "w", ".", "data", ")", ")", "\n", "panicError", "(", ")", "\n", "return", "ret", "\n", "}" ]
// GetNSGLContext returns the NSOpenGLContext of the window.
[ "GetNSGLContext", "returns", "the", "NSOpenGLContext", "of", "the", "window", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/native_darwin.go#L35-L39
28,938
go-gl/glfw
v3.2/glfw/native_linbsd.go
GetX11Adapter
func (m *Monitor) GetX11Adapter() C.RRCrtc { ret := C.glfwGetX11Adapter(m.data) panicError() return ret }
go
func (m *Monitor) GetX11Adapter() C.RRCrtc { ret := C.glfwGetX11Adapter(m.data) panicError() return ret }
[ "func", "(", "m", "*", "Monitor", ")", "GetX11Adapter", "(", ")", "C", ".", "RRCrtc", "{", "ret", ":=", "C", ".", "glfwGetX11Adapter", "(", "m", ".", "data", ")", "\n", "panicError", "(", ")", "\n", "return", "ret", "\n", "}" ]
// GetX11Adapter returns the RRCrtc of the monitor.
[ "GetX11Adapter", "returns", "the", "RRCrtc", "of", "the", "monitor", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/native_linbsd.go#L19-L23
28,939
go-gl/glfw
v3.2/glfw/native_linbsd.go
GetX11Monitor
func (m *Monitor) GetX11Monitor() C.RROutput { ret := C.glfwGetX11Monitor(m.data) panicError() return ret }
go
func (m *Monitor) GetX11Monitor() C.RROutput { ret := C.glfwGetX11Monitor(m.data) panicError() return ret }
[ "func", "(", "m", "*", "Monitor", ")", "GetX11Monitor", "(", ")", "C", ".", "RROutput", "{", "ret", ":=", "C", ".", "glfwGetX11Monitor", "(", "m", ".", "data", ")", "\n", "panicError", "(", ")", "\n", "return", "ret", "\n", "}" ]
// GetX11Monitor returns the RROutput of the monitor.
[ "GetX11Monitor", "returns", "the", "RROutput", "of", "the", "monitor", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/native_linbsd.go#L26-L30
28,940
go-gl/glfw
v3.2/glfw/native_linbsd.go
GetX11Window
func (w *Window) GetX11Window() C.Window { ret := C.glfwGetX11Window(w.data) panicError() return ret }
go
func (w *Window) GetX11Window() C.Window { ret := C.glfwGetX11Window(w.data) panicError() return ret }
[ "func", "(", "w", "*", "Window", ")", "GetX11Window", "(", ")", "C", ".", "Window", "{", "ret", ":=", "C", ".", "glfwGetX11Window", "(", "w", ".", "data", ")", "\n", "panicError", "(", ")", "\n", "return", "ret", "\n", "}" ]
// GetX11Window returns the Window of the window.
[ "GetX11Window", "returns", "the", "Window", "of", "the", "window", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/native_linbsd.go#L33-L37
28,941
go-gl/glfw
v3.2/glfw/native_linbsd.go
GetGLXContext
func (w *Window) GetGLXContext() C.GLXContext { ret := C.glfwGetGLXContext(w.data) panicError() return ret }
go
func (w *Window) GetGLXContext() C.GLXContext { ret := C.glfwGetGLXContext(w.data) panicError() return ret }
[ "func", "(", "w", "*", "Window", ")", "GetGLXContext", "(", ")", "C", ".", "GLXContext", "{", "ret", ":=", "C", ".", "glfwGetGLXContext", "(", "w", ".", "data", ")", "\n", "panicError", "(", ")", "\n", "return", "ret", "\n", "}" ]
// GetGLXContext returns the GLXContext of the window.
[ "GetGLXContext", "returns", "the", "GLXContext", "of", "the", "window", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/native_linbsd.go#L40-L44
28,942
go-gl/glfw
v3.2/glfw/native_linbsd.go
GetGLXWindow
func (w *Window) GetGLXWindow() C.GLXWindow { ret := C.glfwGetGLXWindow(w.data) panicError() return ret }
go
func (w *Window) GetGLXWindow() C.GLXWindow { ret := C.glfwGetGLXWindow(w.data) panicError() return ret }
[ "func", "(", "w", "*", "Window", ")", "GetGLXWindow", "(", ")", "C", ".", "GLXWindow", "{", "ret", ":=", "C", ".", "glfwGetGLXWindow", "(", "w", ".", "data", ")", "\n", "panicError", "(", ")", "\n", "return", "ret", "\n", "}" ]
// GetGLXWindow returns the GLXWindow of the window.
[ "GetGLXWindow", "returns", "the", "GLXWindow", "of", "the", "window", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/native_linbsd.go#L47-L51
28,943
go-gl/glfw
v3.0/glfw/error.go
SetErrorCallback
func SetErrorCallback(cbfun func(code ErrorCode, desc string)) { if cbfun == nil { C.glfwSetErrorCallback(nil) } else { fErrorHolder = cbfun C.glfwSetErrorCallbackCB() } }
go
func SetErrorCallback(cbfun func(code ErrorCode, desc string)) { if cbfun == nil { C.glfwSetErrorCallback(nil) } else { fErrorHolder = cbfun C.glfwSetErrorCallbackCB() } }
[ "func", "SetErrorCallback", "(", "cbfun", "func", "(", "code", "ErrorCode", ",", "desc", "string", ")", ")", "{", "if", "cbfun", "==", "nil", "{", "C", ".", "glfwSetErrorCallback", "(", "nil", ")", "\n", "}", "else", "{", "fErrorHolder", "=", "cbfun", ...
//SetErrorCallback sets the error callback, which is called with an error code //and a human-readable description each time a GLFW error occurs. // //This function may be called before Init.
[ "SetErrorCallback", "sets", "the", "error", "callback", "which", "is", "called", "with", "an", "error", "code", "and", "a", "human", "-", "readable", "description", "each", "time", "a", "GLFW", "error", "occurs", ".", "This", "function", "may", "be", "called...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.0/glfw/error.go#L35-L42
28,944
go-gl/glfw
v3.2/glfw/context.go
ExtensionSupported
func ExtensionSupported(extension string) bool { e := C.CString(extension) defer C.free(unsafe.Pointer(e)) ret := glfwbool(C.glfwExtensionSupported(e)) panicError() return ret }
go
func ExtensionSupported(extension string) bool { e := C.CString(extension) defer C.free(unsafe.Pointer(e)) ret := glfwbool(C.glfwExtensionSupported(e)) panicError() return ret }
[ "func", "ExtensionSupported", "(", "extension", "string", ")", "bool", "{", "e", ":=", "C", ".", "CString", "(", "extension", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "e", ")", ")", "\n", "ret", ":=", "glfwbool", "(",...
// ExtensionSupported reports whether the specified OpenGL or context creation // API extension is supported by the current context. For example, on Windows // both the OpenGL and WGL extension strings are checked. // // As this functions searches one or more extension strings on each call, it is // recommended that yo...
[ "ExtensionSupported", "reports", "whether", "the", "specified", "OpenGL", "or", "context", "creation", "API", "extension", "is", "supported", "by", "the", "current", "context", ".", "For", "example", "on", "Windows", "both", "the", "OpenGL", "and", "WGL", "exten...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/context.go#L72-L78
28,945
go-gl/glfw
v3.2/glfw/context.go
GetProcAddress
func GetProcAddress(procname string) unsafe.Pointer { p := C.CString(procname) defer C.free(unsafe.Pointer(p)) ret := unsafe.Pointer(C.glfwGetProcAddress(p)) panicError() return ret }
go
func GetProcAddress(procname string) unsafe.Pointer { p := C.CString(procname) defer C.free(unsafe.Pointer(p)) ret := unsafe.Pointer(C.glfwGetProcAddress(p)) panicError() return ret }
[ "func", "GetProcAddress", "(", "procname", "string", ")", "unsafe", ".", "Pointer", "{", "p", ":=", "C", ".", "CString", "(", "procname", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "p", ")", ")", "\n", "ret", ":=", "u...
// GetProcAddress returns the address of the specified OpenGL or OpenGL ES core // or extension function, if it is supported by the current context. // // A context must be current on the calling thread. Calling this function // without a current context will cause a GLFW_NO_CURRENT_CONTEXT error. // // This function i...
[ "GetProcAddress", "returns", "the", "address", "of", "the", "specified", "OpenGL", "or", "OpenGL", "ES", "core", "or", "extension", "function", "if", "it", "is", "supported", "by", "the", "current", "context", ".", "A", "context", "must", "be", "current", "o...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/context.go#L88-L94
28,946
go-gl/glfw
v3.1/glfw/input.go
CreateCursor
func CreateCursor(img image.Image, xhot, yhot int) *Cursor { var img_c C.GLFWimage var pixels []uint8 b := img.Bounds() switch img := img.(type) { case *image.RGBA: pixels = img.Pix default: m := image.NewRGBA(image.Rect(0, 0, b.Dx(), b.Dy())) draw.Draw(m, m.Bounds(), img, b.Min, draw.Src) pixels = m.Pix...
go
func CreateCursor(img image.Image, xhot, yhot int) *Cursor { var img_c C.GLFWimage var pixels []uint8 b := img.Bounds() switch img := img.(type) { case *image.RGBA: pixels = img.Pix default: m := image.NewRGBA(image.Rect(0, 0, b.Dx(), b.Dy())) draw.Draw(m, m.Bounds(), img, b.Min, draw.Src) pixels = m.Pix...
[ "func", "CreateCursor", "(", "img", "image", ".", "Image", ",", "xhot", ",", "yhot", "int", ")", "*", "Cursor", "{", "var", "img_c", "C", ".", "GLFWimage", "\n", "var", "pixels", "[", "]", "uint8", "\n", "b", ":=", "img", ".", "Bounds", "(", ")", ...
// Creates a new custom cursor image that can be set for a window with SetCursor. // The cursor can be destroyed with Destroy. Any remaining cursors are destroyed by Terminate. // // The pixels are 32-bit little-endian RGBA, i.e. eight bits per channel. They are arranged // canonically as packed sequential rows, starti...
[ "Creates", "a", "new", "custom", "cursor", "image", "that", "can", "be", "set", "for", "a", "window", "with", "SetCursor", ".", "The", "cursor", "can", "be", "destroyed", "with", "Destroy", ".", "Any", "remaining", "cursors", "are", "destroyed", "by", "Ter...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.1/glfw/input.go#L383-L409
28,947
go-gl/glfw
v3.1/glfw/input.go
CreateStandardCursor
func CreateStandardCursor(shape int) *Cursor { c := C.glfwCreateStandardCursor(C.int(shape)) panicError() return &Cursor{c} }
go
func CreateStandardCursor(shape int) *Cursor { c := C.glfwCreateStandardCursor(C.int(shape)) panicError() return &Cursor{c} }
[ "func", "CreateStandardCursor", "(", "shape", "int", ")", "*", "Cursor", "{", "c", ":=", "C", ".", "glfwCreateStandardCursor", "(", "C", ".", "int", "(", "shape", ")", ")", "\n", "panicError", "(", ")", "\n", "return", "&", "Cursor", "{", "c", "}", "...
// Returns a cursor with a standard shape, that can be set for a window with SetCursor.
[ "Returns", "a", "cursor", "with", "a", "standard", "shape", "that", "can", "be", "set", "for", "a", "window", "with", "SetCursor", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.1/glfw/input.go#L412-L416
28,948
go-gl/glfw
v3.2/glfw/monitor.go
GetPos
func (m *Monitor) GetPos() (x, y int) { var xpos, ypos C.int C.glfwGetMonitorPos(m.data, &xpos, &ypos) panicError() return int(xpos), int(ypos) }
go
func (m *Monitor) GetPos() (x, y int) { var xpos, ypos C.int C.glfwGetMonitorPos(m.data, &xpos, &ypos) panicError() return int(xpos), int(ypos) }
[ "func", "(", "m", "*", "Monitor", ")", "GetPos", "(", ")", "(", "x", ",", "y", "int", ")", "{", "var", "xpos", ",", "ypos", "C", ".", "int", "\n", "C", ".", "glfwGetMonitorPos", "(", "m", ".", "data", ",", "&", "xpos", ",", "&", "ypos", ")", ...
// GetPos returns the position, in screen coordinates, of the upper-left // corner of the monitor.
[ "GetPos", "returns", "the", "position", "in", "screen", "coordinates", "of", "the", "upper", "-", "left", "corner", "of", "the", "monitor", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/monitor.go#L86-L91
28,949
go-gl/glfw
v3.2/glfw/monitor.go
SetMonitorCallback
func SetMonitorCallback(cbfun func(monitor *Monitor, event MonitorEvent)) { if cbfun == nil { C.glfwSetMonitorCallback(nil) } else { fMonitorHolder = cbfun C.glfwSetMonitorCallbackCB() } panicError() }
go
func SetMonitorCallback(cbfun func(monitor *Monitor, event MonitorEvent)) { if cbfun == nil { C.glfwSetMonitorCallback(nil) } else { fMonitorHolder = cbfun C.glfwSetMonitorCallbackCB() } panicError() }
[ "func", "SetMonitorCallback", "(", "cbfun", "func", "(", "monitor", "*", "Monitor", ",", "event", "MonitorEvent", ")", ")", "{", "if", "cbfun", "==", "nil", "{", "C", ".", "glfwSetMonitorCallback", "(", "nil", ")", "\n", "}", "else", "{", "fMonitorHolder",...
// SetMonitorCallback sets the monitor configuration callback, or removes the // currently set callback. This is called when a monitor is connected to or // disconnected from the system.
[ "SetMonitorCallback", "sets", "the", "monitor", "configuration", "callback", "or", "removes", "the", "currently", "set", "callback", ".", "This", "is", "called", "when", "a", "monitor", "is", "connected", "to", "or", "disconnected", "from", "the", "system", "." ...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/monitor.go#L119-L127
28,950
karrick/godirwalk
dirent.go
NewDirent
func NewDirent(osPathname string) (*Dirent, error) { fi, err := os.Lstat(osPathname) if err != nil { return nil, err } return &Dirent{ name: filepath.Base(osPathname), modeType: fi.Mode() & os.ModeType, }, nil }
go
func NewDirent(osPathname string) (*Dirent, error) { fi, err := os.Lstat(osPathname) if err != nil { return nil, err } return &Dirent{ name: filepath.Base(osPathname), modeType: fi.Mode() & os.ModeType, }, nil }
[ "func", "NewDirent", "(", "osPathname", "string", ")", "(", "*", "Dirent", ",", "error", ")", "{", "fi", ",", "err", ":=", "os", ".", "Lstat", "(", "osPathname", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\...
// NewDirent returns a newly initialized Dirent structure, or an error. This // function does not follow symbolic links. // // This function is rarely used, as Dirent structures are provided by other // functions in this library that read and walk directories.
[ "NewDirent", "returns", "a", "newly", "initialized", "Dirent", "structure", "or", "an", "error", ".", "This", "function", "does", "not", "follow", "symbolic", "links", ".", "This", "function", "is", "rarely", "used", "as", "Dirent", "structures", "are", "provi...
808a2f88690f523a3fb074bc6626124660bc80eb
https://github.com/karrick/godirwalk/blob/808a2f88690f523a3fb074bc6626124660bc80eb/dirent.go#L20-L29
28,951
karrick/godirwalk
readdir_windows.go
readdirents
func readdirents(osDirname string, _ []byte) (Dirents, error) { dh, err := os.Open(osDirname) if err != nil { return nil, err } fileinfos, err := dh.Readdir(0) if er := dh.Close(); err == nil { err = er } if err != nil { return nil, err } entries := make(Dirents, len(fileinfos)) for i, info := range f...
go
func readdirents(osDirname string, _ []byte) (Dirents, error) { dh, err := os.Open(osDirname) if err != nil { return nil, err } fileinfos, err := dh.Readdir(0) if er := dh.Close(); err == nil { err = er } if err != nil { return nil, err } entries := make(Dirents, len(fileinfos)) for i, info := range f...
[ "func", "readdirents", "(", "osDirname", "string", ",", "_", "[", "]", "byte", ")", "(", "Dirents", ",", "error", ")", "{", "dh", ",", "err", ":=", "os", ".", "Open", "(", "osDirname", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",...
// The functions in this file are mere wrappers of what is already provided by // standard library, in order to provide the same API as this library provides. // // The scratch buffer argument is ignored by this architecture. // // Please send PR or link to article if you know of a more performant way of // enumerating...
[ "The", "functions", "in", "this", "file", "are", "mere", "wrappers", "of", "what", "is", "already", "provided", "by", "standard", "library", "in", "order", "to", "provide", "the", "same", "API", "as", "this", "library", "provides", ".", "The", "scratch", "...
808a2f88690f523a3fb074bc6626124660bc80eb
https://github.com/karrick/godirwalk/blob/808a2f88690f523a3fb074bc6626124660bc80eb/readdir_windows.go#L15-L35
28,952
karrick/godirwalk
walk.go
walk
func walk(osPathname string, dirent *Dirent, options *Options) error { err := options.Callback(osPathname, dirent) if err != nil { if err == filepath.SkipDir { return err } err = errCallback(err.Error()) // wrap potential errors returned by callback if action := options.ErrorCallback(osPathname, err); acti...
go
func walk(osPathname string, dirent *Dirent, options *Options) error { err := options.Callback(osPathname, dirent) if err != nil { if err == filepath.SkipDir { return err } err = errCallback(err.Error()) // wrap potential errors returned by callback if action := options.ErrorCallback(osPathname, err); acti...
[ "func", "walk", "(", "osPathname", "string", ",", "dirent", "*", "Dirent", ",", "options", "*", "Options", ")", "error", "{", "err", ":=", "options", ".", "Callback", "(", "osPathname", ",", "dirent", ")", "\n", "if", "err", "!=", "nil", "{", "if", "...
// walk recursively traverses the file system node specified by pathname and the // Dirent.
[ "walk", "recursively", "traverses", "the", "file", "system", "node", "specified", "by", "pathname", "and", "the", "Dirent", "." ]
808a2f88690f523a3fb074bc6626124660bc80eb
https://github.com/karrick/godirwalk/blob/808a2f88690f523a3fb074bc6626124660bc80eb/walk.go#L229-L313
28,953
paulmach/orb
clip/helpers.go
Geometry
func Geometry(b orb.Bound, g orb.Geometry) orb.Geometry { if g == nil { return nil } if !b.Intersects(g.Bound()) { return nil } switch g := g.(type) { case orb.Point: return g // Intersect check above case orb.MultiPoint: mp := MultiPoint(b, g) if len(mp) == 1 { return mp[0] } if mp == nil { ...
go
func Geometry(b orb.Bound, g orb.Geometry) orb.Geometry { if g == nil { return nil } if !b.Intersects(g.Bound()) { return nil } switch g := g.(type) { case orb.Point: return g // Intersect check above case orb.MultiPoint: mp := MultiPoint(b, g) if len(mp) == 1 { return mp[0] } if mp == nil { ...
[ "func", "Geometry", "(", "b", "orb", ".", "Bound", ",", "g", "orb", ".", "Geometry", ")", "orb", ".", "Geometry", "{", "if", "g", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "if", "!", "b", ".", "Intersects", "(", "g", ".", "Bound", "...
// Geometry will clip the geometry to the bounding box using the // correct functions for the type. // This operation will modify the input of '1d or 2d geometry' by using as a // scratch space so clone if necessary.
[ "Geometry", "will", "clip", "the", "geometry", "to", "the", "bounding", "box", "using", "the", "correct", "functions", "for", "the", "type", ".", "This", "operation", "will", "modify", "the", "input", "of", "1d", "or", "2d", "geometry", "by", "using", "as"...
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clip/helpers.go#L15-L105
28,954
paulmach/orb
clip/helpers.go
MultiPoint
func MultiPoint(b orb.Bound, mp orb.MultiPoint) orb.MultiPoint { var result orb.MultiPoint for _, p := range mp { if b.Contains(p) { result = append(result, p) } } return result }
go
func MultiPoint(b orb.Bound, mp orb.MultiPoint) orb.MultiPoint { var result orb.MultiPoint for _, p := range mp { if b.Contains(p) { result = append(result, p) } } return result }
[ "func", "MultiPoint", "(", "b", "orb", ".", "Bound", ",", "mp", "orb", ".", "MultiPoint", ")", "orb", ".", "MultiPoint", "{", "var", "result", "orb", ".", "MultiPoint", "\n", "for", "_", ",", "p", ":=", "range", "mp", "{", "if", "b", ".", "Contains...
// MultiPoint returns a new set with the points outside the bound removed.
[ "MultiPoint", "returns", "a", "new", "set", "with", "the", "points", "outside", "the", "bound", "removed", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clip/helpers.go#L108-L117
28,955
paulmach/orb
clip/helpers.go
LineString
func LineString(b orb.Bound, ls orb.LineString, opts ...Option) orb.MultiLineString { open := false if len(opts) > 0 { o := &options{} for _, opt := range opts { opt(o) } open = o.openBound } result := line(b, ls, open) if len(result) == 0 { return nil } return result }
go
func LineString(b orb.Bound, ls orb.LineString, opts ...Option) orb.MultiLineString { open := false if len(opts) > 0 { o := &options{} for _, opt := range opts { opt(o) } open = o.openBound } result := line(b, ls, open) if len(result) == 0 { return nil } return result }
[ "func", "LineString", "(", "b", "orb", ".", "Bound", ",", "ls", "orb", ".", "LineString", ",", "opts", "...", "Option", ")", "orb", ".", "MultiLineString", "{", "open", ":=", "false", "\n", "if", "len", "(", "opts", ")", ">", "0", "{", "o", ":=", ...
// LineString clips the linestring to the bounding box.
[ "LineString", "clips", "the", "linestring", "to", "the", "bounding", "box", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clip/helpers.go#L120-L137
28,956
paulmach/orb
clip/helpers.go
MultiLineString
func MultiLineString(b orb.Bound, mls orb.MultiLineString, opts ...Option) orb.MultiLineString { open := false if len(opts) > 0 { o := &options{} for _, opt := range opts { opt(o) } open = o.openBound } var result orb.MultiLineString for _, ls := range mls { r := line(b, ls, open) if len(r) != 0 {...
go
func MultiLineString(b orb.Bound, mls orb.MultiLineString, opts ...Option) orb.MultiLineString { open := false if len(opts) > 0 { o := &options{} for _, opt := range opts { opt(o) } open = o.openBound } var result orb.MultiLineString for _, ls := range mls { r := line(b, ls, open) if len(r) != 0 {...
[ "func", "MultiLineString", "(", "b", "orb", ".", "Bound", ",", "mls", "orb", ".", "MultiLineString", ",", "opts", "...", "Option", ")", "orb", ".", "MultiLineString", "{", "open", ":=", "false", "\n", "if", "len", "(", "opts", ")", ">", "0", "{", "o"...
// MultiLineString clips the linestrings to the bounding box // and returns a linestring union.
[ "MultiLineString", "clips", "the", "linestrings", "to", "the", "bounding", "box", "and", "returns", "a", "linestring", "union", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clip/helpers.go#L141-L160
28,957
paulmach/orb
clip/helpers.go
Ring
func Ring(b orb.Bound, r orb.Ring) orb.Ring { result := ring(b, r) if len(result) == 0 { return nil } return result }
go
func Ring(b orb.Bound, r orb.Ring) orb.Ring { result := ring(b, r) if len(result) == 0 { return nil } return result }
[ "func", "Ring", "(", "b", "orb", ".", "Bound", ",", "r", "orb", ".", "Ring", ")", "orb", ".", "Ring", "{", "result", ":=", "ring", "(", "b", ",", "r", ")", "\n", "if", "len", "(", "result", ")", "==", "0", "{", "return", "nil", "\n", "}", "...
// Ring clips the ring to the bounding box and returns another ring. // This operation will modify the input by using as a scratch space // so clone if necessary.
[ "Ring", "clips", "the", "ring", "to", "the", "bounding", "box", "and", "returns", "another", "ring", ".", "This", "operation", "will", "modify", "the", "input", "by", "using", "as", "a", "scratch", "space", "so", "clone", "if", "necessary", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clip/helpers.go#L165-L172
28,958
paulmach/orb
clip/helpers.go
Polygon
func Polygon(b orb.Bound, p orb.Polygon) orb.Polygon { if len(p) == 0 { return nil } r := Ring(b, p[0]) if r == nil { return nil } result := orb.Polygon{r} for i := 1; i < len(p); i++ { r := Ring(b, p[i]) if r != nil { result = append(result, r) } } return result }
go
func Polygon(b orb.Bound, p orb.Polygon) orb.Polygon { if len(p) == 0 { return nil } r := Ring(b, p[0]) if r == nil { return nil } result := orb.Polygon{r} for i := 1; i < len(p); i++ { r := Ring(b, p[i]) if r != nil { result = append(result, r) } } return result }
[ "func", "Polygon", "(", "b", "orb", ".", "Bound", ",", "p", "orb", ".", "Polygon", ")", "orb", ".", "Polygon", "{", "if", "len", "(", "p", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "r", ":=", "Ring", "(", "b", ",", "p", "[", ...
// Polygon clips the polygon to the bounding box excluding the inner rings // if they do not intersect the bounding box. // This operation will modify the input by using as a scratch space // so clone if necessary.
[ "Polygon", "clips", "the", "polygon", "to", "the", "bounding", "box", "excluding", "the", "inner", "rings", "if", "they", "do", "not", "intersect", "the", "bounding", "box", ".", "This", "operation", "will", "modify", "the", "input", "by", "using", "as", "...
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clip/helpers.go#L178-L197
28,959
paulmach/orb
clip/helpers.go
MultiPolygon
func MultiPolygon(b orb.Bound, mp orb.MultiPolygon) orb.MultiPolygon { var result orb.MultiPolygon for _, polygon := range mp { p := Polygon(b, polygon) if p != nil { result = append(result, p) } } return result }
go
func MultiPolygon(b orb.Bound, mp orb.MultiPolygon) orb.MultiPolygon { var result orb.MultiPolygon for _, polygon := range mp { p := Polygon(b, polygon) if p != nil { result = append(result, p) } } return result }
[ "func", "MultiPolygon", "(", "b", "orb", ".", "Bound", ",", "mp", "orb", ".", "MultiPolygon", ")", "orb", ".", "MultiPolygon", "{", "var", "result", "orb", ".", "MultiPolygon", "\n", "for", "_", ",", "polygon", ":=", "range", "mp", "{", "p", ":=", "P...
// MultiPolygon clips the multi polygon to the bounding box excluding // any polygons if they don't intersect the bounding box. // This operation will modify the input by using as a scratch space // so clone if necessary.
[ "MultiPolygon", "clips", "the", "multi", "polygon", "to", "the", "bounding", "box", "excluding", "any", "polygons", "if", "they", "don", "t", "intersect", "the", "bounding", "box", ".", "This", "operation", "will", "modify", "the", "input", "by", "using", "a...
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clip/helpers.go#L203-L213
28,960
paulmach/orb
clip/helpers.go
Collection
func Collection(b orb.Bound, c orb.Collection) orb.Collection { var result orb.Collection for _, g := range c { clipped := Geometry(b, g) if clipped != nil { result = append(result, clipped) } } return result }
go
func Collection(b orb.Bound, c orb.Collection) orb.Collection { var result orb.Collection for _, g := range c { clipped := Geometry(b, g) if clipped != nil { result = append(result, clipped) } } return result }
[ "func", "Collection", "(", "b", "orb", ".", "Bound", ",", "c", "orb", ".", "Collection", ")", "orb", ".", "Collection", "{", "var", "result", "orb", ".", "Collection", "\n", "for", "_", ",", "g", ":=", "range", "c", "{", "clipped", ":=", "Geometry", ...
// Collection clips each element in the collection to the bounding box. // It will exclude elements if they don't intersect the bounding box. // This operation will modify the input of '2d geometry' by using as a // scratch space so clone if necessary.
[ "Collection", "clips", "each", "element", "in", "the", "collection", "to", "the", "bounding", "box", ".", "It", "will", "exclude", "elements", "if", "they", "don", "t", "intersect", "the", "bounding", "box", ".", "This", "operation", "will", "modify", "the",...
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clip/helpers.go#L219-L229
28,961
paulmach/orb
maptile/tilecover/polygon.go
Ring
func Ring(r orb.Ring, z maptile.Zoom) maptile.Set { if len(r) == 0 { return make(maptile.Set) } return Polygon(orb.Polygon{r}, z) }
go
func Ring(r orb.Ring, z maptile.Zoom) maptile.Set { if len(r) == 0 { return make(maptile.Set) } return Polygon(orb.Polygon{r}, z) }
[ "func", "Ring", "(", "r", "orb", ".", "Ring", ",", "z", "maptile", ".", "Zoom", ")", "maptile", ".", "Set", "{", "if", "len", "(", "r", ")", "==", "0", "{", "return", "make", "(", "maptile", ".", "Set", ")", "\n", "}", "\n\n", "return", "Polygo...
// Ring creates a tile cover for the ring.
[ "Ring", "creates", "a", "tile", "cover", "for", "the", "ring", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tilecover/polygon.go#L11-L17
28,962
paulmach/orb
maptile/tilecover/polygon.go
Polygon
func Polygon(p orb.Polygon, z maptile.Zoom) maptile.Set { set := make(maptile.Set) polygon(set, p, z) return set }
go
func Polygon(p orb.Polygon, z maptile.Zoom) maptile.Set { set := make(maptile.Set) polygon(set, p, z) return set }
[ "func", "Polygon", "(", "p", "orb", ".", "Polygon", ",", "z", "maptile", ".", "Zoom", ")", "maptile", ".", "Set", "{", "set", ":=", "make", "(", "maptile", ".", "Set", ")", "\n", "polygon", "(", "set", ",", "p", ",", "z", ")", "\n\n", "return", ...
// Polygon creates a tile cover for the polygon.
[ "Polygon", "creates", "a", "tile", "cover", "for", "the", "polygon", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tilecover/polygon.go#L20-L25
28,963
paulmach/orb
maptile/tilecover/polygon.go
MultiPolygon
func MultiPolygon(mp orb.MultiPolygon, z maptile.Zoom) maptile.Set { set := make(maptile.Set) for _, p := range mp { polygon(set, p, z) } return set }
go
func MultiPolygon(mp orb.MultiPolygon, z maptile.Zoom) maptile.Set { set := make(maptile.Set) for _, p := range mp { polygon(set, p, z) } return set }
[ "func", "MultiPolygon", "(", "mp", "orb", ".", "MultiPolygon", ",", "z", "maptile", ".", "Zoom", ")", "maptile", ".", "Set", "{", "set", ":=", "make", "(", "maptile", ".", "Set", ")", "\n", "for", "_", ",", "p", ":=", "range", "mp", "{", "polygon",...
// MultiPolygon creates a tile cover for the multi-polygon.
[ "MultiPolygon", "creates", "a", "tile", "cover", "for", "the", "multi", "-", "polygon", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tilecover/polygon.go#L28-L35
28,964
paulmach/orb
geometry.go
Bound
func (c Collection) Bound() Bound { if len(c) == 0 { return emptyBound } var b Bound start := -1 for i, g := range c { if g != nil { start = i b = g.Bound() break } } if start == -1 { return emptyBound } for i := start + 1; i < len(c); i++ { if c[i] == nil { continue } b = b.Unio...
go
func (c Collection) Bound() Bound { if len(c) == 0 { return emptyBound } var b Bound start := -1 for i, g := range c { if g != nil { start = i b = g.Bound() break } } if start == -1 { return emptyBound } for i := start + 1; i < len(c); i++ { if c[i] == nil { continue } b = b.Unio...
[ "func", "(", "c", "Collection", ")", "Bound", "(", ")", "Bound", "{", "if", "len", "(", "c", ")", "==", "0", "{", "return", "emptyBound", "\n", "}", "\n\n", "var", "b", "Bound", "\n", "start", ":=", "-", "1", "\n\n", "for", "i", ",", "g", ":=",...
// Bound returns the bounding box of all the Geometries combined.
[ "Bound", "returns", "the", "bounding", "box", "of", "all", "the", "Geometries", "combined", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geometry.go#L87-L116
28,965
paulmach/orb
geometry.go
Equal
func (c Collection) Equal(collection Collection) bool { if len(c) != len(collection) { return false } for i, g := range c { if !Equal(g, collection[i]) { return false } } return true }
go
func (c Collection) Equal(collection Collection) bool { if len(c) != len(collection) { return false } for i, g := range c { if !Equal(g, collection[i]) { return false } } return true }
[ "func", "(", "c", "Collection", ")", "Equal", "(", "collection", "Collection", ")", "bool", "{", "if", "len", "(", "c", ")", "!=", "len", "(", "collection", ")", "{", "return", "false", "\n", "}", "\n\n", "for", "i", ",", "g", ":=", "range", "c", ...
// Equal compares two collections. Returns true if lengths are the same // and all the sub geometries are the same and in the same order.
[ "Equal", "compares", "two", "collections", ".", "Returns", "true", "if", "lengths", "are", "the", "same", "and", "all", "the", "sub", "geometries", "are", "the", "same", "and", "in", "the", "same", "order", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geometry.go#L120-L132
28,966
paulmach/orb
geometry.go
Clone
func (c Collection) Clone() Collection { if c == nil { return nil } nc := make(Collection, len(c)) for i, g := range c { nc[i] = Clone(g) } return nc }
go
func (c Collection) Clone() Collection { if c == nil { return nil } nc := make(Collection, len(c)) for i, g := range c { nc[i] = Clone(g) } return nc }
[ "func", "(", "c", "Collection", ")", "Clone", "(", ")", "Collection", "{", "if", "c", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "nc", ":=", "make", "(", "Collection", ",", "len", "(", "c", ")", ")", "\n", "for", "i", ",", "g", ":=",...
// Clone returns a deep copy of the collection.
[ "Clone", "returns", "a", "deep", "copy", "of", "the", "collection", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geometry.go#L135-L146
28,967
paulmach/orb
simplify/radial.go
Radial
func Radial(df orb.DistanceFunc, threshold float64) *RadialSimplifier { return &RadialSimplifier{ DistanceFunc: df, Threshold: threshold, } }
go
func Radial(df orb.DistanceFunc, threshold float64) *RadialSimplifier { return &RadialSimplifier{ DistanceFunc: df, Threshold: threshold, } }
[ "func", "Radial", "(", "df", "orb", ".", "DistanceFunc", ",", "threshold", "float64", ")", "*", "RadialSimplifier", "{", "return", "&", "RadialSimplifier", "{", "DistanceFunc", ":", "df", ",", "Threshold", ":", "threshold", ",", "}", "\n", "}" ]
// Radial creates a new RadialSimplifier.
[ "Radial", "creates", "a", "new", "RadialSimplifier", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/simplify/radial.go#L16-L21
28,968
paulmach/orb
clip/smartclip/smart.go
Geometry
func Geometry(box orb.Bound, g orb.Geometry, o orb.Orientation) orb.Geometry { if g == nil { return nil } if g.Dimensions() != 2 { return clip.Geometry(box, g) } var mp orb.MultiPolygon switch g := g.(type) { case orb.Ring: mp = Ring(box, g, o) case orb.Polygon: mp = Polygon(box, g, o) case orb.Multi...
go
func Geometry(box orb.Bound, g orb.Geometry, o orb.Orientation) orb.Geometry { if g == nil { return nil } if g.Dimensions() != 2 { return clip.Geometry(box, g) } var mp orb.MultiPolygon switch g := g.(type) { case orb.Ring: mp = Ring(box, g, o) case orb.Polygon: mp = Polygon(box, g, o) case orb.Multi...
[ "func", "Geometry", "(", "box", "orb", ".", "Bound", ",", "g", "orb", ".", "Geometry", ",", "o", "orb", ".", "Orientation", ")", "orb", ".", "Geometry", "{", "if", "g", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "if", "g", ".", "Dimens...
// Geometry will do a smart more involved clipping and wrapping of the geometry. // It will return simple OGC geometries. Rings that are NOT closed AND have an // endpoint in the bound will be implicitly closed.
[ "Geometry", "will", "do", "a", "smart", "more", "involved", "clipping", "and", "wrapping", "of", "the", "geometry", ".", "It", "will", "return", "simple", "OGC", "geometries", ".", "Rings", "that", "are", "NOT", "closed", "AND", "have", "an", "endpoint", "...
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clip/smartclip/smart.go#L16-L62
28,969
paulmach/orb
clip/smartclip/smart.go
Ring
func Ring(box orb.Bound, r orb.Ring, o orb.Orientation) orb.MultiPolygon { if len(r) == 0 { return nil } open, closed := clipRings(box, []orb.Ring{r}) if len(open) == 0 { // nothing was clipped if len(closed) == 0 { return nil // everything outside bound } return orb.MultiPolygon{{r}} // everything i...
go
func Ring(box orb.Bound, r orb.Ring, o orb.Orientation) orb.MultiPolygon { if len(r) == 0 { return nil } open, closed := clipRings(box, []orb.Ring{r}) if len(open) == 0 { // nothing was clipped if len(closed) == 0 { return nil // everything outside bound } return orb.MultiPolygon{{r}} // everything i...
[ "func", "Ring", "(", "box", "orb", ".", "Bound", ",", "r", "orb", ".", "Ring", ",", "o", "orb", ".", "Orientation", ")", "orb", ".", "MultiPolygon", "{", "if", "len", "(", "r", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "open", ",...
// Ring will smart clip a ring to the boundary. This may result multiple rings so // a multipolygon is possible. Rings that are NOT closed AND have an endpoint in // the bound will be implicitly closed.
[ "Ring", "will", "smart", "clip", "a", "ring", "to", "the", "boundary", ".", "This", "may", "result", "multiple", "rings", "so", "a", "multipolygon", "is", "possible", ".", "Rings", "that", "are", "NOT", "closed", "AND", "have", "an", "endpoint", "in", "t...
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clip/smartclip/smart.go#L67-L84
28,970
paulmach/orb
clip/smartclip/smart.go
Polygon
func Polygon(box orb.Bound, p orb.Polygon, o orb.Orientation) orb.MultiPolygon { if len(p) == 0 { return nil } open, closed := clipRings(box, p) if len(open) == 0 { // nothing was clipped if len(closed) == 0 { return nil // everything outside bound } return orb.MultiPolygon{p} // everything inside bo...
go
func Polygon(box orb.Bound, p orb.Polygon, o orb.Orientation) orb.MultiPolygon { if len(p) == 0 { return nil } open, closed := clipRings(box, p) if len(open) == 0 { // nothing was clipped if len(closed) == 0 { return nil // everything outside bound } return orb.MultiPolygon{p} // everything inside bo...
[ "func", "Polygon", "(", "box", "orb", ".", "Bound", ",", "p", "orb", ".", "Polygon", ",", "o", "orb", ".", "Orientation", ")", "orb", ".", "MultiPolygon", "{", "if", "len", "(", "p", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "open"...
// Polygon will smart clip a polygon to the bound. // Rings that are NOT closed AND have an endpoint in the bound will be // implicitly closed.
[ "Polygon", "will", "smart", "clip", "a", "polygon", "to", "the", "bound", ".", "Rings", "that", "are", "NOT", "closed", "AND", "have", "an", "endpoint", "in", "the", "bound", "will", "be", "implicitly", "closed", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clip/smartclip/smart.go#L89-L114
28,971
paulmach/orb
clip/smartclip/smart.go
MultiPolygon
func MultiPolygon(box orb.Bound, mp orb.MultiPolygon, o orb.Orientation) orb.MultiPolygon { if len(mp) == 0 { return nil } // outer rings outerRings := make([]orb.Ring, 0, len(mp)) for _, p := range mp { outerRings = append(outerRings, p[0]) } outers, closedOuters := clipRings(box, outerRings) if len(oute...
go
func MultiPolygon(box orb.Bound, mp orb.MultiPolygon, o orb.Orientation) orb.MultiPolygon { if len(mp) == 0 { return nil } // outer rings outerRings := make([]orb.Ring, 0, len(mp)) for _, p := range mp { outerRings = append(outerRings, p[0]) } outers, closedOuters := clipRings(box, outerRings) if len(oute...
[ "func", "MultiPolygon", "(", "box", "orb", ".", "Bound", ",", "mp", "orb", ".", "MultiPolygon", ",", "o", "orb", ".", "Orientation", ")", "orb", ".", "MultiPolygon", "{", "if", "len", "(", "mp", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\...
// MultiPolygon will smart clip a multipolygon to the bound. // Rings that are NOT closed AND have an endpoint in the bound will be // implicitly closed.
[ "MultiPolygon", "will", "smart", "clip", "a", "multipolygon", "to", "the", "bound", ".", "Rings", "that", "are", "NOT", "closed", "AND", "have", "an", "endpoint", "in", "the", "bound", "will", "be", "implicitly", "closed", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clip/smartclip/smart.go#L119-L161
28,972
paulmach/orb
clip/smartclip/smart.go
clipRings
func clipRings(box orb.Bound, rings []orb.Ring) (open []orb.LineString, closed []orb.Ring) { var result []orb.LineString for _, r := range rings { if !r.Closed() && (box.Contains(r[0]) || box.Contains(r[len(r)-1])) { r = append(r, r[0]) } out := clip.LineString(box, orb.LineString(r), clip.OpenBound(true)) ...
go
func clipRings(box orb.Bound, rings []orb.Ring) (open []orb.LineString, closed []orb.Ring) { var result []orb.LineString for _, r := range rings { if !r.Closed() && (box.Contains(r[0]) || box.Contains(r[len(r)-1])) { r = append(r, r[0]) } out := clip.LineString(box, orb.LineString(r), clip.OpenBound(true)) ...
[ "func", "clipRings", "(", "box", "orb", ".", "Bound", ",", "rings", "[", "]", "orb", ".", "Ring", ")", "(", "open", "[", "]", "orb", ".", "LineString", ",", "closed", "[", "]", "orb", ".", "Ring", ")", "{", "var", "result", "[", "]", "orb", "."...
// clipRings will take a set of rings and clip them to the boundary. // It returns the open lineStrings with endpoints on the boundary and // the closed interior rings.
[ "clipRings", "will", "take", "a", "set", "of", "rings", "and", "clip", "them", "to", "the", "boundary", ".", "It", "returns", "the", "open", "lineStrings", "with", "endpoints", "on", "the", "boundary", "and", "the", "closed", "interior", "rings", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clip/smartclip/smart.go#L166-L223
28,973
paulmach/orb
clip/smartclip/smart.go
smartWrap
func smartWrap(box orb.Bound, input []orb.LineString, o orb.Orientation) orb.MultiPolygon { points := make([]*endpoint, 0, 2*len(input)+2) for i, r := range input { // start points = append(points, &endpoint{ Point: r[0], Start: true, Side: pointSide(box, r[0]), Index: i, OtherEnd: 2*...
go
func smartWrap(box orb.Bound, input []orb.LineString, o orb.Orientation) orb.MultiPolygon { points := make([]*endpoint, 0, 2*len(input)+2) for i, r := range input { // start points = append(points, &endpoint{ Point: r[0], Start: true, Side: pointSide(box, r[0]), Index: i, OtherEnd: 2*...
[ "func", "smartWrap", "(", "box", "orb", ".", "Bound", ",", "input", "[", "]", "orb", ".", "LineString", ",", "o", "orb", ".", "Orientation", ")", "orb", ".", "MultiPolygon", "{", "points", ":=", "make", "(", "[", "]", "*", "endpoint", ",", "0", ","...
// smartWrap takes the open lineStrings with endpoints on the boundary and // connects them correctly.
[ "smartWrap", "takes", "the", "open", "lineStrings", "with", "endpoints", "on", "the", "boundary", "and", "connects", "them", "correctly", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clip/smartclip/smart.go#L248-L337
28,974
paulmach/orb
clip/smartclip/smart.go
pointSide
func pointSide(b orb.Bound, p orb.Point) uint8 { if p[1] == b.Max[1] { return 4 } else if p[1] == b.Min[1] { return 2 } else if p[0] == b.Max[0] { return 3 } else if p[0] == b.Min[0] { return 1 } return notOnSide }
go
func pointSide(b orb.Bound, p orb.Point) uint8 { if p[1] == b.Max[1] { return 4 } else if p[1] == b.Min[1] { return 2 } else if p[0] == b.Max[0] { return 3 } else if p[0] == b.Min[0] { return 1 } return notOnSide }
[ "func", "pointSide", "(", "b", "orb", ".", "Bound", ",", "p", "orb", ".", "Point", ")", "uint8", "{", "if", "p", "[", "1", "]", "==", "b", ".", "Max", "[", "1", "]", "{", "return", "4", "\n", "}", "else", "if", "p", "[", "1", "]", "==", "...
// 4 // +-+ // 1 | | 3 // +-+ // 2
[ "4", "+", "-", "+", "1", "|", "|", "3", "+", "-", "+", "2" ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clip/smartclip/smart.go#L346-L358
28,975
paulmach/orb
clip/smartclip/smart.go
Less
func (e *sortableEndpoints) Less(i, j int) bool { if e.eps[i].Side != e.eps[j].Side { return e.eps[i].Side < e.eps[j].Side } switch e.eps[i].Side { case 1: if e.eps[i].Point[1] != e.eps[j].Point[1] { return e.eps[i].Point[1] >= e.eps[j].Point[1] } return e.eps[i].Before(e.mls)[1] >= e.eps[j].Before(e.m...
go
func (e *sortableEndpoints) Less(i, j int) bool { if e.eps[i].Side != e.eps[j].Side { return e.eps[i].Side < e.eps[j].Side } switch e.eps[i].Side { case 1: if e.eps[i].Point[1] != e.eps[j].Point[1] { return e.eps[i].Point[1] >= e.eps[j].Point[1] } return e.eps[i].Before(e.mls)[1] >= e.eps[j].Before(e.m...
[ "func", "(", "e", "*", "sortableEndpoints", ")", "Less", "(", "i", ",", "j", "int", ")", "bool", "{", "if", "e", ".", "eps", "[", "i", "]", ".", "Side", "!=", "e", ".", "eps", "[", "j", "]", ".", "Side", "{", "return", "e", ".", "eps", "[",...
// Less sorts the points around the bound. // First comparing what side it's on and then the actual point to determine the order. // If two points are the same, we sort by the edge attached to the point so lines that are // "above" are shorted first.
[ "Less", "sorts", "the", "points", "around", "the", "bound", ".", "First", "comparing", "what", "side", "it", "s", "on", "and", "then", "the", "actual", "point", "to", "determine", "the", "order", ".", "If", "two", "points", "are", "the", "same", "we", ...
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clip/smartclip/smart.go#L373-L405
28,976
paulmach/orb
clip/smartclip/smart.go
addToMultiPolygon
func addToMultiPolygon(mp orb.MultiPolygon, ring orb.Ring) orb.MultiPolygon { for i := range mp { if polygonContains(mp[i][0], ring) { mp[i] = append(mp[i], ring) return mp } } // ring is not in any polygons? // skip it, TODO: is this correct? // If input is well formed, I think it is. If it isn't, ¯\_(...
go
func addToMultiPolygon(mp orb.MultiPolygon, ring orb.Ring) orb.MultiPolygon { for i := range mp { if polygonContains(mp[i][0], ring) { mp[i] = append(mp[i], ring) return mp } } // ring is not in any polygons? // skip it, TODO: is this correct? // If input is well formed, I think it is. If it isn't, ¯\_(...
[ "func", "addToMultiPolygon", "(", "mp", "orb", ".", "MultiPolygon", ",", "ring", "orb", ".", "Ring", ")", "orb", ".", "MultiPolygon", "{", "for", "i", ":=", "range", "mp", "{", "if", "polygonContains", "(", "mp", "[", "i", "]", "[", "0", "]", ",", ...
// addToMultiPolygon does a lookup to see which polygon the ring intersects. // This should work fine if the input is well formed.
[ "addToMultiPolygon", "does", "a", "lookup", "to", "see", "which", "polygon", "the", "ring", "intersects", ".", "This", "should", "work", "fine", "if", "the", "input", "is", "well", "formed", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clip/smartclip/smart.go#L414-L427
28,977
paulmach/orb
bound.go
ToRing
func (b Bound) ToRing() Ring { return Ring{ b.Min, Point{b.Max[0], b.Min[1]}, b.Max, Point{b.Min[0], b.Max[1]}, b.Min, } }
go
func (b Bound) ToRing() Ring { return Ring{ b.Min, Point{b.Max[0], b.Min[1]}, b.Max, Point{b.Min[0], b.Max[1]}, b.Min, } }
[ "func", "(", "b", "Bound", ")", "ToRing", "(", ")", "Ring", "{", "return", "Ring", "{", "b", ".", "Min", ",", "Point", "{", "b", ".", "Max", "[", "0", "]", ",", "b", ".", "Min", "[", "1", "]", "}", ",", "b", ".", "Max", ",", "Point", "{",...
// ToRing converts the bound into a loop defined // by the boundary of the box.
[ "ToRing", "converts", "the", "bound", "into", "a", "loop", "defined", "by", "the", "boundary", "of", "the", "box", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/bound.go#L33-L41
28,978
paulmach/orb
bound.go
Union
func (b Bound) Union(other Bound) Bound { if other.IsEmpty() { return b } b = b.Extend(other.Min) b = b.Extend(other.Max) b = b.Extend(other.LeftTop()) b = b.Extend(other.RightBottom()) return b }
go
func (b Bound) Union(other Bound) Bound { if other.IsEmpty() { return b } b = b.Extend(other.Min) b = b.Extend(other.Max) b = b.Extend(other.LeftTop()) b = b.Extend(other.RightBottom()) return b }
[ "func", "(", "b", "Bound", ")", "Union", "(", "other", "Bound", ")", "Bound", "{", "if", "other", ".", "IsEmpty", "(", ")", "{", "return", "b", "\n", "}", "\n\n", "b", "=", "b", ".", "Extend", "(", "other", ".", "Min", ")", "\n", "b", "=", "b...
// Union extends this bound to contain the union of this and the given bound.
[ "Union", "extends", "this", "bound", "to", "contain", "the", "union", "of", "this", "and", "the", "given", "bound", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/bound.go#L63-L74
28,979
paulmach/orb
bound.go
Pad
func (b Bound) Pad(d float64) Bound { b.Min[0] -= d b.Min[1] -= d b.Max[0] += d b.Max[1] += d return b }
go
func (b Bound) Pad(d float64) Bound { b.Min[0] -= d b.Min[1] -= d b.Max[0] += d b.Max[1] += d return b }
[ "func", "(", "b", "Bound", ")", "Pad", "(", "d", "float64", ")", "Bound", "{", "b", ".", "Min", "[", "0", "]", "-=", "d", "\n", "b", ".", "Min", "[", "1", "]", "-=", "d", "\n\n", "b", ".", "Max", "[", "0", "]", "+=", "d", "\n", "b", "."...
// Pad extends the bound in all directions by the given value.
[ "Pad", "extends", "the", "bound", "in", "all", "directions", "by", "the", "given", "value", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/bound.go#L104-L112
28,980
paulmach/orb
bound.go
Center
func (b Bound) Center() Point { return Point{ (b.Min[0] + b.Max[0]) / 2.0, (b.Min[1] + b.Max[1]) / 2.0, } }
go
func (b Bound) Center() Point { return Point{ (b.Min[0] + b.Max[0]) / 2.0, (b.Min[1] + b.Max[1]) / 2.0, } }
[ "func", "(", "b", "Bound", ")", "Center", "(", ")", "Point", "{", "return", "Point", "{", "(", "b", ".", "Min", "[", "0", "]", "+", "b", ".", "Max", "[", "0", "]", ")", "/", "2.0", ",", "(", "b", ".", "Min", "[", "1", "]", "+", "b", "."...
// Center returns the center of the bounds by "averaging" the x and y coords.
[ "Center", "returns", "the", "center", "of", "the", "bounds", "by", "averaging", "the", "x", "and", "y", "coords", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/bound.go#L115-L120
28,981
paulmach/orb
bound.go
IsEmpty
func (b Bound) IsEmpty() bool { return b.Min[0] > b.Max[0] || b.Min[1] > b.Max[1] }
go
func (b Bound) IsEmpty() bool { return b.Min[0] > b.Max[0] || b.Min[1] > b.Max[1] }
[ "func", "(", "b", "Bound", ")", "IsEmpty", "(", ")", "bool", "{", "return", "b", ".", "Min", "[", "0", "]", ">", "b", ".", "Max", "[", "0", "]", "||", "b", ".", "Min", "[", "1", "]", ">", "b", ".", "Max", "[", "1", "]", "\n", "}" ]
// IsEmpty returns true if it contains zero area or if // it's in some malformed negative state where the left point is larger than the right. // This can be caused by padding too much negative.
[ "IsEmpty", "returns", "true", "if", "it", "contains", "zero", "area", "or", "if", "it", "s", "in", "some", "malformed", "negative", "state", "where", "the", "left", "point", "is", "larger", "than", "the", "right", ".", "This", "can", "be", "caused", "by"...
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/bound.go#L155-L157
28,982
paulmach/orb
bound.go
IsZero
func (b Bound) IsZero() bool { return b.Max == Point{} && b.Min == Point{} }
go
func (b Bound) IsZero() bool { return b.Max == Point{} && b.Min == Point{} }
[ "func", "(", "b", "Bound", ")", "IsZero", "(", ")", "bool", "{", "return", "b", ".", "Max", "==", "Point", "{", "}", "&&", "b", ".", "Min", "==", "Point", "{", "}", "\n", "}" ]
// IsZero return true if the bound just includes just null island.
[ "IsZero", "return", "true", "if", "the", "bound", "just", "includes", "just", "null", "island", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/bound.go#L160-L162
28,983
paulmach/orb
bound.go
Equal
func (b Bound) Equal(c Bound) bool { return b.Min == c.Min && b.Max == c.Max }
go
func (b Bound) Equal(c Bound) bool { return b.Min == c.Min && b.Max == c.Max }
[ "func", "(", "b", "Bound", ")", "Equal", "(", "c", "Bound", ")", "bool", "{", "return", "b", ".", "Min", "==", "c", ".", "Min", "&&", "b", ".", "Max", "==", "c", ".", "Max", "\n", "}" ]
// Equal returns if two bounds are equal.
[ "Equal", "returns", "if", "two", "bounds", "are", "equal", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/bound.go#L170-L172
28,984
paulmach/orb
planar/area.go
Area
func Area(g orb.Geometry) float64 { // TODO: make faster non-centroid version. _, a := CentroidArea(g) return a }
go
func Area(g orb.Geometry) float64 { // TODO: make faster non-centroid version. _, a := CentroidArea(g) return a }
[ "func", "Area", "(", "g", "orb", ".", "Geometry", ")", "float64", "{", "// TODO: make faster non-centroid version.", "_", ",", "a", ":=", "CentroidArea", "(", "g", ")", "\n", "return", "a", "\n", "}" ]
// Area returns the area of the geometry in the 2d plane.
[ "Area", "returns", "the", "area", "of", "the", "geometry", "in", "the", "2d", "plane", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/planar/area.go#L13-L17
28,985
paulmach/orb
planar/area.go
CentroidArea
func CentroidArea(g orb.Geometry) (orb.Point, float64) { if g == nil { return orb.Point{}, 0 } switch g := g.(type) { case orb.Point: return multiPointCentroid(orb.MultiPoint{g}), 0 case orb.MultiPoint: return multiPointCentroid(g), 0 case orb.LineString: return multiLineStringCentroid(orb.MultiLineStrin...
go
func CentroidArea(g orb.Geometry) (orb.Point, float64) { if g == nil { return orb.Point{}, 0 } switch g := g.(type) { case orb.Point: return multiPointCentroid(orb.MultiPoint{g}), 0 case orb.MultiPoint: return multiPointCentroid(g), 0 case orb.LineString: return multiLineStringCentroid(orb.MultiLineStrin...
[ "func", "CentroidArea", "(", "g", "orb", ".", "Geometry", ")", "(", "orb", ".", "Point", ",", "float64", ")", "{", "if", "g", "==", "nil", "{", "return", "orb", ".", "Point", "{", "}", ",", "0", "\n", "}", "\n\n", "switch", "g", ":=", "g", ".",...
// CentroidArea returns both the centroid and the area in the 2d plane. // Since the area is need for the centroid, return both. // Polygon area will always be >= zero. Ring area my be negative if it has // a clockwise winding orider.
[ "CentroidArea", "returns", "both", "the", "centroid", "and", "the", "area", "in", "the", "2d", "plane", ".", "Since", "the", "area", "is", "need", "for", "the", "centroid", "return", "both", ".", "Polygon", "area", "will", "always", "be", ">", "=", "zero...
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/planar/area.go#L23-L50
28,986
paulmach/orb
encoding/mvt/geometry.go
elMLS
func elMLS(mls orb.MultiLineString) int { c := 0 for _, ls := range mls { c += 2 + 2*len(ls) } return c }
go
func elMLS(mls orb.MultiLineString) int { c := 0 for _, ls := range mls { c += 2 + 2*len(ls) } return c }
[ "func", "elMLS", "(", "mls", "orb", ".", "MultiLineString", ")", "int", "{", "c", ":=", "0", "\n", "for", "_", ",", "ls", ":=", "range", "mls", "{", "c", "+=", "2", "+", "2", "*", "len", "(", "ls", ")", "\n", "}", "\n\n", "return", "c", "\n",...
// functions to estimate encoded length
[ "functions", "to", "estimate", "encoded", "length" ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/mvt/geometry.go#L433-L440
28,987
paulmach/orb
encoding/mvt/marshal.go
Marshal
func Marshal(layers Layers) ([]byte, error) { vt := &vectortile.Tile{ Layers: make([]*vectortile.Tile_Layer, 0, len(layers)), } for _, l := range layers { v := l.Version e := l.Extent layer := &vectortile.Tile_Layer{ Name: &l.Name, Version: &v, Extent: &e, Features: make([]*vectortile.Til...
go
func Marshal(layers Layers) ([]byte, error) { vt := &vectortile.Tile{ Layers: make([]*vectortile.Tile_Layer, 0, len(layers)), } for _, l := range layers { v := l.Version e := l.Extent layer := &vectortile.Tile_Layer{ Name: &l.Name, Version: &v, Extent: &e, Features: make([]*vectortile.Til...
[ "func", "Marshal", "(", "layers", "Layers", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "vt", ":=", "&", "vectortile", ".", "Tile", "{", "Layers", ":", "make", "(", "[", "]", "*", "vectortile", ".", "Tile_Layer", ",", "0", ",", "len", "("...
// Marshal will take a set of layers and encode them into a Mapbox Vector Tile format.
[ "Marshal", "will", "take", "a", "set", "of", "layers", "and", "encode", "them", "into", "a", "Mapbox", "Vector", "Tile", "format", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/mvt/marshal.go#L43-L85
28,988
paulmach/orb
encoding/wkt/wkt.go
MarshalString
func MarshalString(g orb.Geometry) string { buf := bytes.NewBuffer(nil) wkt(buf, g) return buf.String() }
go
func MarshalString(g orb.Geometry) string { buf := bytes.NewBuffer(nil) wkt(buf, g) return buf.String() }
[ "func", "MarshalString", "(", "g", "orb", ".", "Geometry", ")", "string", "{", "buf", ":=", "bytes", ".", "NewBuffer", "(", "nil", ")", "\n\n", "wkt", "(", "buf", ",", "g", ")", "\n", "return", "buf", ".", "String", "(", ")", "\n", "}" ]
// MarshalString returns a WKT representation of the Geometry if possible.
[ "MarshalString", "returns", "a", "WKT", "representation", "of", "the", "Geometry", "if", "possible", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/wkt/wkt.go#L11-L16
28,989
paulmach/orb
planar/distance.go
Distance
func Distance(p1, p2 orb.Point) float64 { d0 := (p1[0] - p2[0]) d1 := (p1[1] - p2[1]) return math.Sqrt(d0*d0 + d1*d1) }
go
func Distance(p1, p2 orb.Point) float64 { d0 := (p1[0] - p2[0]) d1 := (p1[1] - p2[1]) return math.Sqrt(d0*d0 + d1*d1) }
[ "func", "Distance", "(", "p1", ",", "p2", "orb", ".", "Point", ")", "float64", "{", "d0", ":=", "(", "p1", "[", "0", "]", "-", "p2", "[", "0", "]", ")", "\n", "d1", ":=", "(", "p1", "[", "1", "]", "-", "p2", "[", "1", "]", ")", "\n", "r...
// Distance returns the distance between two points in 2d euclidean geometry.
[ "Distance", "returns", "the", "distance", "between", "two", "points", "in", "2d", "euclidean", "geometry", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/planar/distance.go#L10-L14
28,990
paulmach/orb
planar/distance.go
DistanceSquared
func DistanceSquared(p1, p2 orb.Point) float64 { d0 := (p1[0] - p2[0]) d1 := (p1[1] - p2[1]) return d0*d0 + d1*d1 }
go
func DistanceSquared(p1, p2 orb.Point) float64 { d0 := (p1[0] - p2[0]) d1 := (p1[1] - p2[1]) return d0*d0 + d1*d1 }
[ "func", "DistanceSquared", "(", "p1", ",", "p2", "orb", ".", "Point", ")", "float64", "{", "d0", ":=", "(", "p1", "[", "0", "]", "-", "p2", "[", "0", "]", ")", "\n", "d1", ":=", "(", "p1", "[", "1", "]", "-", "p2", "[", "1", "]", ")", "\n...
// DistanceSquared returns the square of the distance between two points in 2d euclidean geometry.
[ "DistanceSquared", "returns", "the", "square", "of", "the", "distance", "between", "two", "points", "in", "2d", "euclidean", "geometry", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/planar/distance.go#L17-L21
28,991
paulmach/orb
geo/bound.go
NewBoundAroundPoint
func NewBoundAroundPoint(center orb.Point, distance float64) orb.Bound { radDist := distance / orb.EarthRadius radLat := deg2rad(center[1]) radLon := deg2rad(center[0]) minLat := radLat - radDist maxLat := radLat + radDist var minLon, maxLon float64 if minLat > minLatitude && maxLat < maxLatitude { deltaLon :...
go
func NewBoundAroundPoint(center orb.Point, distance float64) orb.Bound { radDist := distance / orb.EarthRadius radLat := deg2rad(center[1]) radLon := deg2rad(center[0]) minLat := radLat - radDist maxLat := radLat + radDist var minLon, maxLon float64 if minLat > minLatitude && maxLat < maxLatitude { deltaLon :...
[ "func", "NewBoundAroundPoint", "(", "center", "orb", ".", "Point", ",", "distance", "float64", ")", "orb", ".", "Bound", "{", "radDist", ":=", "distance", "/", "orb", ".", "EarthRadius", "\n", "radLat", ":=", "deg2rad", "(", "center", "[", "1", "]", ")",...
// NewBoundAroundPoint creates a new bound given a center point, // and a distance from the center point in meters.
[ "NewBoundAroundPoint", "creates", "a", "new", "bound", "given", "a", "center", "point", "and", "a", "distance", "from", "the", "center", "point", "in", "meters", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geo/bound.go#L11-L40
28,992
paulmach/orb
geo/bound.go
BoundPad
func BoundPad(b orb.Bound, meters float64) orb.Bound { dy := meters / 111131.75 dx := dy / math.Cos(deg2rad(b.Max[1])) dx = math.Max(dx, dy/math.Cos(deg2rad(b.Min[1]))) b.Min[0] -= dx b.Min[1] -= dy b.Max[0] += dx b.Max[1] += dy b.Min[0] = math.Max(b.Min[0], -180) b.Min[1] = math.Max(b.Min[1], -90) b.Max[...
go
func BoundPad(b orb.Bound, meters float64) orb.Bound { dy := meters / 111131.75 dx := dy / math.Cos(deg2rad(b.Max[1])) dx = math.Max(dx, dy/math.Cos(deg2rad(b.Min[1]))) b.Min[0] -= dx b.Min[1] -= dy b.Max[0] += dx b.Max[1] += dy b.Min[0] = math.Max(b.Min[0], -180) b.Min[1] = math.Max(b.Min[1], -90) b.Max[...
[ "func", "BoundPad", "(", "b", "orb", ".", "Bound", ",", "meters", "float64", ")", "orb", ".", "Bound", "{", "dy", ":=", "meters", "/", "111131.75", "\n", "dx", ":=", "dy", "/", "math", ".", "Cos", "(", "deg2rad", "(", "b", ".", "Max", "[", "1", ...
// BoundPad expands the bound in all directions by the given amount of meters.
[ "BoundPad", "expands", "the", "bound", "in", "all", "directions", "by", "the", "given", "amount", "of", "meters", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geo/bound.go#L43-L61
28,993
paulmach/orb
geo/bound.go
BoundWidth
func BoundWidth(b orb.Bound) float64 { c := (b.Min[1] + b.Max[1]) / 2.0 s1 := orb.Point{b.Min[0], c} s2 := orb.Point{b.Max[0], c} return Distance(s1, s2) }
go
func BoundWidth(b orb.Bound) float64 { c := (b.Min[1] + b.Max[1]) / 2.0 s1 := orb.Point{b.Min[0], c} s2 := orb.Point{b.Max[0], c} return Distance(s1, s2) }
[ "func", "BoundWidth", "(", "b", "orb", ".", "Bound", ")", "float64", "{", "c", ":=", "(", "b", ".", "Min", "[", "1", "]", "+", "b", ".", "Max", "[", "1", "]", ")", "/", "2.0", "\n\n", "s1", ":=", "orb", ".", "Point", "{", "b", ".", "Min", ...
// BoundWidth returns the approximate width in meters // of the center of the bound.
[ "BoundWidth", "returns", "the", "approximate", "width", "in", "meters", "of", "the", "center", "of", "the", "bound", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geo/bound.go#L70-L77
28,994
paulmach/orb
internal/mercator/mercator.go
ToPlanar
func ToPlanar(lng, lat float64, level uint32) (x, y float64) { maxtiles := float64(uint32(1 << level)) x = (lng/360.0 + 0.5) * maxtiles // bound it because we have a top of the world problem siny := math.Sin(lat * math.Pi / 180.0) if siny < -0.9999 { y = 0 } else if siny > 0.9999 { y = maxtiles - 1 } else ...
go
func ToPlanar(lng, lat float64, level uint32) (x, y float64) { maxtiles := float64(uint32(1 << level)) x = (lng/360.0 + 0.5) * maxtiles // bound it because we have a top of the world problem siny := math.Sin(lat * math.Pi / 180.0) if siny < -0.9999 { y = 0 } else if siny > 0.9999 { y = maxtiles - 1 } else ...
[ "func", "ToPlanar", "(", "lng", ",", "lat", "float64", ",", "level", "uint32", ")", "(", "x", ",", "y", "float64", ")", "{", "maxtiles", ":=", "float64", "(", "uint32", "(", "1", "<<", "level", ")", ")", "\n", "x", "=", "(", "lng", "/", "360.0", ...
// ToPlanar converts the point to geo world coordinates at the given live.
[ "ToPlanar", "converts", "the", "point", "to", "geo", "world", "coordinates", "at", "the", "given", "live", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/internal/mercator/mercator.go#L30-L47
28,995
paulmach/orb
internal/mercator/mercator.go
ToGeo
func ToGeo(x, y float64, level uint32) (lng, lat float64) { maxtiles := float64(uint32(1 << level)) lng = 360.0 * (x/maxtiles - 0.5) lat = 2.0*math.Atan(math.Exp(math.Pi-(2*math.Pi)*(y/maxtiles)))*(180.0/math.Pi) - 90.0 return lng, lat }
go
func ToGeo(x, y float64, level uint32) (lng, lat float64) { maxtiles := float64(uint32(1 << level)) lng = 360.0 * (x/maxtiles - 0.5) lat = 2.0*math.Atan(math.Exp(math.Pi-(2*math.Pi)*(y/maxtiles)))*(180.0/math.Pi) - 90.0 return lng, lat }
[ "func", "ToGeo", "(", "x", ",", "y", "float64", ",", "level", "uint32", ")", "(", "lng", ",", "lat", "float64", ")", "{", "maxtiles", ":=", "float64", "(", "uint32", "(", "1", "<<", "level", ")", ")", "\n\n", "lng", "=", "360.0", "*", "(", "x", ...
// ToGeo projects world coordinates back to geo coordinates.
[ "ToGeo", "projects", "world", "coordinates", "back", "to", "geo", "coordinates", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/internal/mercator/mercator.go#L50-L57
28,996
paulmach/orb
clone.go
Clone
func Clone(g Geometry) Geometry { if g == nil { return nil } switch g := g.(type) { case Point: return g case MultiPoint: if g == nil { return nil } return g.Clone() case LineString: if g == nil { return nil } return g.Clone() case MultiLineString: if g == nil { return nil } retur...
go
func Clone(g Geometry) Geometry { if g == nil { return nil } switch g := g.(type) { case Point: return g case MultiPoint: if g == nil { return nil } return g.Clone() case LineString: if g == nil { return nil } return g.Clone() case MultiLineString: if g == nil { return nil } retur...
[ "func", "Clone", "(", "g", "Geometry", ")", "Geometry", "{", "if", "g", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "switch", "g", ":=", "g", ".", "(", "type", ")", "{", "case", "Point", ":", "return", "g", "\n", "case", "MultiPoint", "...
// Clone will make a deep copy of the geometry.
[ "Clone", "will", "make", "a", "deep", "copy", "of", "the", "geometry", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/clone.go#L8-L56
28,997
paulmach/orb
equal.go
Equal
func Equal(g1, g2 Geometry) bool { if g1 == nil || g2 == nil { return g1 == g2 } if g1.GeoJSONType() != g2.GeoJSONType() { return false } switch g1 := g1.(type) { case Point: return g1.Equal(g2.(Point)) case MultiPoint: return g1.Equal(g2.(MultiPoint)) case LineString: return g1.Equal(g2.(LineString...
go
func Equal(g1, g2 Geometry) bool { if g1 == nil || g2 == nil { return g1 == g2 } if g1.GeoJSONType() != g2.GeoJSONType() { return false } switch g1 := g1.(type) { case Point: return g1.Equal(g2.(Point)) case MultiPoint: return g1.Equal(g2.(MultiPoint)) case LineString: return g1.Equal(g2.(LineString...
[ "func", "Equal", "(", "g1", ",", "g2", "Geometry", ")", "bool", "{", "if", "g1", "==", "nil", "||", "g2", "==", "nil", "{", "return", "g1", "==", "g2", "\n", "}", "\n\n", "if", "g1", ".", "GeoJSONType", "(", ")", "!=", "g2", ".", "GeoJSONType", ...
// Equal returns if the two geometrires are equal.
[ "Equal", "returns", "if", "the", "two", "geometrires", "are", "equal", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/equal.go#L8-L51
28,998
paulmach/orb
round.go
Round
func Round(g Geometry, factor ...int) Geometry { if g == nil { return nil } f := float64(DefaultRoundingFactor) if len(factor) > 0 { f = float64(factor[0]) } switch g := g.(type) { case Point: return Point{ math.Round(g[0]*f) / f, math.Round(g[1]*f) / f, } case MultiPoint: if g == nil { ret...
go
func Round(g Geometry, factor ...int) Geometry { if g == nil { return nil } f := float64(DefaultRoundingFactor) if len(factor) > 0 { f = float64(factor[0]) } switch g := g.(type) { case Point: return Point{ math.Round(g[0]*f) / f, math.Round(g[1]*f) / f, } case MultiPoint: if g == nil { ret...
[ "func", "Round", "(", "g", "Geometry", ",", "factor", "...", "int", ")", "Geometry", "{", "if", "g", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "f", ":=", "float64", "(", "DefaultRoundingFactor", ")", "\n", "if", "len", "(", "factor", ")",...
// Round will round all the coordinates of the geometry to the given factor. // The default is 6 decimal places.
[ "Round", "will", "round", "all", "the", "coordinates", "of", "the", "geometry", "to", "the", "given", "factor", ".", "The", "default", "is", "6", "decimal", "places", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/round.go#L10-L93
28,999
paulmach/orb
geojson/bbox.go
NewBBox
func NewBBox(b orb.Bound) BBox { return []float64{ b.Min[0], b.Min[1], b.Max[0], b.Max[1], } }
go
func NewBBox(b orb.Bound) BBox { return []float64{ b.Min[0], b.Min[1], b.Max[0], b.Max[1], } }
[ "func", "NewBBox", "(", "b", "orb", ".", "Bound", ")", "BBox", "{", "return", "[", "]", "float64", "{", "b", ".", "Min", "[", "0", "]", ",", "b", ".", "Min", "[", "1", "]", ",", "b", ".", "Max", "[", "0", "]", ",", "b", ".", "Max", "[", ...
// NewBBox creates a bbox from a a bound.
[ "NewBBox", "creates", "a", "bbox", "from", "a", "a", "bound", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/geojson/bbox.go#L10-L15