File Exchange

image thumbnail

stringart

version 1.0.1 (98.1 KB) by Giuseppe Cardillo
Stringart: Play with geometry and Bézier's quadratic curve

3 Downloads

Updated 19 Jul 2018

GitHub view license on GitHub

Editor's Note: This file was selected as MATLAB Central Pick of the Week

String art, or pin and thread art, is characterized by an arrangement of colored thread strung between points to form geometric patterns. Though straight lines are formed by the string, the slightly different angles and metric positions at which strings intersect gives the appearance of Bézier curves (as in the mathematical concept of envelope of a family of straight lines). Quadratic Bézier curve are obtained from strings based on two intersecting segments. String art has its origins in the 'curve stitch' activities invented by Mary Everest Boole at the end of the 19th century to make mathematical ideas more accessible to children. It was popularised as a decorative craft in the late 1960s through kits and books.

Syntax: stringart(varargin)

Properties:
'Sides' - sides number of polygon you want to use (default = 3)
'Crossed' - logical value that says if you want to use the perimeter (0 - default) or bisettrices of vertices (1).
'Density' - The number of pins you want to use for each side default = 40)
'Color' - 1x3 vector that indicates the colors of the wires (default = [0 0 0] black)
Created by Giuseppe Cardillo giuseppe.cardillo-edta@poste.it

To cite this file, this would be an appropriate format: Cardillo G. (2018) Stringart: Play with geometry and Bézier's quadratic curve
https://it.mathworks.com/matlabcentral/fileexchange/68252

Comments and Ratings (4)

Since the release of MATLAB 2016b, some functions and operators can handle what is called "implicit expansion behavior" (https://blogs.mathworks.com/loren/2016/10/24/matlab-arithmetic-expands-in-r2016b). Therefore, if your are using an older release, you will have to make a simple change to enjoy this magnificent function. In line 65, replace the current line with:

t=(Rot*(eye(2)*[MX(:,1)';MY(:,1)']-repmat([mp(end);h(end)],1,p.Results.Density)))+repmat([mp(end);h(end)],1,p.Results.Density);

Enjoy String Art!

You are right, Guiseppe. My problem must be the MATLAB version that I'am using, because I'm using the default parameters...Congratulations for this submission! Great String Art! >> Claudio

Considering that there are two posts as "File Exchange Pick of the Week" (https://blogs.mathworks.com/pick/2018/08/03/string-art-2/ and https://blogs.mathworks.com/pick/2018/08/10/string-art/) surely it works. Now, we have to understand where is the fail onto your system.

Great idea, but I get an error in line 62...

Error using -
Matrix dimensions must agree.

Error in stringart (line 62)
t=(Rot*(eye(2)*[MX(:,1)';MY(:,1)']-[mp(end);h(end)]))+[mp(end);h(end)];

Updates

1.0.1

update in description

MATLAB Release Compatibility
Created with R2018a
Compatible with any release
Platform Compatibility
Windows macOS Linux