This file contains 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
{-# NOINLINE runLoop #-} | |
runLoop :: IORef Bool | |
runLoop = unsafePerformIO (newIORef True) | |
main = rapid 0 \ k -> do | |
HGCode{..} <- return $ HGCode { input = "CE5S1_hex_grid.gcode" &= typ "INPUT" &= argPos 0, output = def &= typ "OUTPUT" &= argPos 1 } | |
lines <- createRef k "lines" $ runResourceT $ runConduit $ sourceFile input | |
.| decodeUtf8C | |
.| parseGcodeC @Pico |
This file contains 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
# Rain Barrel Simulation | |
I want to decide how big my rain barrel has to be. So I use NOAA's version of YYZ's weather | |
mkdir 71624099999 | |
for f in `seq 2006 2022`; do | |
wget https://ncei.noaa.gov/data/global-hourly/access/$f/71624099999.csv -O $f | |
done | |
rm 71624099999/2005.csv # is missing for some reason |
This file contains 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
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-} | |
-- use linear V2 Float, V3 Float instead of raylib Vector2 Vector3 | |
module RaylibLinear | |
(module Raylib.Core, | |
module Raylib.Types, | |
module Raylib.Util, | |
module RaylibLinear) where | |
import Raylib.Core hiding (getMonitorPosition, getWindowPosition, getWindowScaleDPI, getMousePosition, getMouseDelta, getMouseWheelMoveV, getTouchPosition, getScreenToWorldRay) | |
import Raylib.Types hiding (Quaternion, Camera3D) |
This file contains 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
-- autogenerated by mkCxt.sh. defines a CC.ctxTypesTable based on the Types.hs files in opencascade-hs | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
module Cxt where | |
import Data.Map (fromList) | |
import qualified Language.C.Inline.Cpp as C | |
import qualified Language.C.Types as C | |
import qualified Language.C.Inline.Context as C | |
import qualified OpenCascade.BRepBuilderAPI.Types as BRepBuilderAPI |
This file contains 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
#!/bin/bash | |
PWD0=$(pwd) | |
SCRIPT_DIR=$(dirname "$0") | |
writePY () { | |
cat <<'EOF' > $SCRIPT_DIR/yet-another-cad-viewer-master/example/object.py | |
# Optional: enable logging to see what's happening | |
import sys |
This file contains 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
{-# LANGUAGE ViewPatterns, ApplicativeDo #-} | |
module Main (main) where | |
import Text.Regex.Applicative | |
import Data.List | |
import Control.Monad | |
import System.Exit | |
import System.Environment | |
import Data.Maybe | |
import Data.Char | |
import Data.IntMap (IntMap) |
This file contains 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 cadquery as cq | |
from copy import copy | |
class Ribbon3: | |
""" A ribbon is a way to make a sequence of Workplane.box | |
end-to-end without repeating dimensions. | |
I like the offset2D approach: | |
cq.Workplane().hLine(5).vLine(6).offset2D(2).extrude(3) |
This file contains 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
# empirical performance model (EPM) contour active learning | |
I have two or three different algorithms for finding the closest pair of points between two point sets. | |
I want to know which one is faster, depending on the size of the point sets and the distance between them. | |
There are several parts to this project: | |
- [ ] level set method for contour curvature and normal vector / directional derivative of the EPM | |
- [ ] debug the distance transform and | |
- [ ] caret::knn.reg if it exists? | |
- [ ] shape constrained splines (SCAM) instead of mgcv::gam? |
This file contains 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
# Purpose: optimize the thicknesses of the shell to minimize the maximum stress | |
# The geometry of a shell is set by 12 parameters in the spreadsheet ts. | |
# Here we directly search for the 12 parameters that minimize the maximum stress, | |
# subject to the constraint that the volume is 8000 mm^3. | |
# | |
# TODO | |
# - package as a macro/workbench with buttons | |
# - 1D option? | |
# - Z88OS which has "real beam and shell elements" but it's not really possible https://github.com/FreeCAD/FreeCAD/issues/8559 | |
# - maximum is not a good objective. Perhaps the goal is to have each segment |
This file contains 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
library(glue) | |
library(stringr) | |
require(rlang) | |
require(rextendr) | |
# drop-in replacement for rextendr::rust_source | |
# use a build directory in the current working directory | |
# if the source file is lib.rs the build is in lib_build | |
# code= needed for https://github.com/extendr/rextendr/issues/234 | |
rust_source <- function(file, code= paste0(readLines(file), collapse="\n"), features="ndarray", ...) { | |
# https://github.com/extendr/rextendr/issues/291 |
NewerOlder