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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
27,900 | hyperhq/hyperd | daemon/pod/decommission.go | cleanup | func (p *XPod) cleanup() {
//if removing, the remove will get the resourceLock in advance, and it will set
// the pod status to NONE when it complete.
// Therefore, if get into cleanup() after remove, cleanup should exit when it
// got a
p.resourceLock.Lock()
defer p.resourceLock.Unlock()
p.statusLock.Lock()
i... | go | func (p *XPod) cleanup() {
//if removing, the remove will get the resourceLock in advance, and it will set
// the pod status to NONE when it complete.
// Therefore, if get into cleanup() after remove, cleanup should exit when it
// got a
p.resourceLock.Lock()
defer p.resourceLock.Unlock()
p.statusLock.Lock()
i... | [
"func",
"(",
"p",
"*",
"XPod",
")",
"cleanup",
"(",
")",
"{",
"//if removing, the remove will get the resourceLock in advance, and it will set",
"// the pod status to NONE when it complete.",
"// Therefore, if get into cleanup() after remove, cleanup should exit when it",
"// got a",
"p"... | //cleanup is used to cleanup the resource after VM shutdown. This method should only called by waitVMStop | [
"cleanup",
"is",
"used",
"to",
"cleanup",
"the",
"resource",
"after",
"VM",
"shutdown",
".",
"This",
"method",
"should",
"only",
"called",
"by",
"waitVMStop"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/daemon/pod/decommission.go#L542-L584 |
27,901 | hyperhq/hyperd | client/client.go | Cmd | func (cli *HyperClient) Cmd(args ...string) error {
if len(args) > 1 {
method, exists := cli.getMethod(args[:2]...)
if exists {
return method(args[2:]...)
}
}
if len(args) > 0 {
method, exists := cli.getMethod(args[0])
if !exists {
fmt.Printf("%s: '%s' is not a %s command. See '%s --help'.\n", os.Arg... | go | func (cli *HyperClient) Cmd(args ...string) error {
if len(args) > 1 {
method, exists := cli.getMethod(args[:2]...)
if exists {
return method(args[2:]...)
}
}
if len(args) > 0 {
method, exists := cli.getMethod(args[0])
if !exists {
fmt.Printf("%s: '%s' is not a %s command. See '%s --help'.\n", os.Arg... | [
"func",
"(",
"cli",
"*",
"HyperClient",
")",
"Cmd",
"(",
"args",
"...",
"string",
")",
"error",
"{",
"if",
"len",
"(",
"args",
")",
">",
"1",
"{",
"method",
",",
"exists",
":=",
"cli",
".",
"getMethod",
"(",
"args",
"[",
":",
"2",
"]",
"...",
"... | // Cmd executes the specified command. | [
"Cmd",
"executes",
"the",
"specified",
"command",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/client/client.go#L86-L102 |
27,902 | hyperhq/hyperd | utils/utils.go | FormatMountLabel | func FormatMountLabel(src, mountLabel string) string {
if mountLabel != "" {
switch src {
case "":
src = fmt.Sprintf("context=%q", mountLabel)
default:
src = fmt.Sprintf("%s,context=%q", src, mountLabel)
}
}
return src
} | go | func FormatMountLabel(src, mountLabel string) string {
if mountLabel != "" {
switch src {
case "":
src = fmt.Sprintf("context=%q", mountLabel)
default:
src = fmt.Sprintf("%s,context=%q", src, mountLabel)
}
}
return src
} | [
"func",
"FormatMountLabel",
"(",
"src",
",",
"mountLabel",
"string",
")",
"string",
"{",
"if",
"mountLabel",
"!=",
"\"",
"\"",
"{",
"switch",
"src",
"{",
"case",
"\"",
"\"",
":",
"src",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"mountLabel",
... | // FormatMountLabel returns a string to be used by the mount command.
// The format of this string will be used to alter the labeling of the mountpoint.
// The string returned is suitable to be used as the options field of the mount command.
// If you need to have additional mount point options, you can pass them in as... | [
"FormatMountLabel",
"returns",
"a",
"string",
"to",
"be",
"used",
"by",
"the",
"mount",
"command",
".",
"The",
"format",
"of",
"this",
"string",
"will",
"be",
"used",
"to",
"alter",
"the",
"labeling",
"of",
"the",
"mountpoint",
".",
"The",
"string",
"retur... | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/utils/utils.go#L72-L82 |
27,903 | hyperhq/hyperd | serverrpc/info.go | PodInfo | func (s *ServerRPC) PodInfo(c context.Context, req *types.PodInfoRequest) (*types.PodInfoResponse, error) {
info, err := s.daemon.GetPodInfo(req.PodID)
if err != nil {
return nil, err
}
return &types.PodInfoResponse{
PodInfo: info,
}, nil
} | go | func (s *ServerRPC) PodInfo(c context.Context, req *types.PodInfoRequest) (*types.PodInfoResponse, error) {
info, err := s.daemon.GetPodInfo(req.PodID)
if err != nil {
return nil, err
}
return &types.PodInfoResponse{
PodInfo: info,
}, nil
} | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"PodInfo",
"(",
"c",
"context",
".",
"Context",
",",
"req",
"*",
"types",
".",
"PodInfoRequest",
")",
"(",
"*",
"types",
".",
"PodInfoResponse",
",",
"error",
")",
"{",
"info",
",",
"err",
":=",
"s",
".",
"d... | // PodInfo gets PodInfo by podID | [
"PodInfo",
"gets",
"PodInfo",
"by",
"podID"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/info.go#L14-L23 |
27,904 | hyperhq/hyperd | serverrpc/info.go | ContainerInfo | func (s *ServerRPC) ContainerInfo(c context.Context, req *types.ContainerInfoRequest) (*types.ContainerInfoResponse, error) {
info, err := s.daemon.GetContainerInfo(req.Container)
if err != nil {
return nil, err
}
return &types.ContainerInfoResponse{
ContainerInfo: info,
}, nil
} | go | func (s *ServerRPC) ContainerInfo(c context.Context, req *types.ContainerInfoRequest) (*types.ContainerInfoResponse, error) {
info, err := s.daemon.GetContainerInfo(req.Container)
if err != nil {
return nil, err
}
return &types.ContainerInfoResponse{
ContainerInfo: info,
}, nil
} | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"ContainerInfo",
"(",
"c",
"context",
".",
"Context",
",",
"req",
"*",
"types",
".",
"ContainerInfoRequest",
")",
"(",
"*",
"types",
".",
"ContainerInfoResponse",
",",
"error",
")",
"{",
"info",
",",
"err",
":=",
... | // ContainerInfo gets ContainerInfo by ID or name of container | [
"ContainerInfo",
"gets",
"ContainerInfo",
"by",
"ID",
"or",
"name",
"of",
"container"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/info.go#L26-L35 |
27,905 | hyperhq/hyperd | serverrpc/info.go | Info | func (s *ServerRPC) Info(c context.Context, req *types.InfoRequest) (*types.InfoResponse, error) {
info, err := s.daemon.CmdSystemInfo()
if err != nil {
return nil, err
}
return info, nil
} | go | func (s *ServerRPC) Info(c context.Context, req *types.InfoRequest) (*types.InfoResponse, error) {
info, err := s.daemon.CmdSystemInfo()
if err != nil {
return nil, err
}
return info, nil
} | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"Info",
"(",
"c",
"context",
".",
"Context",
",",
"req",
"*",
"types",
".",
"InfoRequest",
")",
"(",
"*",
"types",
".",
"InfoResponse",
",",
"error",
")",
"{",
"info",
",",
"err",
":=",
"s",
".",
"daemon",
... | // Info gets CmdSystemInfo | [
"Info",
"gets",
"CmdSystemInfo"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/info.go#L38-L45 |
27,906 | hyperhq/hyperd | serverrpc/info.go | Version | func (s *ServerRPC) Version(c context.Context, req *types.VersionRequest) (*types.VersionResponse, error) {
return &types.VersionResponse{
Version: utils.VERSION,
ApiVersion: GRPC_API_VERSION,
}, nil
} | go | func (s *ServerRPC) Version(c context.Context, req *types.VersionRequest) (*types.VersionResponse, error) {
return &types.VersionResponse{
Version: utils.VERSION,
ApiVersion: GRPC_API_VERSION,
}, nil
} | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"Version",
"(",
"c",
"context",
".",
"Context",
",",
"req",
"*",
"types",
".",
"VersionRequest",
")",
"(",
"*",
"types",
".",
"VersionResponse",
",",
"error",
")",
"{",
"return",
"&",
"types",
".",
"VersionRespo... | // Version gets the version and apiVersion of hyperd | [
"Version",
"gets",
"the",
"version",
"and",
"apiVersion",
"of",
"hyperd"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/info.go#L48-L53 |
27,907 | hyperhq/hyperd | serverrpc/container.go | ContainerCreate | func (s *ServerRPC) ContainerCreate(ctx context.Context, req *types.ContainerCreateRequest) (*types.ContainerCreateResponse, error) {
containerID, err := s.daemon.CreateContainerInPod(req.PodID, req.ContainerSpec)
if err != nil {
return nil, err
}
return &types.ContainerCreateResponse{
ContainerID: containerID... | go | func (s *ServerRPC) ContainerCreate(ctx context.Context, req *types.ContainerCreateRequest) (*types.ContainerCreateResponse, error) {
containerID, err := s.daemon.CreateContainerInPod(req.PodID, req.ContainerSpec)
if err != nil {
return nil, err
}
return &types.ContainerCreateResponse{
ContainerID: containerID... | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"ContainerCreate",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"types",
".",
"ContainerCreateRequest",
")",
"(",
"*",
"types",
".",
"ContainerCreateResponse",
",",
"error",
")",
"{",
"containerID",
",",
... | // ContainerCreate creates a container by UserContainer spec | [
"ContainerCreate",
"creates",
"a",
"container",
"by",
"UserContainer",
"spec"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/container.go#L9-L18 |
27,908 | hyperhq/hyperd | serverrpc/container.go | ContainerRename | func (s *ServerRPC) ContainerRename(c context.Context, req *types.ContainerRenameRequest) (*types.ContainerRenameResponse, error) {
err := s.daemon.ContainerRename(req.OldContainerName, req.NewContainerName)
if err != nil {
return nil, err
}
return &types.ContainerRenameResponse{}, nil
} | go | func (s *ServerRPC) ContainerRename(c context.Context, req *types.ContainerRenameRequest) (*types.ContainerRenameResponse, error) {
err := s.daemon.ContainerRename(req.OldContainerName, req.NewContainerName)
if err != nil {
return nil, err
}
return &types.ContainerRenameResponse{}, nil
} | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"ContainerRename",
"(",
"c",
"context",
".",
"Context",
",",
"req",
"*",
"types",
".",
"ContainerRenameRequest",
")",
"(",
"*",
"types",
".",
"ContainerRenameResponse",
",",
"error",
")",
"{",
"err",
":=",
"s",
".... | // ContainerRename rename a container | [
"ContainerRename",
"rename",
"a",
"container"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/container.go#L40-L47 |
27,909 | hyperhq/hyperd | serverrpc/container.go | ContainerSignal | func (s *ServerRPC) ContainerSignal(ctx context.Context, req *types.ContainerSignalRequest) (*types.ContainerSignalResponse, error) {
err := s.daemon.KillPodContainers(req.PodID, req.ContainerID, req.Signal)
if err != nil {
return nil, err
}
return &types.ContainerSignalResponse{}, nil
} | go | func (s *ServerRPC) ContainerSignal(ctx context.Context, req *types.ContainerSignalRequest) (*types.ContainerSignalResponse, error) {
err := s.daemon.KillPodContainers(req.PodID, req.ContainerID, req.Signal)
if err != nil {
return nil, err
}
return &types.ContainerSignalResponse{}, nil
} | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"ContainerSignal",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"types",
".",
"ContainerSignalRequest",
")",
"(",
"*",
"types",
".",
"ContainerSignalResponse",
",",
"error",
")",
"{",
"err",
":=",
"s",
... | // ContainerSignal sends a singal to specified container of specified pod | [
"ContainerSignal",
"sends",
"a",
"singal",
"to",
"specified",
"container",
"of",
"specified",
"pod"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/container.go#L59-L66 |
27,910 | hyperhq/hyperd | daemon/daemonbuilder/builder.go | Pull | func (d Docker) Pull(name string) (builder.Image, error) {
ref, err := reference.ParseNamed(name)
if err != nil {
return nil, err
}
ref = reference.WithDefaultTag(ref)
pullRegistryAuth := &types.AuthConfig{}
if len(d.AuthConfigs) > 0 {
// The request came with a full auth config file, we prefer to use that
... | go | func (d Docker) Pull(name string) (builder.Image, error) {
ref, err := reference.ParseNamed(name)
if err != nil {
return nil, err
}
ref = reference.WithDefaultTag(ref)
pullRegistryAuth := &types.AuthConfig{}
if len(d.AuthConfigs) > 0 {
// The request came with a full auth config file, we prefer to use that
... | [
"func",
"(",
"d",
"Docker",
")",
"Pull",
"(",
"name",
"string",
")",
"(",
"builder",
".",
"Image",
",",
"error",
")",
"{",
"ref",
",",
"err",
":=",
"reference",
".",
"ParseNamed",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"... | // Pull tells Docker to pull image referenced by `name`. | [
"Pull",
"tells",
"Docker",
"to",
"pull",
"image",
"referenced",
"by",
"name",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/daemon/daemonbuilder/builder.go#L49-L75 |
27,911 | hyperhq/hyperd | daemon/daemonbuilder/builder.go | GetImage | func (d Docker) GetImage(name string) (builder.Image, error) {
img, err := d.Daemon.GetImage(name)
if err != nil {
return nil, err
}
return imgWrap{img}, nil
} | go | func (d Docker) GetImage(name string) (builder.Image, error) {
img, err := d.Daemon.GetImage(name)
if err != nil {
return nil, err
}
return imgWrap{img}, nil
} | [
"func",
"(",
"d",
"Docker",
")",
"GetImage",
"(",
"name",
"string",
")",
"(",
"builder",
".",
"Image",
",",
"error",
")",
"{",
"img",
",",
"err",
":=",
"d",
".",
"Daemon",
".",
"GetImage",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // GetImage looks up a Docker image referenced by `name`. | [
"GetImage",
"looks",
"up",
"a",
"Docker",
"image",
"referenced",
"by",
"name",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/daemon/daemonbuilder/builder.go#L78-L84 |
27,912 | hyperhq/hyperd | daemon/daemonbuilder/builder.go | ContainerUpdateCmd | func (d Docker) ContainerUpdateCmd(cID string, cmd []string) error {
c, err := d.Daemon.GetContainer(cID)
if err != nil {
return err
}
c.Path = cmd[0]
c.Args = cmd[1:]
return nil
} | go | func (d Docker) ContainerUpdateCmd(cID string, cmd []string) error {
c, err := d.Daemon.GetContainer(cID)
if err != nil {
return err
}
c.Path = cmd[0]
c.Args = cmd[1:]
return nil
} | [
"func",
"(",
"d",
"Docker",
")",
"ContainerUpdateCmd",
"(",
"cID",
"string",
",",
"cmd",
"[",
"]",
"string",
")",
"error",
"{",
"c",
",",
"err",
":=",
"d",
".",
"Daemon",
".",
"GetContainer",
"(",
"cID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // ContainerUpdateCmd updates Path and Args for the container with ID cID. | [
"ContainerUpdateCmd",
"updates",
"Path",
"and",
"Args",
"for",
"the",
"container",
"with",
"ID",
"cID",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/daemon/daemonbuilder/builder.go#L87-L95 |
27,913 | hyperhq/hyperd | daemon/daemonbuilder/builder.go | GetCachedImage | func (d Docker) GetCachedImage(imgID string, cfg *container.Config) (string, error) {
cache, err := d.Daemon.ImageGetCached(image.ID(imgID), cfg)
if cache == nil || err != nil {
return "", err
}
return cache.ID().String(), nil
} | go | func (d Docker) GetCachedImage(imgID string, cfg *container.Config) (string, error) {
cache, err := d.Daemon.ImageGetCached(image.ID(imgID), cfg)
if cache == nil || err != nil {
return "", err
}
return cache.ID().String(), nil
} | [
"func",
"(",
"d",
"Docker",
")",
"GetCachedImage",
"(",
"imgID",
"string",
",",
"cfg",
"*",
"container",
".",
"Config",
")",
"(",
"string",
",",
"error",
")",
"{",
"cache",
",",
"err",
":=",
"d",
".",
"Daemon",
".",
"ImageGetCached",
"(",
"image",
".... | // GetCachedImage returns a reference to a cached image whose parent equals `parent`
// and runconfig equals `cfg`. A cache miss is expected to return an empty ID and a nil error. | [
"GetCachedImage",
"returns",
"a",
"reference",
"to",
"a",
"cached",
"image",
"whose",
"parent",
"equals",
"parent",
"and",
"runconfig",
"equals",
"cfg",
".",
"A",
"cache",
"miss",
"is",
"expected",
"to",
"return",
"an",
"empty",
"ID",
"and",
"a",
"nil",
"e... | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/daemon/daemonbuilder/builder.go#L99-L105 |
27,914 | hyperhq/hyperd | daemon/pod/migration.go | MigrateLagecyPersistentData | func MigrateLagecyPersistentData(db *daemondb.DaemonDB, podFactory func() *PodFactory) (err error) {
num := 0
count := 0
defer func() {
logInfo := fmt.Sprintf("Migrate lagecy persistent pod data, found: %d, migrated: %d", num, count)
if err == nil {
hlog.Log(INFO, logInfo)
} else {
hlog.Log(ERROR, "%s, b... | go | func MigrateLagecyPersistentData(db *daemondb.DaemonDB, podFactory func() *PodFactory) (err error) {
num := 0
count := 0
defer func() {
logInfo := fmt.Sprintf("Migrate lagecy persistent pod data, found: %d, migrated: %d", num, count)
if err == nil {
hlog.Log(INFO, logInfo)
} else {
hlog.Log(ERROR, "%s, b... | [
"func",
"MigrateLagecyPersistentData",
"(",
"db",
"*",
"daemondb",
".",
"DaemonDB",
",",
"podFactory",
"func",
"(",
")",
"*",
"PodFactory",
")",
"(",
"err",
"error",
")",
"{",
"num",
":=",
"0",
"\n",
"count",
":=",
"0",
"\n",
"defer",
"func",
"(",
")",... | // MigrateLagecyData migrate lagecy persistence data to current layout. | [
"MigrateLagecyData",
"migrate",
"lagecy",
"persistence",
"data",
"to",
"current",
"layout",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/daemon/pod/migration.go#L17-L101 |
27,915 | hyperhq/hyperd | serverrpc/portmapping.go | PortMappingList | func (s *ServerRPC) PortMappingList(ctx context.Context, req *types.PortMappingListRequest) (*types.PortMappingListResponse, error) {
p, ok := s.daemon.PodList.Get(req.PodID)
if !ok {
return nil, fmt.Errorf("Pod not found")
}
return &types.PortMappingListResponse{
PortMappings: p.ListPortMappings(),
}, nil
} | go | func (s *ServerRPC) PortMappingList(ctx context.Context, req *types.PortMappingListRequest) (*types.PortMappingListResponse, error) {
p, ok := s.daemon.PodList.Get(req.PodID)
if !ok {
return nil, fmt.Errorf("Pod not found")
}
return &types.PortMappingListResponse{
PortMappings: p.ListPortMappings(),
}, nil
} | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"PortMappingList",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"types",
".",
"PortMappingListRequest",
")",
"(",
"*",
"types",
".",
"PortMappingListResponse",
",",
"error",
")",
"{",
"p",
",",
"ok",
":... | // PortMappingList get a list of PortMappings | [
"PortMappingList",
"get",
"a",
"list",
"of",
"PortMappings"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/portmapping.go#L10-L19 |
27,916 | hyperhq/hyperd | serverrpc/portmapping.go | PortMappingDel | func (s *ServerRPC) PortMappingDel(ctx context.Context, req *types.PortMappingModifyRequest) (*types.PortMappingModifyResponse, error) {
p, ok := s.daemon.PodList.Get(req.PodID)
if !ok {
return nil, fmt.Errorf("Pod not found")
}
err := p.RemovePortMappingByDest(req.PortMappings)
if err != nil {
return nil, fm... | go | func (s *ServerRPC) PortMappingDel(ctx context.Context, req *types.PortMappingModifyRequest) (*types.PortMappingModifyResponse, error) {
p, ok := s.daemon.PodList.Get(req.PodID)
if !ok {
return nil, fmt.Errorf("Pod not found")
}
err := p.RemovePortMappingByDest(req.PortMappings)
if err != nil {
return nil, fm... | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"PortMappingDel",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"types",
".",
"PortMappingModifyRequest",
")",
"(",
"*",
"types",
".",
"PortMappingModifyResponse",
",",
"error",
")",
"{",
"p",
",",
"ok",
... | // PortMappingDel remove a list of PortMapping rules from a Pod | [
"PortMappingDel",
"remove",
"a",
"list",
"of",
"PortMapping",
"rules",
"from",
"a",
"Pod"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/portmapping.go#L37-L49 |
27,917 | hyperhq/hyperd | server/middleware.go | debugRequestMiddleware | func debugRequestMiddleware(handler httputils.APIFunc) httputils.APIFunc {
return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
glog.V(3).Infof("%s %s", r.Method, r.RequestURI)
if r.Method != "POST" {
return handler(ctx, w, r, vars)
}
if err := httputils.... | go | func debugRequestMiddleware(handler httputils.APIFunc) httputils.APIFunc {
return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
glog.V(3).Infof("%s %s", r.Method, r.RequestURI)
if r.Method != "POST" {
return handler(ctx, w, r, vars)
}
if err := httputils.... | [
"func",
"debugRequestMiddleware",
"(",
"handler",
"httputils",
".",
"APIFunc",
")",
"httputils",
".",
"APIFunc",
"{",
"return",
"func",
"(",
"ctx",
"context",
".",
"Context",
",",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
"... | // debugRequestMiddleware dumps the request to logger | [
"debugRequestMiddleware",
"dumps",
"the",
"request",
"to",
"logger"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/server/middleware.go#L27-L67 |
27,918 | hyperhq/hyperd | server/middleware.go | authorizationMiddleware | func (s *Server) authorizationMiddleware(handler httputils.APIFunc) httputils.APIFunc {
return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
// FIXME: fill when authN gets in
// User and UserAuthNMethod are taken from AuthN plugins
// Currently tracked in https... | go | func (s *Server) authorizationMiddleware(handler httputils.APIFunc) httputils.APIFunc {
return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
// FIXME: fill when authN gets in
// User and UserAuthNMethod are taken from AuthN plugins
// Currently tracked in https... | [
"func",
"(",
"s",
"*",
"Server",
")",
"authorizationMiddleware",
"(",
"handler",
"httputils",
".",
"APIFunc",
")",
"httputils",
".",
"APIFunc",
"{",
"return",
"func",
"(",
"ctx",
"context",
".",
"Context",
",",
"w",
"http",
".",
"ResponseWriter",
",",
"r",... | // authorizationMiddleware perform authorization on the request. | [
"authorizationMiddleware",
"perform",
"authorization",
"on",
"the",
"request",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/server/middleware.go#L70-L97 |
27,919 | hyperhq/hyperd | server/middleware.go | userAgentMiddleware | func (s *Server) userAgentMiddleware(handler httputils.APIFunc) httputils.APIFunc {
return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if strings.Contains(r.Header.Get("User-Agent"), "Docker-Client/") {
dockerVersion := version.Version(s.cfg.Version)
userA... | go | func (s *Server) userAgentMiddleware(handler httputils.APIFunc) httputils.APIFunc {
return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if strings.Contains(r.Header.Get("User-Agent"), "Docker-Client/") {
dockerVersion := version.Version(s.cfg.Version)
userA... | [
"func",
"(",
"s",
"*",
"Server",
")",
"userAgentMiddleware",
"(",
"handler",
"httputils",
".",
"APIFunc",
")",
"httputils",
".",
"APIFunc",
"{",
"return",
"func",
"(",
"ctx",
"context",
".",
"Context",
",",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"... | // userAgentMiddleware checks the User-Agent header looking for a valid docker client spec. | [
"userAgentMiddleware",
"checks",
"the",
"User",
"-",
"Agent",
"header",
"looking",
"for",
"a",
"valid",
"docker",
"client",
"spec",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/server/middleware.go#L100-L119 |
27,920 | hyperhq/hyperd | server/middleware.go | corsMiddleware | func (s *Server) corsMiddleware(handler httputils.APIFunc) httputils.APIFunc {
return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
// If "api-cors-header" is not given, but "api-enable-cors" is true, we set cors to "*"
// otherwise, all head values will be passe... | go | func (s *Server) corsMiddleware(handler httputils.APIFunc) httputils.APIFunc {
return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
// If "api-cors-header" is not given, but "api-enable-cors" is true, we set cors to "*"
// otherwise, all head values will be passe... | [
"func",
"(",
"s",
"*",
"Server",
")",
"corsMiddleware",
"(",
"handler",
"httputils",
".",
"APIFunc",
")",
"httputils",
".",
"APIFunc",
"{",
"return",
"func",
"(",
"ctx",
"context",
".",
"Context",
",",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
... | // corsMiddleware sets the CORS header expectations in the server. | [
"corsMiddleware",
"sets",
"the",
"CORS",
"header",
"expectations",
"in",
"the",
"server",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/server/middleware.go#L122-L136 |
27,921 | hyperhq/hyperd | server/middleware.go | versionMiddleware | func versionMiddleware(handler httputils.APIFunc) httputils.APIFunc {
return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
apiVersion := version.Version(vars["version"])
if apiVersion == "" {
apiVersion = api.DefaultVersion
}
// FIXME: do not check version... | go | func versionMiddleware(handler httputils.APIFunc) httputils.APIFunc {
return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
apiVersion := version.Version(vars["version"])
if apiVersion == "" {
apiVersion = api.DefaultVersion
}
// FIXME: do not check version... | [
"func",
"versionMiddleware",
"(",
"handler",
"httputils",
".",
"APIFunc",
")",
"httputils",
".",
"APIFunc",
"{",
"return",
"func",
"(",
"ctx",
"context",
".",
"Context",
",",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
... | // versionMiddleware checks the api version requirements before passing the request to the server handler. | [
"versionMiddleware",
"checks",
"the",
"api",
"version",
"requirements",
"before",
"passing",
"the",
"request",
"to",
"the",
"server",
"handler",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/server/middleware.go#L139-L158 |
27,922 | hyperhq/hyperd | storage/vbox/vbox.go | MountContainerToSharedDir | func MountContainerToSharedDir(containerId, sharedDir, devPrefix string) (string, error) {
devFullName := fmt.Sprintf("%s/vbox/images/%s.vdi", utils.HYPER_ROOT, containerId)
return devFullName, nil
} | go | func MountContainerToSharedDir(containerId, sharedDir, devPrefix string) (string, error) {
devFullName := fmt.Sprintf("%s/vbox/images/%s.vdi", utils.HYPER_ROOT, containerId)
return devFullName, nil
} | [
"func",
"MountContainerToSharedDir",
"(",
"containerId",
",",
"sharedDir",
",",
"devPrefix",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"devFullName",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"utils",
".",
"HYPER_ROOT",
",",
"containerId... | // For device mapper, we do not need to mount the container to sharedDir.
// All of we need to provide the block device name of container. | [
"For",
"device",
"mapper",
"we",
"do",
"not",
"need",
"to",
"mount",
"the",
"container",
"to",
"sharedDir",
".",
"All",
"of",
"we",
"need",
"to",
"provide",
"the",
"block",
"device",
"name",
"of",
"container",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/storage/vbox/vbox.go#L11-L14 |
27,923 | hyperhq/hyperd | serverrpc/images.go | ImagePull | func (s *ServerRPC) ImagePull(req *types.ImagePullRequest, stream types.PublicAPI_ImagePullServer) error {
authConfig := &enginetypes.AuthConfig{}
if req.Auth != nil {
authConfig = &enginetypes.AuthConfig{
Username: req.Auth.Username,
Password: req.Auth.Password,
Auth: req.Auth.Auth,
... | go | func (s *ServerRPC) ImagePull(req *types.ImagePullRequest, stream types.PublicAPI_ImagePullServer) error {
authConfig := &enginetypes.AuthConfig{}
if req.Auth != nil {
authConfig = &enginetypes.AuthConfig{
Username: req.Auth.Username,
Password: req.Auth.Password,
Auth: req.Auth.Auth,
... | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"ImagePull",
"(",
"req",
"*",
"types",
".",
"ImagePullRequest",
",",
"stream",
"types",
".",
"PublicAPI_ImagePullServer",
")",
"error",
"{",
"authConfig",
":=",
"&",
"enginetypes",
".",
"AuthConfig",
"{",
"}",
"\n",
... | // ImagePull pulls a image from registry | [
"ImagePull",
"pulls",
"a",
"image",
"from",
"registry"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/images.go#L41-L92 |
27,924 | hyperhq/hyperd | serverrpc/images.go | ImagePush | func (s *ServerRPC) ImagePush(req *types.ImagePushRequest, stream types.PublicAPI_ImagePushServer) error {
authConfig := &enginetypes.AuthConfig{}
if req.Auth != nil {
authConfig = &enginetypes.AuthConfig{
Username: req.Auth.Username,
Password: req.Auth.Password,
Auth: req.Auth.Auth,
... | go | func (s *ServerRPC) ImagePush(req *types.ImagePushRequest, stream types.PublicAPI_ImagePushServer) error {
authConfig := &enginetypes.AuthConfig{}
if req.Auth != nil {
authConfig = &enginetypes.AuthConfig{
Username: req.Auth.Username,
Password: req.Auth.Password,
Auth: req.Auth.Auth,
... | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"ImagePush",
"(",
"req",
"*",
"types",
".",
"ImagePushRequest",
",",
"stream",
"types",
".",
"PublicAPI_ImagePushServer",
")",
"error",
"{",
"authConfig",
":=",
"&",
"enginetypes",
".",
"AuthConfig",
"{",
"}",
"\n",
... | // ImagePush pushes a local image to registry | [
"ImagePush",
"pushes",
"a",
"local",
"image",
"to",
"registry"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/images.go#L95-L140 |
27,925 | hyperhq/hyperd | serverrpc/images.go | ImageRemove | func (s *ServerRPC) ImageRemove(ctx context.Context, req *types.ImageRemoveRequest) (*types.ImageRemoveResponse, error) {
resp, err := s.daemon.CmdImageDelete(req.Image, req.Force, req.Prune)
if err != nil {
return nil, err
}
return &types.ImageRemoveResponse{
Images: resp,
}, nil
} | go | func (s *ServerRPC) ImageRemove(ctx context.Context, req *types.ImageRemoveRequest) (*types.ImageRemoveResponse, error) {
resp, err := s.daemon.CmdImageDelete(req.Image, req.Force, req.Prune)
if err != nil {
return nil, err
}
return &types.ImageRemoveResponse{
Images: resp,
}, nil
} | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"ImageRemove",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"types",
".",
"ImageRemoveRequest",
")",
"(",
"*",
"types",
".",
"ImageRemoveResponse",
",",
"error",
")",
"{",
"resp",
",",
"err",
":=",
"s... | // ImageRemove deletes a image from hyperd | [
"ImageRemove",
"deletes",
"a",
"image",
"from",
"hyperd"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/images.go#L143-L152 |
27,926 | hyperhq/hyperd | serverrpc/pod.go | PodCreate | func (s *ServerRPC) PodCreate(ctx context.Context, req *types.PodCreateRequest) (*types.PodCreateResponse, error) {
p, err := s.daemon.CreatePod(req.PodID, req.PodSpec)
if err != nil {
return nil, err
}
return &types.PodCreateResponse{
PodID: p.Id(),
}, nil
} | go | func (s *ServerRPC) PodCreate(ctx context.Context, req *types.PodCreateRequest) (*types.PodCreateResponse, error) {
p, err := s.daemon.CreatePod(req.PodID, req.PodSpec)
if err != nil {
return nil, err
}
return &types.PodCreateResponse{
PodID: p.Id(),
}, nil
} | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"PodCreate",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"types",
".",
"PodCreateRequest",
")",
"(",
"*",
"types",
".",
"PodCreateResponse",
",",
"error",
")",
"{",
"p",
",",
"err",
":=",
"s",
".",... | // PodCreate creates a pod by PodSpec | [
"PodCreate",
"creates",
"a",
"pod",
"by",
"PodSpec"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/pod.go#L12-L21 |
27,927 | hyperhq/hyperd | serverrpc/pod.go | PodStart | func (s *ServerRPC) PodStart(ctx context.Context, req *types.PodStartRequest) (*types.PodStartResponse, error) {
err := s.daemon.StartPod(req.PodID)
if err != nil {
return nil, err
}
return &types.PodStartResponse{}, nil
} | go | func (s *ServerRPC) PodStart(ctx context.Context, req *types.PodStartRequest) (*types.PodStartResponse, error) {
err := s.daemon.StartPod(req.PodID)
if err != nil {
return nil, err
}
return &types.PodStartResponse{}, nil
} | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"PodStart",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"types",
".",
"PodStartRequest",
")",
"(",
"*",
"types",
".",
"PodStartResponse",
",",
"error",
")",
"{",
"err",
":=",
"s",
".",
"daemon",
".... | // PodStart starts a pod by podID | [
"PodStart",
"starts",
"a",
"pod",
"by",
"podID"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/pod.go#L24-L31 |
27,928 | hyperhq/hyperd | serverrpc/pod.go | PodRemove | func (s *ServerRPC) PodRemove(ctx context.Context, req *types.PodRemoveRequest) (*types.PodRemoveResponse, error) {
if req.PodID == "" {
return nil, fmt.Errorf("PodRemove failed PodID is required for PodRemove")
}
code, cause, err := s.daemon.RemovePod(req.PodID)
if err != nil {
return nil, fmt.Errorf("s.daemo... | go | func (s *ServerRPC) PodRemove(ctx context.Context, req *types.PodRemoveRequest) (*types.PodRemoveResponse, error) {
if req.PodID == "" {
return nil, fmt.Errorf("PodRemove failed PodID is required for PodRemove")
}
code, cause, err := s.daemon.RemovePod(req.PodID)
if err != nil {
return nil, fmt.Errorf("s.daemo... | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"PodRemove",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"types",
".",
"PodRemoveRequest",
")",
"(",
"*",
"types",
".",
"PodRemoveResponse",
",",
"error",
")",
"{",
"if",
"req",
".",
"PodID",
"==",
... | // PodRemove removes a pod by podID | [
"PodRemove",
"removes",
"a",
"pod",
"by",
"podID"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/pod.go#L34-L48 |
27,929 | hyperhq/hyperd | serverrpc/pod.go | PodStop | func (s *ServerRPC) PodStop(ctx context.Context, req *types.PodStopRequest) (*types.PodStopResponse, error) {
code, cause, err := s.daemon.StopPod(req.PodID)
if err != nil {
return nil, err
}
return &types.PodStopResponse{
Cause: cause,
Code: int32(code),
}, nil
} | go | func (s *ServerRPC) PodStop(ctx context.Context, req *types.PodStopRequest) (*types.PodStopResponse, error) {
code, cause, err := s.daemon.StopPod(req.PodID)
if err != nil {
return nil, err
}
return &types.PodStopResponse{
Cause: cause,
Code: int32(code),
}, nil
} | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"PodStop",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"types",
".",
"PodStopRequest",
")",
"(",
"*",
"types",
".",
"PodStopResponse",
",",
"error",
")",
"{",
"code",
",",
"cause",
",",
"err",
":="... | // PodStop stops a pod | [
"PodStop",
"stops",
"a",
"pod"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/pod.go#L51-L61 |
27,930 | hyperhq/hyperd | serverrpc/pod.go | PodSignal | func (s *ServerRPC) PodSignal(ctx context.Context, req *types.PodSignalRequest) (*types.PodSignalResponse, error) {
err := s.daemon.KillPodContainers(req.PodID, "", req.Signal)
if err != nil {
return nil, err
}
return &types.PodSignalResponse{}, nil
} | go | func (s *ServerRPC) PodSignal(ctx context.Context, req *types.PodSignalRequest) (*types.PodSignalResponse, error) {
err := s.daemon.KillPodContainers(req.PodID, "", req.Signal)
if err != nil {
return nil, err
}
return &types.PodSignalResponse{}, nil
} | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"PodSignal",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"types",
".",
"PodSignalRequest",
")",
"(",
"*",
"types",
".",
"PodSignalResponse",
",",
"error",
")",
"{",
"err",
":=",
"s",
".",
"daemon",
... | // PodSignal sends a singal to all containers of specified pod | [
"PodSignal",
"sends",
"a",
"singal",
"to",
"all",
"containers",
"of",
"specified",
"pod"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/pod.go#L64-L71 |
27,931 | hyperhq/hyperd | serverrpc/pod.go | PodPause | func (s *ServerRPC) PodPause(ctx context.Context, req *types.PodPauseRequest) (*types.PodPauseResponse, error) {
err := s.daemon.PausePod(req.PodID)
if err != nil {
return nil, err
}
return &types.PodPauseResponse{}, nil
} | go | func (s *ServerRPC) PodPause(ctx context.Context, req *types.PodPauseRequest) (*types.PodPauseResponse, error) {
err := s.daemon.PausePod(req.PodID)
if err != nil {
return nil, err
}
return &types.PodPauseResponse{}, nil
} | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"PodPause",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"types",
".",
"PodPauseRequest",
")",
"(",
"*",
"types",
".",
"PodPauseResponse",
",",
"error",
")",
"{",
"err",
":=",
"s",
".",
"daemon",
".... | // PodPause pauses a pod | [
"PodPause",
"pauses",
"a",
"pod"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/pod.go#L74-L81 |
27,932 | hyperhq/hyperd | serverrpc/pod.go | PodUnpause | func (s *ServerRPC) PodUnpause(ctx context.Context, req *types.PodUnpauseRequest) (*types.PodUnpauseResponse, error) {
err := s.daemon.UnpausePod(req.PodID)
if err != nil {
return nil, err
}
return &types.PodUnpauseResponse{}, nil
} | go | func (s *ServerRPC) PodUnpause(ctx context.Context, req *types.PodUnpauseRequest) (*types.PodUnpauseResponse, error) {
err := s.daemon.UnpausePod(req.PodID)
if err != nil {
return nil, err
}
return &types.PodUnpauseResponse{}, nil
} | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"PodUnpause",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"types",
".",
"PodUnpauseRequest",
")",
"(",
"*",
"types",
".",
"PodUnpauseResponse",
",",
"error",
")",
"{",
"err",
":=",
"s",
".",
"daemon"... | // PodUnpause unpauses a pod | [
"PodUnpause",
"unpauses",
"a",
"pod"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/pod.go#L84-L91 |
27,933 | hyperhq/hyperd | serverrpc/pod.go | SetPodLabels | func (s *ServerRPC) SetPodLabels(c context.Context, req *types.PodLabelsRequest) (*types.PodLabelsResponse, error) {
err := s.daemon.SetPodLabels(req.PodID, req.Override, req.Labels)
if err != nil {
return nil, err
}
return &types.PodLabelsResponse{}, nil
} | go | func (s *ServerRPC) SetPodLabels(c context.Context, req *types.PodLabelsRequest) (*types.PodLabelsResponse, error) {
err := s.daemon.SetPodLabels(req.PodID, req.Override, req.Labels)
if err != nil {
return nil, err
}
return &types.PodLabelsResponse{}, nil
} | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"SetPodLabels",
"(",
"c",
"context",
".",
"Context",
",",
"req",
"*",
"types",
".",
"PodLabelsRequest",
")",
"(",
"*",
"types",
".",
"PodLabelsResponse",
",",
"error",
")",
"{",
"err",
":=",
"s",
".",
"daemon",
... | // PodLabels sets the labels of Pod | [
"PodLabels",
"sets",
"the",
"labels",
"of",
"Pod"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/pod.go#L94-L101 |
27,934 | golang/geo | s2/point.go | Distance | func (p Point) Distance(b Point) s1.Angle {
return p.Vector.Angle(b.Vector)
} | go | func (p Point) Distance(b Point) s1.Angle {
return p.Vector.Angle(b.Vector)
} | [
"func",
"(",
"p",
"Point",
")",
"Distance",
"(",
"b",
"Point",
")",
"s1",
".",
"Angle",
"{",
"return",
"p",
".",
"Vector",
".",
"Angle",
"(",
"b",
".",
"Vector",
")",
"\n",
"}"
] | // Distance returns the angle between two points. | [
"Distance",
"returns",
"the",
"angle",
"between",
"two",
"points",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/point.go#L125-L127 |
27,935 | golang/geo | s2/point.go | ApproxEqual | func (p Point) ApproxEqual(other Point) bool {
return p.Vector.Angle(other.Vector) <= s1.Angle(epsilon)
} | go | func (p Point) ApproxEqual(other Point) bool {
return p.Vector.Angle(other.Vector) <= s1.Angle(epsilon)
} | [
"func",
"(",
"p",
"Point",
")",
"ApproxEqual",
"(",
"other",
"Point",
")",
"bool",
"{",
"return",
"p",
".",
"Vector",
".",
"Angle",
"(",
"other",
".",
"Vector",
")",
"<=",
"s1",
".",
"Angle",
"(",
"epsilon",
")",
"\n",
"}"
] | // ApproxEqual reports whether the two points are similar enough to be equal. | [
"ApproxEqual",
"reports",
"whether",
"the",
"two",
"points",
"are",
"similar",
"enough",
"to",
"be",
"equal",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/point.go#L130-L132 |
27,936 | golang/geo | s2/point.go | ChordAngleBetweenPoints | func ChordAngleBetweenPoints(x, y Point) s1.ChordAngle {
return s1.ChordAngle(math.Min(4.0, x.Sub(y.Vector).Norm2()))
} | go | func ChordAngleBetweenPoints(x, y Point) s1.ChordAngle {
return s1.ChordAngle(math.Min(4.0, x.Sub(y.Vector).Norm2()))
} | [
"func",
"ChordAngleBetweenPoints",
"(",
"x",
",",
"y",
"Point",
")",
"s1",
".",
"ChordAngle",
"{",
"return",
"s1",
".",
"ChordAngle",
"(",
"math",
".",
"Min",
"(",
"4.0",
",",
"x",
".",
"Sub",
"(",
"y",
".",
"Vector",
")",
".",
"Norm2",
"(",
")",
... | // ChordAngleBetweenPoints constructs a ChordAngle corresponding to the distance
// between the two given points. The points must be unit length. | [
"ChordAngleBetweenPoints",
"constructs",
"a",
"ChordAngle",
"corresponding",
"to",
"the",
"distance",
"between",
"the",
"two",
"given",
"points",
".",
"The",
"points",
"must",
"be",
"unit",
"length",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/point.go#L136-L138 |
27,937 | golang/geo | s2/point.go | regularPoints | func regularPoints(center Point, radius s1.Angle, numVertices int) []Point {
return regularPointsForFrame(getFrame(center), radius, numVertices)
} | go | func regularPoints(center Point, radius s1.Angle, numVertices int) []Point {
return regularPointsForFrame(getFrame(center), radius, numVertices)
} | [
"func",
"regularPoints",
"(",
"center",
"Point",
",",
"radius",
"s1",
".",
"Angle",
",",
"numVertices",
"int",
")",
"[",
"]",
"Point",
"{",
"return",
"regularPointsForFrame",
"(",
"getFrame",
"(",
"center",
")",
",",
"radius",
",",
"numVertices",
")",
"\n"... | // regularPoints generates a slice of points shaped as a regular polygon with
// the numVertices vertices, all located on a circle of the specified angular radius
// around the center. The radius is the actual distance from center to each vertex. | [
"regularPoints",
"generates",
"a",
"slice",
"of",
"points",
"shaped",
"as",
"a",
"regular",
"polygon",
"with",
"the",
"numVertices",
"vertices",
"all",
"located",
"on",
"a",
"circle",
"of",
"the",
"specified",
"angular",
"radius",
"around",
"the",
"center",
".... | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/point.go#L143-L145 |
27,938 | golang/geo | s2/point.go | regularPointsForFrame | func regularPointsForFrame(frame matrix3x3, radius s1.Angle, numVertices int) []Point {
// We construct the loop in the given frame coordinates, with the center at
// (0, 0, 1). For a loop of radius r, the loop vertices have the form
// (x, y, z) where x^2 + y^2 = sin(r) and z = cos(r). The distance on the
// spher... | go | func regularPointsForFrame(frame matrix3x3, radius s1.Angle, numVertices int) []Point {
// We construct the loop in the given frame coordinates, with the center at
// (0, 0, 1). For a loop of radius r, the loop vertices have the form
// (x, y, z) where x^2 + y^2 = sin(r) and z = cos(r). The distance on the
// spher... | [
"func",
"regularPointsForFrame",
"(",
"frame",
"matrix3x3",
",",
"radius",
"s1",
".",
"Angle",
",",
"numVertices",
"int",
")",
"[",
"]",
"Point",
"{",
"// We construct the loop in the given frame coordinates, with the center at",
"// (0, 0, 1). For a loop of radius r, the loop ... | // regularPointsForFrame generates a slice of points shaped as a regular polygon
// with numVertices vertices, all on a circle of the specified angular radius around
// the center. The radius is the actual distance from the center to each vertex. | [
"regularPointsForFrame",
"generates",
"a",
"slice",
"of",
"points",
"shaped",
"as",
"a",
"regular",
"polygon",
"with",
"numVertices",
"vertices",
"all",
"on",
"a",
"circle",
"of",
"the",
"specified",
"angular",
"radius",
"around",
"the",
"center",
".",
"The",
... | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/point.go#L150-L167 |
27,939 | golang/geo | s2/crossing_edge_query.go | NewCrossingEdgeQuery | func NewCrossingEdgeQuery(index *ShapeIndex) *CrossingEdgeQuery {
c := &CrossingEdgeQuery{
index: index,
iter: index.Iterator(),
}
return c
} | go | func NewCrossingEdgeQuery(index *ShapeIndex) *CrossingEdgeQuery {
c := &CrossingEdgeQuery{
index: index,
iter: index.Iterator(),
}
return c
} | [
"func",
"NewCrossingEdgeQuery",
"(",
"index",
"*",
"ShapeIndex",
")",
"*",
"CrossingEdgeQuery",
"{",
"c",
":=",
"&",
"CrossingEdgeQuery",
"{",
"index",
":",
"index",
",",
"iter",
":",
"index",
".",
"Iterator",
"(",
")",
",",
"}",
"\n",
"return",
"c",
"\n... | // NewCrossingEdgeQuery creates a CrossingEdgeQuery for the given index. | [
"NewCrossingEdgeQuery",
"creates",
"a",
"CrossingEdgeQuery",
"for",
"the",
"given",
"index",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/crossing_edge_query.go#L43-L49 |
27,940 | golang/geo | s2/crossing_edge_query.go | Crossings | func (c *CrossingEdgeQuery) Crossings(a, b Point, shape Shape, crossType CrossingType) []int {
edges := c.candidates(a, b, shape)
if len(edges) == 0 {
return nil
}
crosser := NewEdgeCrosser(a, b)
out := 0
n := len(edges)
for in := 0; in < n; in++ {
b := shape.Edge(edges[in])
sign := crosser.CrossingSign(... | go | func (c *CrossingEdgeQuery) Crossings(a, b Point, shape Shape, crossType CrossingType) []int {
edges := c.candidates(a, b, shape)
if len(edges) == 0 {
return nil
}
crosser := NewEdgeCrosser(a, b)
out := 0
n := len(edges)
for in := 0; in < n; in++ {
b := shape.Edge(edges[in])
sign := crosser.CrossingSign(... | [
"func",
"(",
"c",
"*",
"CrossingEdgeQuery",
")",
"Crossings",
"(",
"a",
",",
"b",
"Point",
",",
"shape",
"Shape",
",",
"crossType",
"CrossingType",
")",
"[",
"]",
"int",
"{",
"edges",
":=",
"c",
".",
"candidates",
"(",
"a",
",",
"b",
",",
"shape",
... | // Crossings returns the set of edge of the shape S that intersect the given edge AB.
// If the CrossingType is Interior, then only intersections at a point interior to both
// edges are reported, while if it is CrossingTypeAll then edges that share a vertex
// are also reported. | [
"Crossings",
"returns",
"the",
"set",
"of",
"edge",
"of",
"the",
"shape",
"S",
"that",
"intersect",
"the",
"given",
"edge",
"AB",
".",
"If",
"the",
"CrossingType",
"is",
"Interior",
"then",
"only",
"intersections",
"at",
"a",
"point",
"interior",
"to",
"bo... | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/crossing_edge_query.go#L55-L78 |
27,941 | golang/geo | s2/crossing_edge_query.go | CrossingsEdgeMap | func (c *CrossingEdgeQuery) CrossingsEdgeMap(a, b Point, crossType CrossingType) EdgeMap {
edgeMap := c.candidatesEdgeMap(a, b)
if len(edgeMap) == 0 {
return nil
}
crosser := NewEdgeCrosser(a, b)
for shape, edges := range edgeMap {
out := 0
n := len(edges)
for in := 0; in < n; in++ {
edge := shape.Edge... | go | func (c *CrossingEdgeQuery) CrossingsEdgeMap(a, b Point, crossType CrossingType) EdgeMap {
edgeMap := c.candidatesEdgeMap(a, b)
if len(edgeMap) == 0 {
return nil
}
crosser := NewEdgeCrosser(a, b)
for shape, edges := range edgeMap {
out := 0
n := len(edges)
for in := 0; in < n; in++ {
edge := shape.Edge... | [
"func",
"(",
"c",
"*",
"CrossingEdgeQuery",
")",
"CrossingsEdgeMap",
"(",
"a",
",",
"b",
"Point",
",",
"crossType",
"CrossingType",
")",
"EdgeMap",
"{",
"edgeMap",
":=",
"c",
".",
"candidatesEdgeMap",
"(",
"a",
",",
"b",
")",
"\n",
"if",
"len",
"(",
"e... | // CrossingsEdgeMap returns the set of all edges in the index that intersect the given
// edge AB. If crossType is CrossingTypeInterior, then only intersections at a
// point interior to both edges are reported, while if it is CrossingTypeAll
// then edges that share a vertex are also reported.
//
// The edges are retu... | [
"CrossingsEdgeMap",
"returns",
"the",
"set",
"of",
"all",
"edges",
"in",
"the",
"index",
"that",
"intersect",
"the",
"given",
"edge",
"AB",
".",
"If",
"crossType",
"is",
"CrossingTypeInterior",
"then",
"only",
"intersections",
"at",
"a",
"point",
"interior",
"... | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/crossing_edge_query.go#L90-L118 |
27,942 | golang/geo | s2/crossing_edge_query.go | candidates | func (c *CrossingEdgeQuery) candidates(a, b Point, shape Shape) []int {
var edges []int
// For small loops it is faster to use brute force. The threshold below was
// determined using benchmarks.
const maxBruteForceEdges = 27
maxEdges := shape.NumEdges()
if maxEdges <= maxBruteForceEdges {
edges = make([]int, ... | go | func (c *CrossingEdgeQuery) candidates(a, b Point, shape Shape) []int {
var edges []int
// For small loops it is faster to use brute force. The threshold below was
// determined using benchmarks.
const maxBruteForceEdges = 27
maxEdges := shape.NumEdges()
if maxEdges <= maxBruteForceEdges {
edges = make([]int, ... | [
"func",
"(",
"c",
"*",
"CrossingEdgeQuery",
")",
"candidates",
"(",
"a",
",",
"b",
"Point",
",",
"shape",
"Shape",
")",
"[",
"]",
"int",
"{",
"var",
"edges",
"[",
"]",
"int",
"\n\n",
"// For small loops it is faster to use brute force. The threshold below was",
... | // candidates returns a superset of the edges of the given shape that intersect
// the edge AB. | [
"candidates",
"returns",
"a",
"superset",
"of",
"the",
"edges",
"of",
"the",
"given",
"shape",
"that",
"intersect",
"the",
"edge",
"AB",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/crossing_edge_query.go#L122-L170 |
27,943 | golang/geo | s2/crossing_edge_query.go | uniqueInts | func uniqueInts(in []int) []int {
var edges []int
m := make(map[int]bool)
for _, i := range in {
if m[i] {
continue
}
m[i] = true
edges = append(edges, i)
}
sort.Ints(edges)
return edges
} | go | func uniqueInts(in []int) []int {
var edges []int
m := make(map[int]bool)
for _, i := range in {
if m[i] {
continue
}
m[i] = true
edges = append(edges, i)
}
sort.Ints(edges)
return edges
} | [
"func",
"uniqueInts",
"(",
"in",
"[",
"]",
"int",
")",
"[",
"]",
"int",
"{",
"var",
"edges",
"[",
"]",
"int",
"\n",
"m",
":=",
"make",
"(",
"map",
"[",
"int",
"]",
"bool",
")",
"\n",
"for",
"_",
",",
"i",
":=",
"range",
"in",
"{",
"if",
"m"... | // uniqueInts returns the sorted uniqued values from the given input. | [
"uniqueInts",
"returns",
"the",
"sorted",
"uniqued",
"values",
"from",
"the",
"given",
"input",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/crossing_edge_query.go#L173-L185 |
27,944 | golang/geo | s2/crossing_edge_query.go | getCells | func (c *CrossingEdgeQuery) getCells(a, b Point, root *PaddedCell) []*ShapeIndexCell {
aUV, bUV, ok := ClipToFace(a, b, root.id.Face())
if ok {
c.a = aUV
c.b = bUV
edgeBound := r2.RectFromPoints(c.a, c.b)
if root.Bound().Intersects(edgeBound) {
c.computeCellsIntersected(root, edgeBound)
}
}
if len(c.c... | go | func (c *CrossingEdgeQuery) getCells(a, b Point, root *PaddedCell) []*ShapeIndexCell {
aUV, bUV, ok := ClipToFace(a, b, root.id.Face())
if ok {
c.a = aUV
c.b = bUV
edgeBound := r2.RectFromPoints(c.a, c.b)
if root.Bound().Intersects(edgeBound) {
c.computeCellsIntersected(root, edgeBound)
}
}
if len(c.c... | [
"func",
"(",
"c",
"*",
"CrossingEdgeQuery",
")",
"getCells",
"(",
"a",
",",
"b",
"Point",
",",
"root",
"*",
"PaddedCell",
")",
"[",
"]",
"*",
"ShapeIndexCell",
"{",
"aUV",
",",
"bUV",
",",
"ok",
":=",
"ClipToFace",
"(",
"a",
",",
"b",
",",
"root",
... | // getCells returns the set of ShapeIndexCells that might contain edges intersecting
// the edge AB in the given cell root. This method is used primarly by loop and shapeutil. | [
"getCells",
"returns",
"the",
"set",
"of",
"ShapeIndexCells",
"that",
"might",
"contain",
"edges",
"intersecting",
"the",
"edge",
"AB",
"in",
"the",
"given",
"cell",
"root",
".",
"This",
"method",
"is",
"used",
"primarly",
"by",
"loop",
"and",
"shapeutil",
"... | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/crossing_edge_query.go#L236-L252 |
27,945 | golang/geo | s2/crossing_edge_query.go | getCellsForEdge | func (c *CrossingEdgeQuery) getCellsForEdge(a, b Point) {
c.cells = nil
segments := FaceSegments(a, b)
for _, segment := range segments {
c.a = segment.a
c.b = segment.b
// Optimization: rather than always starting the recursive subdivision at
// the top level face cell, instead we start at the smallest S2... | go | func (c *CrossingEdgeQuery) getCellsForEdge(a, b Point) {
c.cells = nil
segments := FaceSegments(a, b)
for _, segment := range segments {
c.a = segment.a
c.b = segment.b
// Optimization: rather than always starting the recursive subdivision at
// the top level face cell, instead we start at the smallest S2... | [
"func",
"(",
"c",
"*",
"CrossingEdgeQuery",
")",
"getCellsForEdge",
"(",
"a",
",",
"b",
"Point",
")",
"{",
"c",
".",
"cells",
"=",
"nil",
"\n\n",
"segments",
":=",
"FaceSegments",
"(",
"a",
",",
"b",
")",
"\n",
"for",
"_",
",",
"segment",
":=",
"ra... | // getCellsForEdge populates the cells field to the set of index cells intersected by an edge AB. | [
"getCellsForEdge",
"populates",
"the",
"cells",
"field",
"to",
"the",
"set",
"of",
"index",
"cells",
"intersected",
"by",
"an",
"edge",
"AB",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/crossing_edge_query.go#L255-L293 |
27,946 | golang/geo | s2/crossing_edge_query.go | computeCellsIntersected | func (c *CrossingEdgeQuery) computeCellsIntersected(pcell *PaddedCell, edgeBound r2.Rect) {
c.iter.seek(pcell.id.RangeMin())
if c.iter.Done() || c.iter.CellID() > pcell.id.RangeMax() {
// The index does not contain pcell or any of its descendants.
return
}
if c.iter.CellID() == pcell.id {
// The index contai... | go | func (c *CrossingEdgeQuery) computeCellsIntersected(pcell *PaddedCell, edgeBound r2.Rect) {
c.iter.seek(pcell.id.RangeMin())
if c.iter.Done() || c.iter.CellID() > pcell.id.RangeMax() {
// The index does not contain pcell or any of its descendants.
return
}
if c.iter.CellID() == pcell.id {
// The index contai... | [
"func",
"(",
"c",
"*",
"CrossingEdgeQuery",
")",
"computeCellsIntersected",
"(",
"pcell",
"*",
"PaddedCell",
",",
"edgeBound",
"r2",
".",
"Rect",
")",
"{",
"c",
".",
"iter",
".",
"seek",
"(",
"pcell",
".",
"id",
".",
"RangeMin",
"(",
")",
")",
"\n",
... | // computeCellsIntersected computes the index cells intersected by the current
// edge that are descendants of pcell and adds them to this queries set of cells. | [
"computeCellsIntersected",
"computes",
"the",
"index",
"cells",
"intersected",
"by",
"the",
"current",
"edge",
"that",
"are",
"descendants",
"of",
"pcell",
"and",
"adds",
"them",
"to",
"this",
"queries",
"set",
"of",
"cells",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/crossing_edge_query.go#L297-L338 |
27,947 | golang/geo | s2/crossing_edge_query.go | splitUBound | func (c *CrossingEdgeQuery) splitUBound(edgeBound r2.Rect, u float64) [2]r2.Rect {
v := edgeBound.Y.ClampPoint(interpolateFloat64(u, c.a.X, c.b.X, c.a.Y, c.b.Y))
// diag indicates which diagonal of the bounding box is spanned by AB:
// it is 0 if AB has positive slope, and 1 if AB has negative slope.
var diag int
... | go | func (c *CrossingEdgeQuery) splitUBound(edgeBound r2.Rect, u float64) [2]r2.Rect {
v := edgeBound.Y.ClampPoint(interpolateFloat64(u, c.a.X, c.b.X, c.a.Y, c.b.Y))
// diag indicates which diagonal of the bounding box is spanned by AB:
// it is 0 if AB has positive slope, and 1 if AB has negative slope.
var diag int
... | [
"func",
"(",
"c",
"*",
"CrossingEdgeQuery",
")",
"splitUBound",
"(",
"edgeBound",
"r2",
".",
"Rect",
",",
"u",
"float64",
")",
"[",
"2",
"]",
"r2",
".",
"Rect",
"{",
"v",
":=",
"edgeBound",
".",
"Y",
".",
"ClampPoint",
"(",
"interpolateFloat64",
"(",
... | // splitUBound returns the bound for two children as a result of spliting the
// current edge at the given value U. | [
"splitUBound",
"returns",
"the",
"bound",
"for",
"two",
"children",
"as",
"a",
"result",
"of",
"spliting",
"the",
"current",
"edge",
"at",
"the",
"given",
"value",
"U",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/crossing_edge_query.go#L362-L371 |
27,948 | golang/geo | s2/polyline_measures.go | polylineLength | func polylineLength(p []Point) s1.Angle {
var length s1.Angle
for i := 1; i < len(p); i++ {
length += p[i-1].Distance(p[i])
}
return length
} | go | func polylineLength(p []Point) s1.Angle {
var length s1.Angle
for i := 1; i < len(p); i++ {
length += p[i-1].Distance(p[i])
}
return length
} | [
"func",
"polylineLength",
"(",
"p",
"[",
"]",
"Point",
")",
"s1",
".",
"Angle",
"{",
"var",
"length",
"s1",
".",
"Angle",
"\n\n",
"for",
"i",
":=",
"1",
";",
"i",
"<",
"len",
"(",
"p",
")",
";",
"i",
"++",
"{",
"length",
"+=",
"p",
"[",
"i",
... | // polylineLength returns the length of the given Polyline.
// It returns 0 for polylines with fewer than two vertices. | [
"polylineLength",
"returns",
"the",
"length",
"of",
"the",
"given",
"Polyline",
".",
"It",
"returns",
"0",
"for",
"polylines",
"with",
"fewer",
"than",
"two",
"vertices",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polyline_measures.go#L28-L35 |
27,949 | golang/geo | s2/latlng.go | LatLngFromDegrees | func LatLngFromDegrees(lat, lng float64) LatLng {
return LatLng{s1.Angle(lat) * s1.Degree, s1.Angle(lng) * s1.Degree}
} | go | func LatLngFromDegrees(lat, lng float64) LatLng {
return LatLng{s1.Angle(lat) * s1.Degree, s1.Angle(lng) * s1.Degree}
} | [
"func",
"LatLngFromDegrees",
"(",
"lat",
",",
"lng",
"float64",
")",
"LatLng",
"{",
"return",
"LatLng",
"{",
"s1",
".",
"Angle",
"(",
"lat",
")",
"*",
"s1",
".",
"Degree",
",",
"s1",
".",
"Angle",
"(",
"lng",
")",
"*",
"s1",
".",
"Degree",
"}",
"... | // LatLngFromDegrees returns a LatLng for the coordinates given in degrees. | [
"LatLngFromDegrees",
"returns",
"a",
"LatLng",
"for",
"the",
"coordinates",
"given",
"in",
"degrees",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/latlng.go#L36-L38 |
27,950 | golang/geo | s2/latlng.go | Distance | func (ll LatLng) Distance(ll2 LatLng) s1.Angle {
// Haversine formula, as used in C++ S2LatLng::GetDistance.
lat1, lat2 := ll.Lat.Radians(), ll2.Lat.Radians()
lng1, lng2 := ll.Lng.Radians(), ll2.Lng.Radians()
dlat := math.Sin(0.5 * (lat2 - lat1))
dlng := math.Sin(0.5 * (lng2 - lng1))
x := dlat*dlat + dlng*dlng*ma... | go | func (ll LatLng) Distance(ll2 LatLng) s1.Angle {
// Haversine formula, as used in C++ S2LatLng::GetDistance.
lat1, lat2 := ll.Lat.Radians(), ll2.Lat.Radians()
lng1, lng2 := ll.Lng.Radians(), ll2.Lng.Radians()
dlat := math.Sin(0.5 * (lat2 - lat1))
dlng := math.Sin(0.5 * (lng2 - lng1))
x := dlat*dlat + dlng*dlng*ma... | [
"func",
"(",
"ll",
"LatLng",
")",
"Distance",
"(",
"ll2",
"LatLng",
")",
"s1",
".",
"Angle",
"{",
"// Haversine formula, as used in C++ S2LatLng::GetDistance.",
"lat1",
",",
"lat2",
":=",
"ll",
".",
"Lat",
".",
"Radians",
"(",
")",
",",
"ll2",
".",
"Lat",
... | // Distance returns the angle between two LatLngs. | [
"Distance",
"returns",
"the",
"angle",
"between",
"two",
"LatLngs",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/latlng.go#L61-L69 |
27,951 | golang/geo | r3/vector.go | IsUnit | func (v Vector) IsUnit() bool {
const epsilon = 5e-14
return math.Abs(v.Norm2()-1) <= epsilon
} | go | func (v Vector) IsUnit() bool {
const epsilon = 5e-14
return math.Abs(v.Norm2()-1) <= epsilon
} | [
"func",
"(",
"v",
"Vector",
")",
"IsUnit",
"(",
")",
"bool",
"{",
"const",
"epsilon",
"=",
"5e-14",
"\n",
"return",
"math",
".",
"Abs",
"(",
"v",
".",
"Norm2",
"(",
")",
"-",
"1",
")",
"<=",
"epsilon",
"\n",
"}"
] | // IsUnit returns whether this vector is of approximately unit length. | [
"IsUnit",
"returns",
"whether",
"this",
"vector",
"is",
"of",
"approximately",
"unit",
"length",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/r3/vector.go#L53-L56 |
27,952 | golang/geo | r3/vector.go | Angle | func (v Vector) Angle(ov Vector) s1.Angle {
return s1.Angle(math.Atan2(v.Cross(ov).Norm(), v.Dot(ov))) * s1.Radian
} | go | func (v Vector) Angle(ov Vector) s1.Angle {
return s1.Angle(math.Atan2(v.Cross(ov).Norm(), v.Dot(ov))) * s1.Radian
} | [
"func",
"(",
"v",
"Vector",
")",
"Angle",
"(",
"ov",
"Vector",
")",
"s1",
".",
"Angle",
"{",
"return",
"s1",
".",
"Angle",
"(",
"math",
".",
"Atan2",
"(",
"v",
".",
"Cross",
"(",
"ov",
")",
".",
"Norm",
"(",
")",
",",
"v",
".",
"Dot",
"(",
... | // Angle returns the angle between v and ov. | [
"Angle",
"returns",
"the",
"angle",
"between",
"v",
"and",
"ov",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/r3/vector.go#L86-L88 |
27,953 | golang/geo | s2/polygon.go | compareLoops | func compareLoops(a, b *Loop) int {
if na, nb := a.NumVertices(), b.NumVertices(); na != nb {
return na - nb
}
ai, aDir := a.CanonicalFirstVertex()
bi, bDir := b.CanonicalFirstVertex()
if aDir != bDir {
return aDir - bDir
}
for n := a.NumVertices() - 1; n >= 0; n, ai, bi = n-1, ai+aDir, bi+bDir {
if cmp :=... | go | func compareLoops(a, b *Loop) int {
if na, nb := a.NumVertices(), b.NumVertices(); na != nb {
return na - nb
}
ai, aDir := a.CanonicalFirstVertex()
bi, bDir := b.CanonicalFirstVertex()
if aDir != bDir {
return aDir - bDir
}
for n := a.NumVertices() - 1; n >= 0; n, ai, bi = n-1, ai+aDir, bi+bDir {
if cmp :=... | [
"func",
"compareLoops",
"(",
"a",
",",
"b",
"*",
"Loop",
")",
"int",
"{",
"if",
"na",
",",
"nb",
":=",
"a",
".",
"NumVertices",
"(",
")",
",",
"b",
".",
"NumVertices",
"(",
")",
";",
"na",
"!=",
"nb",
"{",
"return",
"na",
"-",
"nb",
"\n",
"}"... | // Defines a total ordering on Loops that does not depend on the cyclic
// order of loop vertices. This function is used to choose which loop to
// invert in the case where several loops have exactly the same area. | [
"Defines",
"a",
"total",
"ordering",
"on",
"Loops",
"that",
"does",
"not",
"depend",
"on",
"the",
"cyclic",
"order",
"of",
"loop",
"vertices",
".",
"This",
"function",
"is",
"used",
"to",
"choose",
"which",
"loop",
"to",
"invert",
"in",
"the",
"case",
"w... | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L254-L269 |
27,954 | golang/geo | s2/polygon.go | insertLoop | func (lm loopMap) insertLoop(newLoop, parent *Loop) {
var children []*Loop
for done := false; !done; {
children = lm[parent]
done = true
for _, child := range children {
if child.ContainsNested(newLoop) {
parent = child
done = false
break
}
}
}
// Now, we have found a parent for this loop... | go | func (lm loopMap) insertLoop(newLoop, parent *Loop) {
var children []*Loop
for done := false; !done; {
children = lm[parent]
done = true
for _, child := range children {
if child.ContainsNested(newLoop) {
parent = child
done = false
break
}
}
}
// Now, we have found a parent for this loop... | [
"func",
"(",
"lm",
"loopMap",
")",
"insertLoop",
"(",
"newLoop",
",",
"parent",
"*",
"Loop",
")",
"{",
"var",
"children",
"[",
"]",
"*",
"Loop",
"\n",
"for",
"done",
":=",
"false",
";",
"!",
"done",
";",
"{",
"children",
"=",
"lm",
"[",
"parent",
... | // insertLoop adds the given loop to the loop map under the specified parent.
// All children of the new entry are checked to see if the need to move up to
// a different level. | [
"insertLoop",
"adds",
"the",
"given",
"loop",
"to",
"the",
"loop",
"map",
"under",
"the",
"specified",
"parent",
".",
"All",
"children",
"of",
"the",
"new",
"entry",
"are",
"checked",
"to",
"see",
"if",
"the",
"need",
"to",
"move",
"up",
"to",
"a",
"di... | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L305-L334 |
27,955 | golang/geo | s2/polygon.go | initLoops | func (p *Polygon) initLoops(lm loopMap) {
var stack loopStack
stack.push(nil)
depth := -1
for len(stack) > 0 {
loop := stack.pop()
if loop != nil {
depth = loop.depth
p.loops = append(p.loops, loop)
}
children := lm[loop]
for i := len(children) - 1; i >= 0; i-- {
child := children[i]
child.de... | go | func (p *Polygon) initLoops(lm loopMap) {
var stack loopStack
stack.push(nil)
depth := -1
for len(stack) > 0 {
loop := stack.pop()
if loop != nil {
depth = loop.depth
p.loops = append(p.loops, loop)
}
children := lm[loop]
for i := len(children) - 1; i >= 0; i-- {
child := children[i]
child.de... | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"initLoops",
"(",
"lm",
"loopMap",
")",
"{",
"var",
"stack",
"loopStack",
"\n",
"stack",
".",
"push",
"(",
"nil",
")",
"\n",
"depth",
":=",
"-",
"1",
"\n\n",
"for",
"len",
"(",
"stack",
")",
">",
"0",
"{",
... | // initLoops walks the mapping of loops to all of their children, and adds them in
// order into to the polygons set of loops. | [
"initLoops",
"walks",
"the",
"mapping",
"of",
"loops",
"to",
"all",
"of",
"their",
"children",
"and",
"adds",
"them",
"in",
"order",
"into",
"to",
"the",
"polygons",
"set",
"of",
"loops",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L351-L369 |
27,956 | golang/geo | s2/polygon.go | initLoopProperties | func (p *Polygon) initLoopProperties() {
// the loops depths are set by initNested/initOriented prior to this.
p.hasHoles = false
for _, l := range p.loops {
if l.IsHole() {
p.hasHoles = true
} else {
p.bound = p.bound.Union(l.RectBound())
}
p.numVertices += l.NumVertices()
}
p.subregionBound = Expa... | go | func (p *Polygon) initLoopProperties() {
// the loops depths are set by initNested/initOriented prior to this.
p.hasHoles = false
for _, l := range p.loops {
if l.IsHole() {
p.hasHoles = true
} else {
p.bound = p.bound.Union(l.RectBound())
}
p.numVertices += l.NumVertices()
}
p.subregionBound = Expa... | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"initLoopProperties",
"(",
")",
"{",
"// the loops depths are set by initNested/initOriented prior to this.",
"p",
".",
"hasHoles",
"=",
"false",
"\n",
"for",
"_",
",",
"l",
":=",
"range",
"p",
".",
"loops",
"{",
"if",
"l... | // initLoopProperties sets the properties for polygons with multiple loops. | [
"initLoopProperties",
"sets",
"the",
"properties",
"for",
"polygons",
"with",
"multiple",
"loops",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L385-L400 |
27,957 | golang/geo | s2/polygon.go | initEdgesAndIndex | func (p *Polygon) initEdgesAndIndex() {
if p.IsFull() {
return
}
const maxLinearSearchLoops = 12 // Based on benchmarks.
if len(p.loops) > maxLinearSearchLoops {
p.cumulativeEdges = make([]int, 0, len(p.loops))
}
for _, l := range p.loops {
if p.cumulativeEdges != nil {
p.cumulativeEdges = append(p.cumu... | go | func (p *Polygon) initEdgesAndIndex() {
if p.IsFull() {
return
}
const maxLinearSearchLoops = 12 // Based on benchmarks.
if len(p.loops) > maxLinearSearchLoops {
p.cumulativeEdges = make([]int, 0, len(p.loops))
}
for _, l := range p.loops {
if p.cumulativeEdges != nil {
p.cumulativeEdges = append(p.cumu... | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"initEdgesAndIndex",
"(",
")",
"{",
"if",
"p",
".",
"IsFull",
"(",
")",
"{",
"return",
"\n",
"}",
"\n",
"const",
"maxLinearSearchLoops",
"=",
"12",
"// Based on benchmarks.",
"\n",
"if",
"len",
"(",
"p",
".",
"loo... | // initEdgesAndIndex performs the shape related initializations and adds the final
// polygon to the index. | [
"initEdgesAndIndex",
"performs",
"the",
"shape",
"related",
"initializations",
"and",
"adds",
"the",
"final",
"polygon",
"to",
"the",
"index",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L404-L422 |
27,958 | golang/geo | s2/polygon.go | FullPolygon | func FullPolygon() *Polygon {
ret := &Polygon{
loops: []*Loop{
FullLoop(),
},
numVertices: len(FullLoop().Vertices()),
bound: FullRect(),
subregionBound: FullRect(),
}
ret.initEdgesAndIndex()
return ret
} | go | func FullPolygon() *Polygon {
ret := &Polygon{
loops: []*Loop{
FullLoop(),
},
numVertices: len(FullLoop().Vertices()),
bound: FullRect(),
subregionBound: FullRect(),
}
ret.initEdgesAndIndex()
return ret
} | [
"func",
"FullPolygon",
"(",
")",
"*",
"Polygon",
"{",
"ret",
":=",
"&",
"Polygon",
"{",
"loops",
":",
"[",
"]",
"*",
"Loop",
"{",
"FullLoop",
"(",
")",
",",
"}",
",",
"numVertices",
":",
"len",
"(",
"FullLoop",
"(",
")",
".",
"Vertices",
"(",
")"... | // FullPolygon returns a special "full" polygon. | [
"FullPolygon",
"returns",
"a",
"special",
"full",
"polygon",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L425-L436 |
27,959 | golang/geo | s2/polygon.go | Validate | func (p *Polygon) Validate() error {
for i, l := range p.loops {
// Check for loop errors that don't require building a ShapeIndex.
if err := l.findValidationErrorNoIndex(); err != nil {
return fmt.Errorf("loop %d: %v", i, err)
}
// Check that no loop is empty, and that the full loop only appears in the
/... | go | func (p *Polygon) Validate() error {
for i, l := range p.loops {
// Check for loop errors that don't require building a ShapeIndex.
if err := l.findValidationErrorNoIndex(); err != nil {
return fmt.Errorf("loop %d: %v", i, err)
}
// Check that no loop is empty, and that the full loop only appears in the
/... | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"Validate",
"(",
")",
"error",
"{",
"for",
"i",
",",
"l",
":=",
"range",
"p",
".",
"loops",
"{",
"// Check for loop errors that don't require building a ShapeIndex.",
"if",
"err",
":=",
"l",
".",
"findValidationErrorNoIndex... | // Validate checks whether this is a valid polygon,
// including checking whether all the loops are themselves valid. | [
"Validate",
"checks",
"whether",
"this",
"is",
"a",
"valid",
"polygon",
"including",
"checking",
"whether",
"all",
"the",
"loops",
"are",
"themselves",
"valid",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L440-L471 |
27,960 | golang/geo | s2/polygon.go | findLoopNestingError | func (p *Polygon) findLoopNestingError() error {
// First check that the loop depths make sense.
lastDepth := -1
for i, l := range p.loops {
depth := l.depth
if depth < 0 || depth > lastDepth+1 {
return fmt.Errorf("loop %d: invalid loop depth (%d)", i, depth)
}
lastDepth = depth
}
// Then check that the... | go | func (p *Polygon) findLoopNestingError() error {
// First check that the loop depths make sense.
lastDepth := -1
for i, l := range p.loops {
depth := l.depth
if depth < 0 || depth > lastDepth+1 {
return fmt.Errorf("loop %d: invalid loop depth (%d)", i, depth)
}
lastDepth = depth
}
// Then check that the... | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"findLoopNestingError",
"(",
")",
"error",
"{",
"// First check that the loop depths make sense.",
"lastDepth",
":=",
"-",
"1",
"\n",
"for",
"i",
",",
"l",
":=",
"range",
"p",
".",
"loops",
"{",
"depth",
":=",
"l",
".... | // findLoopNestingError reports if there is an error in the loop nesting hierarchy. | [
"findLoopNestingError",
"reports",
"if",
"there",
"is",
"an",
"error",
"in",
"the",
"loop",
"nesting",
"hierarchy",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L474-L505 |
27,961 | golang/geo | s2/polygon.go | Parent | func (p *Polygon) Parent(k int) (index int, ok bool) {
// See where we are on the depth hierarchy.
depth := p.loops[k].depth
if depth == 0 {
return -1, false
}
// There may be several loops at the same nesting level as us that share a
// parent loop with us. (Imagine a slice of swiss cheese, of which we are on... | go | func (p *Polygon) Parent(k int) (index int, ok bool) {
// See where we are on the depth hierarchy.
depth := p.loops[k].depth
if depth == 0 {
return -1, false
}
// There may be several loops at the same nesting level as us that share a
// parent loop with us. (Imagine a slice of swiss cheese, of which we are on... | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"Parent",
"(",
"k",
"int",
")",
"(",
"index",
"int",
",",
"ok",
"bool",
")",
"{",
"// See where we are on the depth hierarchy.",
"depth",
":=",
"p",
".",
"loops",
"[",
"k",
"]",
".",
"depth",
"\n",
"if",
"depth",
... | // Parent returns the index of the parent of loop k.
// If the loop does not have a parent, ok=false is returned. | [
"Parent",
"returns",
"the",
"index",
"of",
"the",
"parent",
"of",
"loop",
"k",
".",
"If",
"the",
"loop",
"does",
"not",
"have",
"a",
"parent",
"ok",
"=",
"false",
"is",
"returned",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L539-L554 |
27,962 | golang/geo | s2/polygon.go | ContainsPoint | func (p *Polygon) ContainsPoint(point Point) bool {
// NOTE: A bounds check slows down this function by about 50%. It is
// worthwhile only when it might allow us to delay building the index.
if !p.index.IsFresh() && !p.bound.ContainsPoint(point) {
return false
}
// For small polygons, and during initial constr... | go | func (p *Polygon) ContainsPoint(point Point) bool {
// NOTE: A bounds check slows down this function by about 50%. It is
// worthwhile only when it might allow us to delay building the index.
if !p.index.IsFresh() && !p.bound.ContainsPoint(point) {
return false
}
// For small polygons, and during initial constr... | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"ContainsPoint",
"(",
"point",
"Point",
")",
"bool",
"{",
"// NOTE: A bounds check slows down this function by about 50%. It is",
"// worthwhile only when it might allow us to delay building the index.",
"if",
"!",
"p",
".",
"index",
"."... | // ContainsPoint reports whether the polygon contains the point. | [
"ContainsPoint",
"reports",
"whether",
"the",
"polygon",
"contains",
"the",
"point",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L584-L610 |
27,963 | golang/geo | s2/polygon.go | ContainsCell | func (p *Polygon) ContainsCell(cell Cell) bool {
it := p.index.Iterator()
relation := it.LocateCellID(cell.ID())
// If "cell" is disjoint from all index cells, it is not contained.
// Similarly, if "cell" is subdivided into one or more index cells then it
// is not contained, since index cells are subdivided only... | go | func (p *Polygon) ContainsCell(cell Cell) bool {
it := p.index.Iterator()
relation := it.LocateCellID(cell.ID())
// If "cell" is disjoint from all index cells, it is not contained.
// Similarly, if "cell" is subdivided into one or more index cells then it
// is not contained, since index cells are subdivided only... | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"ContainsCell",
"(",
"cell",
"Cell",
")",
"bool",
"{",
"it",
":=",
"p",
".",
"index",
".",
"Iterator",
"(",
")",
"\n",
"relation",
":=",
"it",
".",
"LocateCellID",
"(",
"cell",
".",
"ID",
"(",
")",
")",
"\n\... | // ContainsCell reports whether the polygon contains the given cell. | [
"ContainsCell",
"reports",
"whether",
"the",
"polygon",
"contains",
"the",
"given",
"cell",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L613-L634 |
27,964 | golang/geo | s2/polygon.go | IntersectsCell | func (p *Polygon) IntersectsCell(cell Cell) bool {
it := p.index.Iterator()
relation := it.LocateCellID(cell.ID())
// If cell does not overlap any index cell, there is no intersection.
if relation == Disjoint {
return false
}
// If cell is subdivided into one or more index cells, there is an
// intersection t... | go | func (p *Polygon) IntersectsCell(cell Cell) bool {
it := p.index.Iterator()
relation := it.LocateCellID(cell.ID())
// If cell does not overlap any index cell, there is no intersection.
if relation == Disjoint {
return false
}
// If cell is subdivided into one or more index cells, there is an
// intersection t... | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"IntersectsCell",
"(",
"cell",
"Cell",
")",
"bool",
"{",
"it",
":=",
"p",
".",
"index",
".",
"Iterator",
"(",
")",
"\n",
"relation",
":=",
"it",
".",
"LocateCellID",
"(",
"cell",
".",
"ID",
"(",
")",
")",
"\... | // IntersectsCell reports whether the polygon intersects the given cell. | [
"IntersectsCell",
"reports",
"whether",
"the",
"polygon",
"intersects",
"the",
"given",
"cell",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L637-L662 |
27,965 | golang/geo | s2/polygon.go | iteratorContainsPoint | func (p *Polygon) iteratorContainsPoint(it *ShapeIndexIterator, point Point) bool {
// Test containment by drawing a line segment from the cell center to the
// given point and counting edge crossings.
aClipped := it.IndexCell().findByShapeID(0)
inside := aClipped.containsCenter
if len(aClipped.edges) == 0 {
re... | go | func (p *Polygon) iteratorContainsPoint(it *ShapeIndexIterator, point Point) bool {
// Test containment by drawing a line segment from the cell center to the
// given point and counting edge crossings.
aClipped := it.IndexCell().findByShapeID(0)
inside := aClipped.containsCenter
if len(aClipped.edges) == 0 {
re... | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"iteratorContainsPoint",
"(",
"it",
"*",
"ShapeIndexIterator",
",",
"point",
"Point",
")",
"bool",
"{",
"// Test containment by drawing a line segment from the cell center to the",
"// given point and counting edge crossings.",
"aClipped",... | // iteratorContainsPoint reports whether the iterator that is positioned at the
// ShapeIndexCell that may contain p, contains the point p. | [
"iteratorContainsPoint",
"reports",
"whether",
"the",
"iterator",
"that",
"is",
"positioned",
"at",
"the",
"ShapeIndexCell",
"that",
"may",
"contain",
"p",
"contains",
"the",
"point",
"p",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L704-L723 |
27,966 | golang/geo | s2/polygon.go | ReferencePoint | func (p *Polygon) ReferencePoint() ReferencePoint {
containsOrigin := false
for _, l := range p.loops {
containsOrigin = containsOrigin != l.ContainsOrigin()
}
return OriginReferencePoint(containsOrigin)
} | go | func (p *Polygon) ReferencePoint() ReferencePoint {
containsOrigin := false
for _, l := range p.loops {
containsOrigin = containsOrigin != l.ContainsOrigin()
}
return OriginReferencePoint(containsOrigin)
} | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"ReferencePoint",
"(",
")",
"ReferencePoint",
"{",
"containsOrigin",
":=",
"false",
"\n",
"for",
"_",
",",
"l",
":=",
"range",
"p",
".",
"loops",
"{",
"containsOrigin",
"=",
"containsOrigin",
"!=",
"l",
".",
"Contai... | // ReferencePoint returns the reference point for this polygon. | [
"ReferencePoint",
"returns",
"the",
"reference",
"point",
"for",
"this",
"polygon",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L755-L761 |
27,967 | golang/geo | s2/polygon.go | Contains | func (p *Polygon) Contains(o *Polygon) bool {
// If both polygons have one loop, use the more efficient Loop method.
// Note that Loop's Contains does its own bounding rectangle check.
if len(p.loops) == 1 && len(o.loops) == 1 {
return p.loops[0].Contains(o.loops[0])
}
// Otherwise if neither polygon has holes,... | go | func (p *Polygon) Contains(o *Polygon) bool {
// If both polygons have one loop, use the more efficient Loop method.
// Note that Loop's Contains does its own bounding rectangle check.
if len(p.loops) == 1 && len(o.loops) == 1 {
return p.loops[0].Contains(o.loops[0])
}
// Otherwise if neither polygon has holes,... | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"Contains",
"(",
"o",
"*",
"Polygon",
")",
"bool",
"{",
"// If both polygons have one loop, use the more efficient Loop method.",
"// Note that Loop's Contains does its own bounding rectangle check.",
"if",
"len",
"(",
"p",
".",
"loops... | // Contains reports whether this polygon contains the other polygon.
// Specifically, it reports whether all the points in the other polygon
// are also in this polygon. | [
"Contains",
"reports",
"whether",
"this",
"polygon",
"contains",
"the",
"other",
"polygon",
".",
"Specifically",
"it",
"reports",
"whether",
"all",
"the",
"points",
"in",
"the",
"other",
"polygon",
"are",
"also",
"in",
"this",
"polygon",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L822-L861 |
27,968 | golang/geo | s2/polygon.go | Intersects | func (p *Polygon) Intersects(o *Polygon) bool {
// If both polygons have one loop, use the more efficient Loop method.
// Note that Loop Intersects does its own bounding rectangle check.
if len(p.loops) == 1 && len(o.loops) == 1 {
return p.loops[0].Intersects(o.loops[0])
}
// Otherwise if neither polygon has ho... | go | func (p *Polygon) Intersects(o *Polygon) bool {
// If both polygons have one loop, use the more efficient Loop method.
// Note that Loop Intersects does its own bounding rectangle check.
if len(p.loops) == 1 && len(o.loops) == 1 {
return p.loops[0].Intersects(o.loops[0])
}
// Otherwise if neither polygon has ho... | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"Intersects",
"(",
"o",
"*",
"Polygon",
")",
"bool",
"{",
"// If both polygons have one loop, use the more efficient Loop method.",
"// Note that Loop Intersects does its own bounding rectangle check.",
"if",
"len",
"(",
"p",
".",
"loo... | // Intersects reports whether this polygon intersects the other polygon, i.e.
// if there is a point that is contained by both polygons. | [
"Intersects",
"reports",
"whether",
"this",
"polygon",
"intersects",
"the",
"other",
"polygon",
"i",
".",
"e",
".",
"if",
"there",
"is",
"a",
"point",
"that",
"is",
"contained",
"by",
"both",
"polygons",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L865-L894 |
27,969 | golang/geo | s2/polygon.go | compareBoundary | func (p *Polygon) compareBoundary(o *Loop) int {
result := -1
for i := 0; i < len(p.loops) && result != 0; i++ {
// If B crosses any loop of A, the result is 0. Otherwise the result
// changes sign each time B is contained by a loop of A.
result *= -p.loops[i].compareBoundary(o)
}
return result
} | go | func (p *Polygon) compareBoundary(o *Loop) int {
result := -1
for i := 0; i < len(p.loops) && result != 0; i++ {
// If B crosses any loop of A, the result is 0. Otherwise the result
// changes sign each time B is contained by a loop of A.
result *= -p.loops[i].compareBoundary(o)
}
return result
} | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"compareBoundary",
"(",
"o",
"*",
"Loop",
")",
"int",
"{",
"result",
":=",
"-",
"1",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"p",
".",
"loops",
")",
"&&",
"result",
"!=",
"0",
";",
"i",
... | // compareBoundary returns +1 if this polygon contains the boundary of B, -1 if A
// excludes the boundary of B, and 0 if the boundaries of A and B cross. | [
"compareBoundary",
"returns",
"+",
"1",
"if",
"this",
"polygon",
"contains",
"the",
"boundary",
"of",
"B",
"-",
"1",
"if",
"A",
"excludes",
"the",
"boundary",
"of",
"B",
"and",
"0",
"if",
"the",
"boundaries",
"of",
"A",
"and",
"B",
"cross",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L898-L906 |
27,970 | golang/geo | s2/polygon.go | containsBoundary | func (p *Polygon) containsBoundary(o *Polygon) bool {
for _, l := range o.loops {
if p.compareBoundary(l) <= 0 {
return false
}
}
return true
} | go | func (p *Polygon) containsBoundary(o *Polygon) bool {
for _, l := range o.loops {
if p.compareBoundary(l) <= 0 {
return false
}
}
return true
} | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"containsBoundary",
"(",
"o",
"*",
"Polygon",
")",
"bool",
"{",
"for",
"_",
",",
"l",
":=",
"range",
"o",
".",
"loops",
"{",
"if",
"p",
".",
"compareBoundary",
"(",
"l",
")",
"<=",
"0",
"{",
"return",
"false... | // containsBoundary reports whether this polygon contains the entire boundary of B. | [
"containsBoundary",
"reports",
"whether",
"this",
"polygon",
"contains",
"the",
"entire",
"boundary",
"of",
"B",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L909-L916 |
27,971 | golang/geo | s2/polygon.go | containsNonCrossingBoundary | func (p *Polygon) containsNonCrossingBoundary(o *Loop, reverse bool) bool {
var inside bool
for _, l := range p.loops {
x := l.containsNonCrossingBoundary(o, reverse)
inside = (inside != x)
}
return inside
} | go | func (p *Polygon) containsNonCrossingBoundary(o *Loop, reverse bool) bool {
var inside bool
for _, l := range p.loops {
x := l.containsNonCrossingBoundary(o, reverse)
inside = (inside != x)
}
return inside
} | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"containsNonCrossingBoundary",
"(",
"o",
"*",
"Loop",
",",
"reverse",
"bool",
")",
"bool",
"{",
"var",
"inside",
"bool",
"\n",
"for",
"_",
",",
"l",
":=",
"range",
"p",
".",
"loops",
"{",
"x",
":=",
"l",
".",
... | // containsNonCrossingBoundary reports whether polygon A contains the boundary of
// loop B. Shared edges are handled according to the rule described in loops
// containsNonCrossingBoundary. | [
"containsNonCrossingBoundary",
"reports",
"whether",
"polygon",
"A",
"contains",
"the",
"boundary",
"of",
"loop",
"B",
".",
"Shared",
"edges",
"are",
"handled",
"according",
"to",
"the",
"rule",
"described",
"in",
"loops",
"containsNonCrossingBoundary",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L931-L938 |
27,972 | golang/geo | s2/polygon.go | excludesNonCrossingShells | func (p *Polygon) excludesNonCrossingShells(o *Polygon) bool {
for _, l := range o.loops {
if l.IsHole() {
continue
}
if p.containsNonCrossingBoundary(l, false) {
return false
}
}
return true
} | go | func (p *Polygon) excludesNonCrossingShells(o *Polygon) bool {
for _, l := range o.loops {
if l.IsHole() {
continue
}
if p.containsNonCrossingBoundary(l, false) {
return false
}
}
return true
} | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"excludesNonCrossingShells",
"(",
"o",
"*",
"Polygon",
")",
"bool",
"{",
"for",
"_",
",",
"l",
":=",
"range",
"o",
".",
"loops",
"{",
"if",
"l",
".",
"IsHole",
"(",
")",
"{",
"continue",
"\n",
"}",
"\n",
"if... | // excludesNonCrossingShells reports wheterh given two polygons A and B such that the
// boundary of A does not cross any loop of B, if A excludes all shell boundaries of B. | [
"excludesNonCrossingShells",
"reports",
"wheterh",
"given",
"two",
"polygons",
"A",
"and",
"B",
"such",
"that",
"the",
"boundary",
"of",
"A",
"does",
"not",
"cross",
"any",
"loop",
"of",
"B",
"if",
"A",
"excludes",
"all",
"shell",
"boundaries",
"of",
"B",
... | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L942-L952 |
27,973 | golang/geo | s2/polygon.go | excludesNonCrossingComplementShells | func (p *Polygon) excludesNonCrossingComplementShells(o *Polygon) bool {
// Special case to handle the complement of the empty or full polygons.
if o.IsEmpty() {
return !p.IsFull()
}
if o.IsFull() {
return true
}
// Otherwise the complement of B may be obtained by inverting loop(0) and
// then swapping the ... | go | func (p *Polygon) excludesNonCrossingComplementShells(o *Polygon) bool {
// Special case to handle the complement of the empty or full polygons.
if o.IsEmpty() {
return !p.IsFull()
}
if o.IsFull() {
return true
}
// Otherwise the complement of B may be obtained by inverting loop(0) and
// then swapping the ... | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"excludesNonCrossingComplementShells",
"(",
"o",
"*",
"Polygon",
")",
"bool",
"{",
"// Special case to handle the complement of the empty or full polygons.",
"if",
"o",
".",
"IsEmpty",
"(",
")",
"{",
"return",
"!",
"p",
".",
... | // excludesNonCrossingComplementShells reports whether given two polygons A and B
// such that the boundary of A does not cross any loop of B, if A excludes all
// shell boundaries of the complement of B. | [
"excludesNonCrossingComplementShells",
"reports",
"whether",
"given",
"two",
"polygons",
"A",
"and",
"B",
"such",
"that",
"the",
"boundary",
"of",
"A",
"does",
"not",
"cross",
"any",
"loop",
"of",
"B",
"if",
"A",
"excludes",
"all",
"shell",
"boundaries",
"of",... | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L957-L982 |
27,974 | golang/geo | s2/polygon.go | anyLoopContains | func (p *Polygon) anyLoopContains(o *Loop) bool {
for _, l := range p.loops {
if l.Contains(o) {
return true
}
}
return false
} | go | func (p *Polygon) anyLoopContains(o *Loop) bool {
for _, l := range p.loops {
if l.Contains(o) {
return true
}
}
return false
} | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"anyLoopContains",
"(",
"o",
"*",
"Loop",
")",
"bool",
"{",
"for",
"_",
",",
"l",
":=",
"range",
"p",
".",
"loops",
"{",
"if",
"l",
".",
"Contains",
"(",
"o",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
... | // anyLoopContains reports whether any loop in this polygon contains the given loop. | [
"anyLoopContains",
"reports",
"whether",
"any",
"loop",
"in",
"this",
"polygon",
"contains",
"the",
"given",
"loop",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L985-L992 |
27,975 | golang/geo | s2/polygon.go | anyLoopIntersects | func (p *Polygon) anyLoopIntersects(o *Loop) bool {
for _, l := range p.loops {
if l.Intersects(o) {
return true
}
}
return false
} | go | func (p *Polygon) anyLoopIntersects(o *Loop) bool {
for _, l := range p.loops {
if l.Intersects(o) {
return true
}
}
return false
} | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"anyLoopIntersects",
"(",
"o",
"*",
"Loop",
")",
"bool",
"{",
"for",
"_",
",",
"l",
":=",
"range",
"p",
".",
"loops",
"{",
"if",
"l",
".",
"Intersects",
"(",
"o",
")",
"{",
"return",
"true",
"\n",
"}",
"\n... | // anyLoopIntersects reports whether any loop in this polygon intersects the given loop. | [
"anyLoopIntersects",
"reports",
"whether",
"any",
"loop",
"in",
"this",
"polygon",
"intersects",
"the",
"given",
"loop",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L995-L1002 |
27,976 | golang/geo | s2/polygon.go | encode | func (p *Polygon) encode(e *encoder) {
if p.numVertices == 0 {
p.encodeCompressed(e, maxLevel, nil)
return
}
// Convert all the polygon vertices to XYZFaceSiTi format.
vs := make([]xyzFaceSiTi, 0, p.numVertices)
for _, l := range p.loops {
vs = append(vs, l.xyzFaceSiTiVertices()...)
}
// Computes a histo... | go | func (p *Polygon) encode(e *encoder) {
if p.numVertices == 0 {
p.encodeCompressed(e, maxLevel, nil)
return
}
// Convert all the polygon vertices to XYZFaceSiTi format.
vs := make([]xyzFaceSiTi, 0, p.numVertices)
for _, l := range p.loops {
vs = append(vs, l.xyzFaceSiTiVertices()...)
}
// Computes a histo... | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"encode",
"(",
"e",
"*",
"encoder",
")",
"{",
"if",
"p",
".",
"numVertices",
"==",
"0",
"{",
"p",
".",
"encodeCompressed",
"(",
"e",
",",
"maxLevel",
",",
"nil",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// C... | // encode only supports lossless encoding and not compressed format. | [
"encode",
"only",
"supports",
"lossless",
"encoding",
"and",
"not",
"compressed",
"format",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L1022-L1065 |
27,977 | golang/geo | s2/polygon.go | encodeLossless | func (p *Polygon) encodeLossless(e *encoder) {
e.writeInt8(encodingVersion)
e.writeBool(true) // a legacy c++ value. must be true.
e.writeBool(p.hasHoles)
e.writeUint32(uint32(len(p.loops)))
if e.err != nil {
return
}
if len(p.loops) > maxEncodedLoops {
e.err = fmt.Errorf("too many loops (%d; max is %d)", l... | go | func (p *Polygon) encodeLossless(e *encoder) {
e.writeInt8(encodingVersion)
e.writeBool(true) // a legacy c++ value. must be true.
e.writeBool(p.hasHoles)
e.writeUint32(uint32(len(p.loops)))
if e.err != nil {
return
}
if len(p.loops) > maxEncodedLoops {
e.err = fmt.Errorf("too many loops (%d; max is %d)", l... | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"encodeLossless",
"(",
"e",
"*",
"encoder",
")",
"{",
"e",
".",
"writeInt8",
"(",
"encodingVersion",
")",
"\n",
"e",
".",
"writeBool",
"(",
"true",
")",
"// a legacy c++ value. must be true.",
"\n",
"e",
".",
"writeBo... | // encodeLossless encodes the polygon's Points as float64s. | [
"encodeLossless",
"encodes",
"the",
"polygon",
"s",
"Points",
"as",
"float64s",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L1068-L1087 |
27,978 | golang/geo | s2/polygon.go | Decode | func (p *Polygon) Decode(r io.Reader) error {
d := &decoder{r: asByteReader(r)}
version := int8(d.readUint8())
var dec func(*decoder)
switch version {
case encodingVersion:
dec = p.decode
case encodingCompressedVersion:
dec = p.decodeCompressed
default:
return fmt.Errorf("unsupported version %d", version)
... | go | func (p *Polygon) Decode(r io.Reader) error {
d := &decoder{r: asByteReader(r)}
version := int8(d.readUint8())
var dec func(*decoder)
switch version {
case encodingVersion:
dec = p.decode
case encodingCompressedVersion:
dec = p.decodeCompressed
default:
return fmt.Errorf("unsupported version %d", version)
... | [
"func",
"(",
"p",
"*",
"Polygon",
")",
"Decode",
"(",
"r",
"io",
".",
"Reader",
")",
"error",
"{",
"d",
":=",
"&",
"decoder",
"{",
"r",
":",
"asByteReader",
"(",
"r",
")",
"}",
"\n",
"version",
":=",
"int8",
"(",
"d",
".",
"readUint8",
"(",
")"... | // Decode decodes the Polygon. | [
"Decode",
"decodes",
"the",
"Polygon",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/polygon.go#L1112-L1126 |
27,979 | golang/geo | s2/rect.go | RectFromLatLng | func RectFromLatLng(p LatLng) Rect {
return Rect{
Lat: r1.Interval{p.Lat.Radians(), p.Lat.Radians()},
Lng: s1.Interval{p.Lng.Radians(), p.Lng.Radians()},
}
} | go | func RectFromLatLng(p LatLng) Rect {
return Rect{
Lat: r1.Interval{p.Lat.Radians(), p.Lat.Radians()},
Lng: s1.Interval{p.Lng.Radians(), p.Lng.Radians()},
}
} | [
"func",
"RectFromLatLng",
"(",
"p",
"LatLng",
")",
"Rect",
"{",
"return",
"Rect",
"{",
"Lat",
":",
"r1",
".",
"Interval",
"{",
"p",
".",
"Lat",
".",
"Radians",
"(",
")",
",",
"p",
".",
"Lat",
".",
"Radians",
"(",
")",
"}",
",",
"Lng",
":",
"s1"... | // RectFromLatLng constructs a rectangle containing a single point p. | [
"RectFromLatLng",
"constructs",
"a",
"rectangle",
"containing",
"a",
"single",
"point",
"p",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/rect.go#L45-L50 |
27,980 | golang/geo | s2/rect.go | Lo | func (r Rect) Lo() LatLng {
return LatLng{s1.Angle(r.Lat.Lo) * s1.Radian, s1.Angle(r.Lng.Lo) * s1.Radian}
} | go | func (r Rect) Lo() LatLng {
return LatLng{s1.Angle(r.Lat.Lo) * s1.Radian, s1.Angle(r.Lng.Lo) * s1.Radian}
} | [
"func",
"(",
"r",
"Rect",
")",
"Lo",
"(",
")",
"LatLng",
"{",
"return",
"LatLng",
"{",
"s1",
".",
"Angle",
"(",
"r",
".",
"Lat",
".",
"Lo",
")",
"*",
"s1",
".",
"Radian",
",",
"s1",
".",
"Angle",
"(",
"r",
".",
"Lng",
".",
"Lo",
")",
"*",
... | // Lo returns one corner of the rectangle. | [
"Lo",
"returns",
"one",
"corner",
"of",
"the",
"rectangle",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/rect.go#L108-L110 |
27,981 | golang/geo | s2/rect.go | Size | func (r Rect) Size() LatLng {
return LatLng{s1.Angle(r.Lat.Length()) * s1.Radian, s1.Angle(r.Lng.Length()) * s1.Radian}
} | go | func (r Rect) Size() LatLng {
return LatLng{s1.Angle(r.Lat.Length()) * s1.Radian, s1.Angle(r.Lng.Length()) * s1.Radian}
} | [
"func",
"(",
"r",
"Rect",
")",
"Size",
"(",
")",
"LatLng",
"{",
"return",
"LatLng",
"{",
"s1",
".",
"Angle",
"(",
"r",
".",
"Lat",
".",
"Length",
"(",
")",
")",
"*",
"s1",
".",
"Radian",
",",
"s1",
".",
"Angle",
"(",
"r",
".",
"Lng",
".",
"... | // Size returns the size of the Rect. | [
"Size",
"returns",
"the",
"size",
"of",
"the",
"Rect",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/rect.go#L123-L125 |
27,982 | golang/geo | s2/rect.go | Area | func (r Rect) Area() float64 {
if r.IsEmpty() {
return 0
}
capDiff := math.Abs(math.Sin(r.Lat.Hi) - math.Sin(r.Lat.Lo))
return r.Lng.Length() * capDiff
} | go | func (r Rect) Area() float64 {
if r.IsEmpty() {
return 0
}
capDiff := math.Abs(math.Sin(r.Lat.Hi) - math.Sin(r.Lat.Lo))
return r.Lng.Length() * capDiff
} | [
"func",
"(",
"r",
"Rect",
")",
"Area",
"(",
")",
"float64",
"{",
"if",
"r",
".",
"IsEmpty",
"(",
")",
"{",
"return",
"0",
"\n",
"}",
"\n",
"capDiff",
":=",
"math",
".",
"Abs",
"(",
"math",
".",
"Sin",
"(",
"r",
".",
"Lat",
".",
"Hi",
")",
"... | // Area returns the surface area of the Rect. | [
"Area",
"returns",
"the",
"surface",
"area",
"of",
"the",
"Rect",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/rect.go#L128-L134 |
27,983 | golang/geo | s2/rect.go | AddPoint | func (r Rect) AddPoint(ll LatLng) Rect {
if !ll.IsValid() {
return r
}
return Rect{
Lat: r.Lat.AddPoint(ll.Lat.Radians()),
Lng: r.Lng.AddPoint(ll.Lng.Radians()),
}
} | go | func (r Rect) AddPoint(ll LatLng) Rect {
if !ll.IsValid() {
return r
}
return Rect{
Lat: r.Lat.AddPoint(ll.Lat.Radians()),
Lng: r.Lng.AddPoint(ll.Lng.Radians()),
}
} | [
"func",
"(",
"r",
"Rect",
")",
"AddPoint",
"(",
"ll",
"LatLng",
")",
"Rect",
"{",
"if",
"!",
"ll",
".",
"IsValid",
"(",
")",
"{",
"return",
"r",
"\n",
"}",
"\n",
"return",
"Rect",
"{",
"Lat",
":",
"r",
".",
"Lat",
".",
"AddPoint",
"(",
"ll",
... | // AddPoint increases the size of the rectangle to include the given point. | [
"AddPoint",
"increases",
"the",
"size",
"of",
"the",
"rectangle",
"to",
"include",
"the",
"given",
"point",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/rect.go#L137-L145 |
27,984 | golang/geo | s2/rect.go | PolarClosure | func (r Rect) PolarClosure() Rect {
if r.Lat.Lo == -math.Pi/2 || r.Lat.Hi == math.Pi/2 {
return Rect{r.Lat, s1.FullInterval()}
}
return r
} | go | func (r Rect) PolarClosure() Rect {
if r.Lat.Lo == -math.Pi/2 || r.Lat.Hi == math.Pi/2 {
return Rect{r.Lat, s1.FullInterval()}
}
return r
} | [
"func",
"(",
"r",
"Rect",
")",
"PolarClosure",
"(",
")",
"Rect",
"{",
"if",
"r",
".",
"Lat",
".",
"Lo",
"==",
"-",
"math",
".",
"Pi",
"/",
"2",
"||",
"r",
".",
"Lat",
".",
"Hi",
"==",
"math",
".",
"Pi",
"/",
"2",
"{",
"return",
"Rect",
"{",... | // PolarClosure returns the rectangle unmodified if it does not include either pole.
// If it includes either pole, PolarClosure returns an expansion of the rectangle along
// the longitudinal range to include all possible representations of the contained poles. | [
"PolarClosure",
"returns",
"the",
"rectangle",
"unmodified",
"if",
"it",
"does",
"not",
"include",
"either",
"pole",
".",
"If",
"it",
"includes",
"either",
"pole",
"PolarClosure",
"returns",
"an",
"expansion",
"of",
"the",
"rectangle",
"along",
"the",
"longitudi... | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/rect.go#L189-L194 |
27,985 | golang/geo | s2/rect.go | Union | func (r Rect) Union(other Rect) Rect {
return Rect{
Lat: r.Lat.Union(other.Lat),
Lng: r.Lng.Union(other.Lng),
}
} | go | func (r Rect) Union(other Rect) Rect {
return Rect{
Lat: r.Lat.Union(other.Lat),
Lng: r.Lng.Union(other.Lng),
}
} | [
"func",
"(",
"r",
"Rect",
")",
"Union",
"(",
"other",
"Rect",
")",
"Rect",
"{",
"return",
"Rect",
"{",
"Lat",
":",
"r",
".",
"Lat",
".",
"Union",
"(",
"other",
".",
"Lat",
")",
",",
"Lng",
":",
"r",
".",
"Lng",
".",
"Union",
"(",
"other",
"."... | // Union returns the smallest Rect containing the union of this rectangle and the given rectangle. | [
"Union",
"returns",
"the",
"smallest",
"Rect",
"containing",
"the",
"union",
"of",
"this",
"rectangle",
"and",
"the",
"given",
"rectangle",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/rect.go#L197-L202 |
27,986 | golang/geo | s2/rect.go | Intersection | func (r Rect) Intersection(other Rect) Rect {
lat := r.Lat.Intersection(other.Lat)
lng := r.Lng.Intersection(other.Lng)
if lat.IsEmpty() || lng.IsEmpty() {
return EmptyRect()
}
return Rect{lat, lng}
} | go | func (r Rect) Intersection(other Rect) Rect {
lat := r.Lat.Intersection(other.Lat)
lng := r.Lng.Intersection(other.Lng)
if lat.IsEmpty() || lng.IsEmpty() {
return EmptyRect()
}
return Rect{lat, lng}
} | [
"func",
"(",
"r",
"Rect",
")",
"Intersection",
"(",
"other",
"Rect",
")",
"Rect",
"{",
"lat",
":=",
"r",
".",
"Lat",
".",
"Intersection",
"(",
"other",
".",
"Lat",
")",
"\n",
"lng",
":=",
"r",
".",
"Lng",
".",
"Intersection",
"(",
"other",
".",
"... | // Intersection returns the smallest rectangle containing the intersection of
// this rectangle and the given rectangle. Note that the region of intersection
// may consist of two disjoint rectangles, in which case a single rectangle
// spanning both of them is returned. | [
"Intersection",
"returns",
"the",
"smallest",
"rectangle",
"containing",
"the",
"intersection",
"of",
"this",
"rectangle",
"and",
"the",
"given",
"rectangle",
".",
"Note",
"that",
"the",
"region",
"of",
"intersection",
"may",
"consist",
"of",
"two",
"disjoint",
... | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/rect.go#L208-L216 |
27,987 | golang/geo | s2/rect.go | Intersects | func (r Rect) Intersects(other Rect) bool {
return r.Lat.Intersects(other.Lat) && r.Lng.Intersects(other.Lng)
} | go | func (r Rect) Intersects(other Rect) bool {
return r.Lat.Intersects(other.Lat) && r.Lng.Intersects(other.Lng)
} | [
"func",
"(",
"r",
"Rect",
")",
"Intersects",
"(",
"other",
"Rect",
")",
"bool",
"{",
"return",
"r",
".",
"Lat",
".",
"Intersects",
"(",
"other",
".",
"Lat",
")",
"&&",
"r",
".",
"Lng",
".",
"Intersects",
"(",
"other",
".",
"Lng",
")",
"\n",
"}"
] | // Intersects reports whether this rectangle and the other have any points in common. | [
"Intersects",
"reports",
"whether",
"this",
"rectangle",
"and",
"the",
"other",
"have",
"any",
"points",
"in",
"common",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/rect.go#L219-L221 |
27,988 | golang/geo | s2/rect.go | CapBound | func (r Rect) CapBound() Cap {
// We consider two possible bounding caps, one whose axis passes
// through the center of the lat-long rectangle and one whose axis
// is the north or south pole. We return the smaller of the two caps.
if r.IsEmpty() {
return EmptyCap()
}
var poleZ, poleAngle float64
if r.Lat.... | go | func (r Rect) CapBound() Cap {
// We consider two possible bounding caps, one whose axis passes
// through the center of the lat-long rectangle and one whose axis
// is the north or south pole. We return the smaller of the two caps.
if r.IsEmpty() {
return EmptyCap()
}
var poleZ, poleAngle float64
if r.Lat.... | [
"func",
"(",
"r",
"Rect",
")",
"CapBound",
"(",
")",
"Cap",
"{",
"// We consider two possible bounding caps, one whose axis passes",
"// through the center of the lat-long rectangle and one whose axis",
"// is the north or south pole. We return the smaller of the two caps.",
"if",
"r",
... | // CapBound returns a cap that countains Rect. | [
"CapBound",
"returns",
"a",
"cap",
"that",
"countains",
"Rect",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/rect.go#L224-L255 |
27,989 | golang/geo | s2/rect.go | Contains | func (r Rect) Contains(other Rect) bool {
return r.Lat.ContainsInterval(other.Lat) && r.Lng.ContainsInterval(other.Lng)
} | go | func (r Rect) Contains(other Rect) bool {
return r.Lat.ContainsInterval(other.Lat) && r.Lng.ContainsInterval(other.Lng)
} | [
"func",
"(",
"r",
"Rect",
")",
"Contains",
"(",
"other",
"Rect",
")",
"bool",
"{",
"return",
"r",
".",
"Lat",
".",
"ContainsInterval",
"(",
"other",
".",
"Lat",
")",
"&&",
"r",
".",
"Lng",
".",
"ContainsInterval",
"(",
"other",
".",
"Lng",
")",
"\n... | // Contains reports whether this Rect contains the other Rect. | [
"Contains",
"reports",
"whether",
"this",
"Rect",
"contains",
"the",
"other",
"Rect",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/rect.go#L263-L265 |
27,990 | golang/geo | s2/rect.go | ContainsCell | func (r Rect) ContainsCell(c Cell) bool {
// A latitude-longitude rectangle contains a cell if and only if it contains
// the cell's bounding rectangle. This test is exact from a mathematical
// point of view, assuming that the bounds returned by Cell.RectBound()
// are tight. However, note that there can be a loss... | go | func (r Rect) ContainsCell(c Cell) bool {
// A latitude-longitude rectangle contains a cell if and only if it contains
// the cell's bounding rectangle. This test is exact from a mathematical
// point of view, assuming that the bounds returned by Cell.RectBound()
// are tight. However, note that there can be a loss... | [
"func",
"(",
"r",
"Rect",
")",
"ContainsCell",
"(",
"c",
"Cell",
")",
"bool",
"{",
"// A latitude-longitude rectangle contains a cell if and only if it contains",
"// the cell's bounding rectangle. This test is exact from a mathematical",
"// point of view, assuming that the bounds retur... | // ContainsCell reports whether the given Cell is contained by this Rect. | [
"ContainsCell",
"reports",
"whether",
"the",
"given",
"Cell",
"is",
"contained",
"by",
"this",
"Rect",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/rect.go#L268-L279 |
27,991 | golang/geo | s2/rect.go | ContainsLatLng | func (r Rect) ContainsLatLng(ll LatLng) bool {
if !ll.IsValid() {
return false
}
return r.Lat.Contains(ll.Lat.Radians()) && r.Lng.Contains(ll.Lng.Radians())
} | go | func (r Rect) ContainsLatLng(ll LatLng) bool {
if !ll.IsValid() {
return false
}
return r.Lat.Contains(ll.Lat.Radians()) && r.Lng.Contains(ll.Lng.Radians())
} | [
"func",
"(",
"r",
"Rect",
")",
"ContainsLatLng",
"(",
"ll",
"LatLng",
")",
"bool",
"{",
"if",
"!",
"ll",
".",
"IsValid",
"(",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"r",
".",
"Lat",
".",
"Contains",
"(",
"ll",
".",
"Lat",
".",
... | // ContainsLatLng reports whether the given LatLng is within the Rect. | [
"ContainsLatLng",
"reports",
"whether",
"the",
"given",
"LatLng",
"is",
"within",
"the",
"Rect",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/rect.go#L282-L287 |
27,992 | golang/geo | s2/rect.go | ContainsPoint | func (r Rect) ContainsPoint(p Point) bool {
return r.ContainsLatLng(LatLngFromPoint(p))
} | go | func (r Rect) ContainsPoint(p Point) bool {
return r.ContainsLatLng(LatLngFromPoint(p))
} | [
"func",
"(",
"r",
"Rect",
")",
"ContainsPoint",
"(",
"p",
"Point",
")",
"bool",
"{",
"return",
"r",
".",
"ContainsLatLng",
"(",
"LatLngFromPoint",
"(",
"p",
")",
")",
"\n",
"}"
] | // ContainsPoint reports whether the given Point is within the Rect. | [
"ContainsPoint",
"reports",
"whether",
"the",
"given",
"Point",
"is",
"within",
"the",
"Rect",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/rect.go#L290-L292 |
27,993 | golang/geo | s2/rect.go | intersectsLatEdge | func intersectsLatEdge(a, b Point, lat s1.Angle, lng s1.Interval) bool {
// Unfortunately, lines of constant latitude are curves on
// the sphere. They can intersect a straight edge in 0, 1, or 2 points.
// First, compute the normal to the plane AB that points vaguely north.
z := Point{a.PointCross(b).Normalize()}... | go | func intersectsLatEdge(a, b Point, lat s1.Angle, lng s1.Interval) bool {
// Unfortunately, lines of constant latitude are curves on
// the sphere. They can intersect a straight edge in 0, 1, or 2 points.
// First, compute the normal to the plane AB that points vaguely north.
z := Point{a.PointCross(b).Normalize()}... | [
"func",
"intersectsLatEdge",
"(",
"a",
",",
"b",
"Point",
",",
"lat",
"s1",
".",
"Angle",
",",
"lng",
"s1",
".",
"Interval",
")",
"bool",
"{",
"// Unfortunately, lines of constant latitude are curves on",
"// the sphere. They can intersect a straight edge in 0, 1, or 2 poin... | // intersectsLatEdge reports whether the edge AB intersects the given edge of constant
// latitude. Requires the points to have unit length. | [
"intersectsLatEdge",
"reports",
"whether",
"the",
"edge",
"AB",
"intersects",
"the",
"given",
"edge",
"of",
"constant",
"latitude",
".",
"Requires",
"the",
"points",
"to",
"have",
"unit",
"length",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/rect.go#L301-L354 |
27,994 | golang/geo | s2/rect.go | intersectsLngEdge | func intersectsLngEdge(a, b Point, lat r1.Interval, lng s1.Angle) bool {
// The nice thing about edges of constant longitude is that
// they are straight lines on the sphere (geodesics).
return CrossingSign(a, b, PointFromLatLng(LatLng{s1.Angle(lat.Lo), lng}),
PointFromLatLng(LatLng{s1.Angle(lat.Hi), lng})) == Cro... | go | func intersectsLngEdge(a, b Point, lat r1.Interval, lng s1.Angle) bool {
// The nice thing about edges of constant longitude is that
// they are straight lines on the sphere (geodesics).
return CrossingSign(a, b, PointFromLatLng(LatLng{s1.Angle(lat.Lo), lng}),
PointFromLatLng(LatLng{s1.Angle(lat.Hi), lng})) == Cro... | [
"func",
"intersectsLngEdge",
"(",
"a",
",",
"b",
"Point",
",",
"lat",
"r1",
".",
"Interval",
",",
"lng",
"s1",
".",
"Angle",
")",
"bool",
"{",
"// The nice thing about edges of constant longitude is that",
"// they are straight lines on the sphere (geodesics).",
"return",... | // intersectsLngEdge reports whether the edge AB intersects the given edge of constant
// longitude. Requires the points to have unit length. | [
"intersectsLngEdge",
"reports",
"whether",
"the",
"edge",
"AB",
"intersects",
"the",
"given",
"edge",
"of",
"constant",
"longitude",
".",
"Requires",
"the",
"points",
"to",
"have",
"unit",
"length",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/rect.go#L358-L363 |
27,995 | golang/geo | s2/rect.go | IntersectsCell | func (r Rect) IntersectsCell(c Cell) bool {
// First we eliminate the cases where one region completely contains the
// other. Once these are disposed of, then the regions will intersect
// if and only if their boundaries intersect.
if r.IsEmpty() {
return false
}
if r.ContainsPoint(Point{c.id.rawPoint()}) {
... | go | func (r Rect) IntersectsCell(c Cell) bool {
// First we eliminate the cases where one region completely contains the
// other. Once these are disposed of, then the regions will intersect
// if and only if their boundaries intersect.
if r.IsEmpty() {
return false
}
if r.ContainsPoint(Point{c.id.rawPoint()}) {
... | [
"func",
"(",
"r",
"Rect",
")",
"IntersectsCell",
"(",
"c",
"Cell",
")",
"bool",
"{",
"// First we eliminate the cases where one region completely contains the",
"// other. Once these are disposed of, then the regions will intersect",
"// if and only if their boundaries intersect.",
"if... | // IntersectsCell reports whether this rectangle intersects the given cell. This is an
// exact test and may be fairly expensive. | [
"IntersectsCell",
"reports",
"whether",
"this",
"rectangle",
"intersects",
"the",
"given",
"cell",
".",
"This",
"is",
"an",
"exact",
"test",
"and",
"may",
"be",
"fairly",
"expensive",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/rect.go#L367-L428 |
27,996 | golang/geo | s2/rect.go | Encode | func (r Rect) Encode(w io.Writer) error {
e := &encoder{w: w}
r.encode(e)
return e.err
} | go | func (r Rect) Encode(w io.Writer) error {
e := &encoder{w: w}
r.encode(e)
return e.err
} | [
"func",
"(",
"r",
"Rect",
")",
"Encode",
"(",
"w",
"io",
".",
"Writer",
")",
"error",
"{",
"e",
":=",
"&",
"encoder",
"{",
"w",
":",
"w",
"}",
"\n",
"r",
".",
"encode",
"(",
"e",
")",
"\n",
"return",
"e",
".",
"err",
"\n",
"}"
] | // Encode encodes the Rect. | [
"Encode",
"encodes",
"the",
"Rect",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/rect.go#L431-L435 |
27,997 | golang/geo | s2/rect.go | Decode | func (r *Rect) Decode(rd io.Reader) error {
d := &decoder{r: asByteReader(rd)}
r.decode(d)
return d.err
} | go | func (r *Rect) Decode(rd io.Reader) error {
d := &decoder{r: asByteReader(rd)}
r.decode(d)
return d.err
} | [
"func",
"(",
"r",
"*",
"Rect",
")",
"Decode",
"(",
"rd",
"io",
".",
"Reader",
")",
"error",
"{",
"d",
":=",
"&",
"decoder",
"{",
"r",
":",
"asByteReader",
"(",
"rd",
")",
"}",
"\n",
"r",
".",
"decode",
"(",
"d",
")",
"\n",
"return",
"d",
".",... | // Decode decodes a rectangle. | [
"Decode",
"decodes",
"a",
"rectangle",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/rect.go#L446-L450 |
27,998 | golang/geo | s2/cap.go | CapFromCenterChordAngle | func CapFromCenterChordAngle(center Point, radius s1.ChordAngle) Cap {
return Cap{
center: center,
radius: radius,
}
} | go | func CapFromCenterChordAngle(center Point, radius s1.ChordAngle) Cap {
return Cap{
center: center,
radius: radius,
}
} | [
"func",
"CapFromCenterChordAngle",
"(",
"center",
"Point",
",",
"radius",
"s1",
".",
"ChordAngle",
")",
"Cap",
"{",
"return",
"Cap",
"{",
"center",
":",
"center",
",",
"radius",
":",
"radius",
",",
"}",
"\n",
"}"
] | // CapFromCenterChordAngle constructs a cap where the angle is expressed as an
// s1.ChordAngle. This constructor is more efficient than using an s1.Angle. | [
"CapFromCenterChordAngle",
"constructs",
"a",
"cap",
"where",
"the",
"angle",
"is",
"expressed",
"as",
"an",
"s1",
".",
"ChordAngle",
".",
"This",
"constructor",
"is",
"more",
"efficient",
"than",
"using",
"an",
"s1",
".",
"Angle",
"."
] | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/cap.go#L78-L83 |
27,999 | golang/geo | s2/cap.go | CapFromCenterHeight | func CapFromCenterHeight(center Point, height float64) Cap {
return CapFromCenterChordAngle(center, s1.ChordAngleFromSquaredLength(2*height))
} | go | func CapFromCenterHeight(center Point, height float64) Cap {
return CapFromCenterChordAngle(center, s1.ChordAngleFromSquaredLength(2*height))
} | [
"func",
"CapFromCenterHeight",
"(",
"center",
"Point",
",",
"height",
"float64",
")",
"Cap",
"{",
"return",
"CapFromCenterChordAngle",
"(",
"center",
",",
"s1",
".",
"ChordAngleFromSquaredLength",
"(",
"2",
"*",
"height",
")",
")",
"\n",
"}"
] | // CapFromCenterHeight constructs a cap with the given center and height. A
// negative height yields an empty cap; a height of 2 or more yields a full cap.
// The center should be unit length. | [
"CapFromCenterHeight",
"constructs",
"a",
"cap",
"with",
"the",
"given",
"center",
"and",
"height",
".",
"A",
"negative",
"height",
"yields",
"an",
"empty",
"cap",
";",
"a",
"height",
"of",
"2",
"or",
"more",
"yields",
"a",
"full",
"cap",
".",
"The",
"ce... | 476085157cff9aaeef4d4f124649436542d4114a | https://github.com/golang/geo/blob/476085157cff9aaeef4d4f124649436542d4114a/s2/cap.go#L88-L90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.