Posts

Showing posts from July 26, 2015

A Class of Computer Languages: Math Lang

canvas is scum. invented by scum. The likes of C, C++, OpenGL, etc, whose tenet is: hi, my name is speed. Ever since, programing is hell. 〔➤ HTML5 Canvas vs SVG〕 vast majority of programers, 99%, have no idea of mathematical language. Talking to them about lang debates, is like talking to idiots.all these langs programers are familiar with,eg C C++ java python perl ruby golang even C# and even Haskell, are non-math languages.in the other universe, is Mathematica, matlab, APL… (and i think julia), these, are math languages. (note: haskell is NOT.)most of these industrial programers, since they've never seen a math lang in their life, cannot conceive some points in lang debates.thus, debating them is like talking to stone. Even you see their points, but they don't see yours, after repetition.typically, these folks revolve around concepts like reference, pointer, memory, certain “garbage collection”, and “hi, my name is speed.”and other stuff they are found of are like: “threads”…

SVG pain. inverted y axes; text default scale is absolute

inverted y axesthe y coordinate is inverted from normalSolution, attach all your drawing to a group, then apply transformation, like this:gp.setAttribute("transform", xd.translate(0, 2*ymin+ywidth) + xd.scale(1,-1) );but, the problem is, if you have text, the entire font gets inverted upside down too.So this means, there isn't simple solution to work with “not invert” y axes. Maybe there's a attribute to make text not invert or something. Still don't have a nice solution.the inverted y axes is a major pain, because it drains brain when you work with “normal” y-axes, such as in math plots. Either twist your brain, or, you need to remember to attach a transform to every of your drawing primitive. Or, group them and transform.text default scale is absoluteyou can use svg viewBox to specify your drawing's coordinate range. that is, xmin, xmax, ymin, ymaxthis makes it convenient. For example, if your app is plotting basic math functions, you can work with coordina…