C++ Guru Question

Wondering about this… template argument deduction succeeds for the explicitly-typed variable, fails in the auto case. (Also, it succeeds either way for an equivalently-typed unary operator template). template struct Foo { T m_t; }; template Foo operator/=(Foo foo, function fn) { return fn(foo.m_t); } void mystery() { auto foo = Foo{1}; // this works… function… Continue reading C++ Guru Question

An Interesting C++ Technique

I recently discovered a C++ technique I haven’t seen recognized before in any books, articles, or mentioned online anywhere (search terms are difficult perhaps). For want of a better name I call it Structural Capture. Consider the following code: #include #include using namespace std; //————————————————————— struct Foo { template Foo(const T& t) { m_outputFunc =… Continue reading An Interesting C++ Technique

RIP drm

This week, Dennis M. Ritchie, co-creator of C and Unix, died. His death has not made the front page like Steve Jobs’ did. But although the non-tech world had never heard of him, he was more important than Jobs. I can still remember buying my copy of K&R, that slim volume that was my reference… Continue reading RIP drm

I wrote my first Python program

Last Friday. Knowing almost no Python at noon, by 5pm I had some code to munge XML and do something useful for my current project. So it’s not bad. It’s good for productivity. Mostly because: It has useful libraries. Bread-and-butter data structures are built in, i.e. lists and dictionaries. I don’t care too much about… Continue reading I wrote my first Python program

Curve and Vector

Curve (com.elbeno.curve) is my common lisp package for doing cool things with two-dimensional curves. In particular, modulating cubic Bézier curves and splines, but also approximating arbitrary elliptical and circular arc segments with cubic Bézier curves. It depends on Vector (com.elbeno.vector), a cobbled together set of functionality for representing and manipulating points on the 2D Cartesian… Continue reading Curve and Vector

Approximating elliptical arcs with Bézier curves

In doing my modulation work with curves and ellipses, I extended the vecto function for drawing an ellipse to enable an oriented ellipse. Lately it occurred to me that this didn’t go far enough in terms of functionality, and I began wondering about how to draw part of an elliptical arc. Vecto’s ellipse drawing function… Continue reading Approximating elliptical arcs with Bézier curves