algorithm to rasterize and fill a hypersphere?

well no one answers for some time so here is simple and obvious C++ solution of mine: //————————————————————————— const int N=10; // number of dimensions struct point { double a[N]; }; // N-dimensional point #define color DWORD // type of your color property //————————————————————————— // N x nested for(a=a0;a<=a1;a+=da) return false if ended // it … Read more

Boundary enclosing a given set of points

Here is some Python code that computes the alpha-shape (concave hull) and keeps only the outer boundary. This is probably what matlab’s boundary does inside. from scipy.spatial import Delaunay import numpy as np def alpha_shape(points, alpha, only_outer=True): “”” Compute the alpha shape (concave hull) of a set of points. :param points: np.array of shape (n,2) … Read more

Is there a more efficient way of texturing a circle?

Why not use: (x-x0)^2 + (y-y0)^2 <= r^2 so simply: int x0=?,y0=?,r=?; // your planet position and size int x,y,xx,rr,col; for (rr=r*r,x=-r;x<=r;x++) for (xx=x*x,y=-r;y<=r;y++) if (xx+(y*y)<=rr) { col = whateverFunctionIMake(x, y); setPixel(x0+x, y0+y, col); } all on integers, no floating or slow operations, no gaps … Do not forget to use randseed for the coloring … Read more

Problem superimposing and aligning 3D triangles

As the other comments suggested you most likely got confused withing projections and goniometrics. There is also safer way without goniometrics using vector math (linear algebra). create transform matrix m0 representing aligned plane to first triangle t0 by aligned I mean one of the edges of triangle should lie in the one of the plane … Read more

tech