Bear with me, I'm a programming dunce and not only new to Processing, but have also forgotten absolutely everything I ever learned in geometry class.
I am aware the dist() method exists in Processing and I know it may be able to help me, trouble being that I do not know how to give it appropriate input in this case.
The goal is to create a program that can auto-draw a guitar fretboard for to-scale printout, for direct print and transfer onto lap / pedal steel guitars (on steels the "fretboard" serves for visual pitch reference only and never gets touched, a 2D printout will suffice).
The fretboard is generally narrower at the top than at the bottom. Ideally the user will be able to input the desired fretboard width at just the top and bottom, and the program can fill in the rest.
Here, I've shown a fretboard drawn up with Processing with an arbitrary fbwtop of 2 and an arbitrary fbwbot of 2.2-- left, just the framework with no "frets" drawn; right, with horizontal-line "frets" drawn all the way up.
The problem I'm having, as shown on right, is that the fret-drawing code does not know the width of the fretboard at the point where each fret must be drawn. This is because I have no earthly idea how to establish the width at each fretted point. At the top, you can see the fret edges hanging off each side of the board.
At this stage it's obvious that I'm nowhere near usable results for print, but ideally, to keep the final printout clean, I need a way to find the exact fretboard-width information at each fretline and feed it into the line() that draws each fret in the while loop so that the board will print cleanly.
Basic Google searching on formulas for finding distances between two points on (theoretically) intersecting lines have led me nowhere, at least not to anything I can begin to comprehend and/or find applicable to this situation.
It occurs to me that I could put a Processing point along each vertical board-framing line somehow, using the same basic "rule of 18" algorithm that determines where the frets themselves are to be placed, and then use dist() to determine the line width between the two points that make up each fret. But the same problem still remains, at least the way I'm currently thinking about it.
Thanks in advance for any help.
Current very primitive code:
I am aware the dist() method exists in Processing and I know it may be able to help me, trouble being that I do not know how to give it appropriate input in this case.
The goal is to create a program that can auto-draw a guitar fretboard for to-scale printout, for direct print and transfer onto lap / pedal steel guitars (on steels the "fretboard" serves for visual pitch reference only and never gets touched, a 2D printout will suffice).
The fretboard is generally narrower at the top than at the bottom. Ideally the user will be able to input the desired fretboard width at just the top and bottom, and the program can fill in the rest.
Here, I've shown a fretboard drawn up with Processing with an arbitrary fbwtop of 2 and an arbitrary fbwbot of 2.2-- left, just the framework with no "frets" drawn; right, with horizontal-line "frets" drawn all the way up.
The problem I'm having, as shown on right, is that the fret-drawing code does not know the width of the fretboard at the point where each fret must be drawn. This is because I have no earthly idea how to establish the width at each fretted point. At the top, you can see the fret edges hanging off each side of the board.
At this stage it's obvious that I'm nowhere near usable results for print, but ideally, to keep the final printout clean, I need a way to find the exact fretboard-width information at each fretline and feed it into the line() that draws each fret in the while loop so that the board will print cleanly.
Basic Google searching on formulas for finding distances between two points on (theoretically) intersecting lines have led me nowhere, at least not to anything I can begin to comprehend and/or find applicable to this situation.
It occurs to me that I could put a Processing point along each vertical board-framing line somehow, using the same basic "rule of 18" algorithm that determines where the frets themselves are to be placed, and then use dist() to determine the line width between the two points that make up each fret. But the same problem still remains, at least the way I'm currently thinking about it.
Thanks in advance for any help.
Current very primitive code:
- float scalemult = 20;
float fbscale = 25.5*scalemult;
float fbwtop = 2*scalemult;
float fbwbot = 2.2*scalemult;
int xorig = 30;
int yorig = 30;
float yfret;
float yfretNeckRemain;
float yfretDiff;
void setup()
{
size(600, 600);
background(255);
}
void draw()
{
smooth(); - //this code draws the fretboard outline (shown by itself on left of image above)
line(xorig, yorig, xorig-(fbwbot-fbwtop), yorig+fbscale);
line(xorig, yorig, xorig+fbwtop, yorig);
line(xorig+fbwtop, yorig, (xorig+fbwtop)+(fbwbot-fbwtop), yorig+fbscale);
line(xorig-(fbwbot-fbwtop), yorig+fbscale, (xorig+fbwtop)+(fbwbot-fbwtop), yorig+fbscale);
//the fret-placement code starts here- yfret=(yorig+(fbscale/17.817));
yfretNeckRemain=fbscale;
while (yfretNeckRemain>=0.001) {
line(xorig-(fbwbot-fbwtop), yfret, (xorig+fbwtop)+(fbwbot-fbwtop), yfret);
yfretDiff = (yfret-yorig);
yfretNeckRemain = (fbscale-yfretDiff);
yfret = yorig+((yfretNeckRemain/17.817)+yfretDiff);
}
}
1