Skip to content

Instantly share code, notes, and snippets.

View bzm3r's full-sized avatar

Brian Merchant bzm3r

View GitHub Profile
@bzm3r
bzm3r / potree.rs
Created December 1, 2022 03:57
Rust PoTree impl
use std::rc::Rc;
use std::cell::RefCell;
use std::cmp::Ordering;
use std::collections::BTreeSet;
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum Thing {
A,
B,
C,
use rand::distributions::Uniform;
use rand::Rng;
use rayon::iter::IndexedParallelIterator;
use rayon::iter::IntoParallelRefIterator;
use rayon::iter::ParallelIterator;
use std::sync::mpsc::{channel, Receiver, Sender};
use std::sync::Arc;
use std::thread;
const DAT_SIZE: usize = 10;
use bincode::serialize_into;
use rand::distributions::Uniform;
use rand::rngs::ThreadRng;
use rand::{thread_rng, Rng};
use serde::{Deserialize, Serialize};
use std::path::Path;
use std::time::Duration;
use std::{thread, time};
use tokio::io::AsyncWriteExt;
@bzm3r
bzm3r / ex.rs
Last active November 7, 2020 12:23
fn make_movie(width: i32, height: i32, framerate: i32, frames: i32) {
let mut surface =
ImageSurface::create(Format::ARgb32, width, height).expect("Couldn't create surface");
let mut child = Command::new("cmd")
.args(&["/C", &format!(
"ffmpeg -f rawvideo -pix_fmt bgra -s {width}x{height} -i - -pix_fmt yuv420p -r {framerate} -y out.mp4",
width = width,
height = height,
framerate = framerate,
)])
= Building Blender as a Python Module =
== Overview ==
The official '''blender.org''' embeds a Python interpreter (CPython 3.x).
This makes sense from the perspective of a user, who's primary needs are to have an application which can be extended with scripts.
However from the perspective of a Python developer, it can be useful to being Blender into your existing scripts and access its feature set.
The option to build Blender as a Python module is not officially supported, ''in the sense Blender.org isn't distributing it along with regular releases'',
<!DOCTYPE html>
<html lang="en">
<head><script src="d3/d3.js"></script>
<title>This is a test page.</title></head>
<body>
<div id="test-div"></div>
<script>
d3.select("test-div").append(d3.create("span")
.style("color", "white")
.style("background-color", "black")
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# https://web.archive.org/web/20150907215914/http://adorio-research.org/wordpress/?p=6565
"""
File odedopri.py
Synopsis
double odedopri(double (*fxy)(double x, double y),
double x0, double y0, double x1, double tol,
double hmax, double hmin, int maxiter)
# Adapted from https://github.com/5agado/data-science-learning/blob/master/ds_utils/blender_utils.py,
# which is generously provided by 5agado under the Apache license.
import bpy
import bpy_extras
import numpy as np
from math import sin, cos
use rayon::prelude::*;
use std::time::Instant;
use chashmap::CHashMap;
fn gen_xys_f32() -> Vec<(f32, f32)> {
let nverts = 1600;
let mut xys: Vec<(f32, f32)> = Vec::with_capacity(nverts);
for i in 0..nverts {
let val = i as f32;