Skip to content

Instantly share code, notes, and snippets.

@Dan-Piker
Dan-Piker / Coonspatch.cs
Created November 7, 2023 10:43
Coons patch
Mesh m = new Mesh();
int uc = pa.Count;
int vc = pb.Count;
for(int u = 0;u < uc;u++)
{
for(int v = 0;v < vc;v++)
{
Point3d p0 = pa[u] * v / (vc - 1) + pc[uc - 1 - u] * (vc - 1 - v) / (vc - 1);
Point3d p1 = pd[v] * (uc - 1 - u) / (uc - 1) + pb[vc - 1 - v] * u / (uc - 1);
Point3d p2 =
@Dan-Piker
Dan-Piker / sqrt7.cs
Created March 18, 2023 22:16
sqrt7 subdivision
KPlanktonMesh ma = mesh.ToKPlanktonMesh();
double[] weightsA = new double[3]{4 / 7f,2 / 7f,1 / 7f};
double[] weightsB = new double[3]{4 / 7f,1 / 7f,2 / 7f};
for(int k = 0;k < level;k++)
{
KPlanktonMesh mb = new KPlanktonMesh();
var hes = ma.Halfedges;
for(int i = 0;i < hes.Count;i++)
{
var next = hes[hes[i].NextHalfedge];
public class circfill : GoalObject
{
double diam;
double change;
double prevMin;
double ratio;
Curve Crv;
public circfill(Point3d[] P, Curve C, double k)
@Dan-Piker
Dan-Piker / Moebius3d
Last active March 27, 2024 08:06
Moebius transformations in 3d
//Moebius transformations in 3d, by reverse stereographic projection to the 3-sphere,
//rotation in 4d space, and projection back.
//by Daniel Piker 09/08/20
//Feel free to use, adapt and reshare. I'd appreciate a mention if you post something using this.
//You can also now find this transformation as a component in Grasshopper/Rhino
//I first wrote about these transformations here:
//https://spacesymmetrystructure.wordpress.com/2008/12/11/4-dimensional-rotations/
//If you want to transform about a given circle. Points on the circle and its axis stay on those curves.
//You can skip these 2 lines if you want to always use the origin centred unit circle.