How do you draw like a Crayon?

I remember reading (a long time ago) a short description of an algorithm to do so: for the general form of the line, you split the segment in two at a random point, and move this point slightly away from it’s position (the variation depending on the distance of the point to the extremity). Repeat … Read more

How to test if a line segment intersects an axis-aligned rectange in 2D?

The original poster wanted to DETECT an intersection between a line segment and a polygon. There was no need to LOCATE the intersection, if there is one. If that’s how you meant it, you can do less work than Liang-Barsky or Cohen-Sutherland: Let the segment endpoints be p1=(x1 y1) and p2=(x2 y2). Let the rectangle’s … Read more

Haskell library for 2D drawing [closed]

Instead of picking individual libraries, I’ll have a go at a quick overview at all of them, as listed in the Graphics section on Hackage. Basic frameworks: OpenGL Part of the Haskell Platform Used for many small 2 and 3D games. Examples: lambdacube-engine, roguestar-gl, hpong, monadius, raincat, frag GTK cabal install cairo Used for high … Read more

In MATLAB, how do I plot to an image and save the result without displaying it?

When you create the figure you set the Visibile property to Off. f = figure(‘visible’,’off’) Which in your case would be im = imread(‘image.tif’); f = figure(‘visible’,’off’), imshow(im, ‘Border’, ‘tight’); rectangle(‘Position’, [100, 100, 10, 10]); print(f, ‘-r80’, ‘-dtiff’, ‘image2.tif’); And if you want to view it again you can do set(f,’visible’,’on’)

Drawing Sequence Diagrams [closed]

PlantUML. http://plantuml.sourceforge.net/sequence.html PlantUML is used to draw UML diagram, using a simple and human readable text description. The generated images can then be used without any reference to the GPL/LGPL/ASL/EPL/MIT license. It is not even necessary to stipulate that they have been generated with PlantUML, although this will be appreciate by PlantUML team. In my … Read more

Closest point on a cubic Bezier curve?

I’ve written some quick-and-dirty code that estimates this for Bézier curves of any degree. (Note: this is pseudo-brute force, not a closed-form solution.) Demo: http://phrogz.net/svg/closest-point-on-bezier.html /** Find the ~closest point on a Bézier curve to a point you supply. * out : A vector to modify to be the point on the curve * curve … Read more

Learning about low-level graphics programming

The lowest level would be the graphics card’s video RAM. When the computer first starts, the graphics card is typically set to the 80×25 character legacy mode. You can write text with a BIOS provided interrupt at this point. You can also change the foreground and background color from a palette of 16 distinctive colors. … Read more