This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "io" | |
| "log" | |
| "os" | |
| "path/filepath" | |
| "github.com/unixpickle/essentials" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module github.com/unixpickle/heart3d | |
| go 1.15 | |
| require ( | |
| github.com/unixpickle/essentials v1.3.0 | |
| github.com/unixpickle/ffmpego v0.1.3 | |
| github.com/unixpickle/model3d v0.2.12 | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func DecimateMesh(m *model2d.Mesh, maxVertices int) *model2d.Mesh { | |
| m = model2d.NewMeshSegments(m.SegmentsSlice()) | |
| areas := map[model2d.Coord]float64{} | |
| for _, v := range m.VertexSlice() { | |
| areas[v] = VertexArea(m, v) | |
| } | |
| for len(areas) > maxVertices { | |
| var next model2d.Coord | |
| nextArea := math.Inf(1) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func CreateMesh() *model3d.Mesh { | |
| box := model3d.NewMesh() | |
| stepSize := 0.05 | |
| addQuad := func(p model3d.Coord3D, normalAxis int) { | |
| ax1 := model3d.Coord3D{X: stepSize} | |
| ax2 := model3d.Coord3D{Y: stepSize} | |
| if normalAxis == 0 { | |
| ax1 = model3d.Coord3D{Z: stepSize} | |
| } else if normalAxis == 1 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module gists/deformation | |
| go 1.14 | |
| require ( | |
| github.com/unixpickle/essentials v1.1.0 | |
| github.com/unixpickle/model3d v0.2.1 | |
| github.com/unixpickle/polish v0.0.0-20200508163631-1844661b331d | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const canvas = document.createElement('canvas'); | |
| canvas.width = 400; | |
| canvas.height = 400; | |
| const ctx = canvas.getContext('2d'); | |
| ctx.font = '350px serif'; | |
| ctx.textBaseline = 'middle'; | |
| ctx.textAlign = 'center'; | |
| ctx.fillText('Hi', 200, 200); | |
| const data = ctx.getImageData(0, 0, 400, 400); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import math | |
| def involute_point(a, t): | |
| c = math.cos(t) | |
| s = math.sin(t) | |
| d = t - a | |
| return c + d * s, s - d * c | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Command extract_tar can be used to extract a large | |
| // ImageNet tarbal on a system that doesn't have enough | |
| // storage for both the tarbal and the untarred data. | |
| // | |
| // As it extracts the tarbal, it truncates the original | |
| // tar file so that it takes up less and less space. | |
| // | |
| // Based on this earlier gist for processing ImageNet tars: | |
| // https://gist.github.com/unixpickle/7304c78032c9f433e28a87409f4d5aca | |
| package main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Reading data produced by an external program. | |
| """ | |
| import math | |
| import random | |
| import numpy as np | |
| import torch |