Approximate raster image based on Cubic Bezier - pixel

I am unable to wrap my head around this problem.
I have a Cubic Bezier spline on screen, my goal is to have it built with "big pixels".
Here's the picture to show what I am talking about:

Related

Bezier curve fitting with known end points

I want to fit a bezier curve with known end points (p0 and p3) to noisy 2d data. This seems like an easier problem than traditional 4-point bezier curve fitting but still too hard for me to figure out.
Can someone point me to existing code or an algorithm to find the best values for the control points p1 and p2?
edit: The points that I'm trying to fit with a bezier curve comes from curves drawn with a mouse (imagine drawing something with a brush in Paint, there could be hundreds of recorded points in one long stroke). The anchor points p0 and p3 are created in advance but the control points p1 and p2 should be calculated so that the bezier fits the shape of the curve sketched out with the mouse.
I stumbled on a paper called "Approximation of data using cubic Bezier curve least square fitting" by "M.Khan" which describes an algorithm to calculate the exact thing I'm looking for.
Implementation in javascript was easy. It works quite good and is fast but the resulting bezier curves are not perfect. Could be a bug in my code but I suspect that better curves could be obtained by iteratively adjusting the matching points on the bezier curve to better fit the data .
edit: It turns out you can use newton-raphson to optimize each individual t-value for the bezier curve. After doing that the curve fits great, atleast for curves with only few points that don't self intersect but I have to do some more testing.

How can we compute the minimum bounding sphere enclosing a 3D mesh object?

I want to plot a sphere unit around a 3D object (.obj format file) with matlab, in order to guarantee a normalization of all the objects in my DB, and so on to achieve the scale invariance. I found in the state of the art that there are some algorithms implemented with C++ like Gartner's algorithm that is the fastest https://www.inf.ethz.ch/personal/gaertner/miniball.html, Fisher's algorithm which is more efficient for high dimensions https://github.com/hbf/miniball or welzl'one, or Mogiddo's algorithm too.
My question is: does the function sphere in matlab do the same thing, so all we have to do is to change the center of the sphere, or there is a specific matlab implementation for one of those algorithms above?

How to draw bounded b-spline surface in OpenGL?

I want to draw a bounded b-spline surface with 26 b-spline boundary curves.
I can draw b-spline surface (without any boundary) in OpenGL, but it is too difficult for me to draw surface and fit the boundary curves.
Any suggestions or ideas are appreciated.
https://drive.google.com/file/d/0ByjklWbi44oBZDhocGdNLWNvUWM/view?usp=sharing
PS: The Files is a sample in .stp format
B-spline surfaces are naturally bounded. So when you say B-spline surface without any boundary, I think you are talking about untrimmed B-spline surfaces and what you want to do is to be able to draw trimmed B-spline surfaces.
Drawing a surface typically involves tessellation, which turns a continuous surface into a triangle mesh consist of many small triangles. Therefore you will need to do the following:
Find the surface parameter curve (SP curve) of the boundary curves. The SP curve is a 2D curve defined on the parametric domain of the B-spline surface.
Tessellate the 2D region on the parametric domain enclosed by all SP-curves.
Map the 2D tessellation on parametric domain back to 3D space to find the 3D triangle mesh.
Step 1 and step 2 are both non-trivial. So, indeed this will be a large task if you don't have any 3D library at your disposal and have to implement everything by yourself.

Three.js b-spline fitting, how can i do it?

I have large number of points in 3D space. I want to fit b-spline and display this spline with three.js. How can i do this? Preferably I want some tips or examples how to do it.

Rendering curves of TTF fonts

Could you point me to an effective algorithm for rendering and filling the curves used in TTF fonts? I have the data loaded as contours of points so I;m only wondering about an effective way of drawing the curves. I'd also very much like it to support smoothing.
What I know up to this point:
TTF uses bezier curves and splines
TTF categorizes it's points as points defining lines, and points defining curve, the latter being either on the curve in question or our of it (control points)
One can make a polygon out of a curve contour where the curved parts are made of lines the size of a pixel.
One could use this polygon to render the filled contour and if one also uses the data as floats rather than ints, one could achieve font smoothing.
So could you point me to a guide of some sort or something?
Thanks.
If you already have the vector data, then you have to rasterize it with some scanline fill algorithm. For smoothing divide the pixels into n by n blocks, rasterize the characters and compute the a gray value corresponding to the number of filled subpixels. Handling bezier curves and splines, however, is not going to be easy, I think. If it is possible, I would use a library like freetype or similar.

Resources