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
//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. |
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
public class circfill : GoalObject | |
{ | |
double diam; | |
double change; | |
double prevMin; | |
double ratio; | |
Curve Crv; | |
public circfill(Point3d[] P, Curve C, double k) |
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
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]; |
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
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 = |