Esempio n. 1
0
        void DrawPickupBobbin( Drawer d, Line2 centreLine, double dStringSpacing, double dWidth )
        {
            // polepiece positions
            Vec2 vStartSpot = ( centreLine.v1 + centreLine.v2 ) * 0.5 - centreLine.direction * ( m_iStringCount - 1 ) * 0.5 * dStringSpacing;
            Vec2 vEndSpot = vStartSpot + centreLine.direction * dStringSpacing * ( m_iStringCount - 1 );
            Line2 trueCentreLine = new Line2( vStartSpot, vEndSpot );
            for( int i = 0; i < m_iStringCount; ++i )
            {
                Vec2 vSpot = vStartSpot + centreLine.direction * dStringSpacing * i;
                d.DrawCircle( "Pickups", vSpot, 2.5 );
            }

            // outline
            Line2 left = trueCentreLine.offset( dWidth / 2, Vec2.left );
            Line2 right = trueCentreLine.offset( dWidth / 2, Vec2.right );
            //Line2 perpendicular = trueCentreLine.perpendicular( Vec2.right );
            //	perpendicular.v1 = left.v1;
            d.DrawLine( "Pickups", left );
            d.DrawLine( "Pickups", right );

            double dAngle = 180 * left.direction.angleBetween( Vec2.down ) / Math.PI;
            d.DrawArc( "Pickups", trueCentreLine.v1, dWidth / 2, dAngle, 180 + dAngle );
            d.DrawArc( "Pickups", trueCentreLine.v2, dWidth / 2, 180 + dAngle, dAngle );
        }
Esempio n. 2
0
        //---------------------------------------------------------------------
        public void Draw( Drawer d )
        {
            d.AddLayer( "Scale", Color.FromArgb( 255, 255, 255, 255 ) );
            d.AddLayer( "FretCentres", Color.FromArgb( 255, 0, 192, 192 ) );
            d.AddLayer( "Fretwire", Color.FromArgb( 255, 192, 192, 192 ) );
            d.AddLayer( "StringCenterLines", Color.FromArgb( 255, 255, 255, 255 ) );
            d.AddLayer( "Strings", Color.FromArgb( 255, 255, 255, 255 ) );
            d.AddLayer( "FretBoard", Color.FromArgb( 255, 255, 255, 255 ) );
            d.AddLayer( "Saddles", Color.FromArgb( 255, 255, 255, 0 ) );
            d.AddLayer( "SaddleScrews", Color.FromArgb( 255, 255, 192, 0 ) );

            // find out what strings we need
            double[] stringWidths = new double[ m_iStringCount ];
            double[] stringCompensations = new double[ m_iStringCount ];
            for( int i = 0; i < m_iStringCount; ++i )
            {
                double dResultantTension = 0;
                StringInfo s = GetIdealString( i, ref dResultantTension );
                stringWidths[ i ] = s.m_dDiameter * 25.4;
                stringCompensations[ i ] = GetRequiredCompensation( i, m_dStringHeightAt12th );
            }

            RectangleF extents = RoughExtents;
            double fMaxScale = Math.Max( m_fBassScaleLength, m_fTrebleScaleLength );

            d.SetLimits( extents.Left, extents.Top, extents.Right, extents.Bottom );

            // draw centreline & lines showing the scale points for the two scales
            d.DrawLine( "Scale", -30, 0, fMaxScale + 30, 0 );
            //	d.DrawLine( "Scale", 0, TotalBridgeStringSpacing / 2 + 30, 0, -TotalBridgeStringSpacing / 2 - 30 );
            //	if( m_fBassScaleLength != m_fTrebleScaleLength )
            //		d.DrawLine( "Scale", scaleTrebleOffset, TotalBridgeStringSpacing / 2 + 30, scaleTrebleOffset, -TotalBridgeStringSpacing / 2 - 30 );

            // find fret locations
            Line2[] fretLines = new Line2[ m_iFretCount + 1 ];
            for( int i = 0; i < m_iFretCount + 1; ++i )
            {
                fretLines[ i ] = GetFretLine( i );
            }
            /*
            # do constant-spacing based string spacing, to take each string's thickness into account
            #spacingLeft = TotalNutStringSpacing + stringWidths[ 0 ] / 2 + stringWidths[ stringCount - 1 ] / 2
            #for i in range( stringCount ):
            #    spacingLeft -= stringWidths[ i ]
            #spacingBetweenStrings = spacingLeft / ( stringCount - 1.0 )

            #positionUpto = 0
            #stringPositions = list()
            #for i in range( stringCount ):
            #    stringPositions.append( positionUpto / TotalNutStringSpacing )
            #    print( "string %i nut position %.3f" % (i, positionUpto ))
            #    if( i != stringCount - 1 ):
            #        positionUpto += stringWidths[ i ] / 2
            #        positionUpto += spacingBetweenStrings
            #        positionUpto += stringWidths[ i + 1 ] / 2
            */

            // properly figure out the fretboard outlines, taking into account zero fret, etc etc etc...
            Line2 zeroFretLine = new Line2( fretLines[ 0 ] );
            Line2 nutLineLeft;
            if( !m_bZeroFret )
                nutLineLeft = zeroFretLine;
            else
                nutLineLeft = zeroFretLine.offset( m_dZeroFretNutOffset, Vec2.right );
            Line2 nutLineRight = nutLineLeft.offset( m_dNutWidth, Vec2.right );
            Line2 fbEndLine = new Line2( fretLines[ m_iFretCount ] );
            Line2 fret12Line = fretLines[ 12 ];

            Vec2 bassLine0 = new Vec2( 0, 0 );
            Vec2 bassLine12th = new Vec2( 0, 0 );
            zeroFretLine.intersectInfinite( new Line2( 0, FretboardWidthAtNut / 2, 100, FretboardWidthAtNut / 2 ), ref bassLine0 );
            fretLines[ 12 ].intersectInfinite( new Line2( 0, FretboardWidthAt12th / 2, 100, FretboardWidthAt12th / 2 ), ref bassLine12th );

            Line2 fbBassLine = new Line2( bassLine0, bassLine12th ); //new Line2( //stringTopEdges[ 0 ].offset( edgeOfFretboardSpacing, Vec2.up );
            Line2 fbTrebleLine = fbBassLine.mirror( new Line2( 0, 0, 1, 0 ) ); //stringBottomEdges[ m_iStringCount - 1 ].offset( edgeOfFretboardSpacing, Vec2.down );
            fbEndLine.v1.x -= 8;
            fbEndLine.v2.x -= 8;
            nutLineLeft.trimToInfinite( fbBassLine, Vec2.down );
            nutLineLeft.trimToInfinite( fbTrebleLine, Vec2.up );
            nutLineRight.trimToInfinite( fbBassLine, Vec2.down );
            nutLineRight.trimToInfinite( fbTrebleLine, Vec2.up );
            fbEndLine.trimToInfinite( fbBassLine, Vec2.down );
            fbEndLine.trimToInfinite( fbTrebleLine, Vec2.up );
            fbBassLine.trimToInfinite( fbEndLine, Vec2.right );
            fbBassLine.trimToInfinite( nutLineRight, Vec2.left );
            fbTrebleLine.trimToInfinite( fbEndLine, Vec2.right );
            fbTrebleLine.trimToInfinite( nutLineRight, Vec2.left );

            // draw fretboard
            d.DrawLine( "FretBoard", nutLineLeft );
            d.DrawLine( "FretBoard", nutLineRight );
            d.DrawLine( "FretBoard", fbEndLine );
            d.DrawLine( "FretBoard", fbBassLine );
            d.DrawLine( "FretBoard", fbEndLine );
            d.DrawLine( "FretBoard", fbTrebleLine );

            // draw frets
            for( int i = 0; i <= m_iFretCount; ++i )
            {
                if( i == 0 && !m_bZeroFret )
                    continue;

                Line2 fret = fretLines[ i ];
                fret.extendToInfinite( fbBassLine );
                fret.extendToInfinite( fbTrebleLine );
                d.DrawLine( "FretCentres", fret );

                // fretwire
                Line2 fretRight = fret.offset( m_dFretwireWidth / 2, Vec2.right );
                fretRight.trimToInfinite( fbBassLine, Vec2.down );
                fretRight.trimToInfinite( fbTrebleLine, Vec2.up );
                d.DrawLine( "Fretwire", fretRight );
                Line2 fretLeft = fret.offset( m_dFretwireWidth / 2, Vec2.left );
                fretLeft.trimToInfinite( fbBassLine, Vec2.down );
                fretLeft.trimToInfinite( fbTrebleLine, Vec2.up );
                d.DrawLine( "Fretwire", fretLeft );

                // put a little ellipse at the end to make it purty
                //d.DrawEllipseArc( "Fretwire", fretLeft.v2, fretRight.v2, 0.5, fretLeft.v2, fretRight.v2 );
            }

            // draw strings
            Line2[] stringLines = new Line2[ m_iStringCount ];
            Vec2[] saddleSpots = new Vec2[ m_iStringCount ];
            double dMaxSaddleX = -10000000.0f;
            double dMinSaddleX = 10000000.0f;

            for( int i = 0; i < m_iStringCount; ++i )
            {
                stringLines[ i ] = GetStringLine( i );
                stringLines[ i ].trimToInfinite( nutLineRight, Vec2.left );

                // calculate the estimated string intonation point
                saddleSpots[ i ] = stringLines[ i ].v1 + stringLines[ i ].direction * -stringCompensations[ i ];
                saddleSpots[ i ].y = stringLines[ i ].v1.y;
                dMaxSaddleX = Math.Max( dMaxSaddleX, saddleSpots[ i ].x );
                dMinSaddleX = Math.Min( dMinSaddleX, saddleSpots[ i ].x );

                // extend the string out to the saddle
                Line2 saddleLine = new Line2( saddleSpots[ i ].x, saddleSpots[ i ].y + 5.0f, saddleSpots[ i ].x, saddleSpots[ i ].y - 5.0f );
                stringLines[ i ].extendToInfinite( saddleLine );

                Line2 topEdge = stringLines[ i ].offset( stringWidths[ i ] / 2.0, Vec2.up );
                Line2 bottomEdge = stringLines[ i ].offset( stringWidths[ i ] / 2.0, Vec2.down );
                topEdge.trimToInfinite( nutLineRight, Vec2.left );
                bottomEdge.trimToInfinite( nutLineRight, Vec2.left );
                d.DrawLine( "StringCenterLines", stringLines[ i ] );
                d.DrawLine( "Strings", topEdge );
                d.DrawLine( "Strings", bottomEdge );

                //d.DrawLine( "Saddles", saddleLine );
            }

            // figure out where the saddle screw should go, based on its max adjustment
            //double dMaxSaddleAdjustment = 8.5;
            //double dAdjustmentRangeNeeded = dMaxSaddleX - dMinSaddleX;
            // DrawSaddleScrew will draw at the centre of the adjustment, so figure out an X that keeps everything close to the middle range

            // draw saddles & saddle screws
            for( int i = 0; i < m_iStringCount; ++i )
            {
                DrawSaddle( d, saddleSpots[ i ] );

                // draw min & max compensation points
                Vec2 minSaddleSpot = GetStringLine( i ).v1 + GetStringLine( i ).direction * -GetRequiredCompensation( i, m_dMinStringHeightAt12th );
                minSaddleSpot.y = saddleSpots[ i ].y;
                Vec2 maxSaddleSpot = GetStringLine( i ).v1 + GetStringLine( i ).direction * -GetRequiredCompensation( i, m_dMaxStringHeightAt12th );
                maxSaddleSpot.y = saddleSpots[ i ].y;

                //DrawSaddle( d, minSaddleSpot );
                //DrawSaddle( d, maxSaddleSpot );

                if( m_fBassScaleLength == m_fTrebleScaleLength )
                {
                    Vec2 screwSpot = new Vec2( saddleSpots[ i ].x, saddleSpots[ i ].y );
                    screwSpot.x = ( dMinSaddleX + dMaxSaddleX ) * 0.5;
                    DrawSaddleScrew( d, screwSpot );
                }
                else
                {
                    DrawSaddleScrew( d, saddleSpots[ i ] );
                }
            }

            d.AddLayer( "FretMarkers", Color.FromArgb( 255, 255, 255, 255 ) );
            //d.DrawCircle( "FretMarkers", new Vec2( 0, 0 ), 4 );
            DrawFretMarker( d, fretLines, 3 );
            DrawFretMarker( d, fretLines, 5 );
            DrawFretMarker( d, fretLines, 7 );
            DrawFretMarker( d, fretLines, 9 );
            DrawFretMarker( d, fretLines, 12, true );
            DrawFretMarker( d, fretLines, 15 );
            DrawFretMarker( d, fretLines, 17 );
            DrawFretMarker( d, fretLines, 19 );
            DrawFretMarker( d, fretLines, 21 );
            DrawFretMarker( d, fretLines, 24, true );

            // draw pickup positions
            DrawPickup( d, m_bridgePickup );
            DrawPickup( d, m_middlePickup );
            DrawPickup( d, m_neckPickup );

            /*			# draw some comparison pickup positions
            fStratNeckPos = 6.375 / 25.5
            fStratMiddlePos = 3.875 / 25.5
            fStratBridgePos = 1.625 / 25.5
            fStratBridgeBassPos = 1.815 / 25.5
            fStratBridgeTreblePos = 1.435 / 25.5
            fJBNeckPos = 6 / 34.0
            fJBBridgePos = 2.13 / 34.0
            fPRSNeckPos = 148 / 635.0
            fPRSBridgePos = 43 / 635.0

            fNewNeckPos1 = interpolate( 1/3.0, fJBNeckPos, fPRSNeckPos )
            fNewNeckPos2 = interpolate( 2/3.0, fJBNeckPos, fPRSNeckPos )

            writeScalePos( f, fStratNeckPos, "StratPickups", bridgeStringLine, nutStringLine )
            writeScalePos( f, fStratMiddlePos, "StratPickups", bridgeStringLine, nutStringLine )
            writeAngledScalePos( f, fStratBridgeBassPos, fStratBridgeTreblePos, "StratPickups", bridgeStringLine, nutStringLine )
            writeScalePos( f, fJBNeckPos, "JBPickups", bridgeStringLine, nutStringLine )
            writeScalePos( f, fJBBridgePos, "JBPickups", bridgeStringLine, nutStringLine )
            writeScalePos( f, fPRSNeckPos, "PRSPickups", bridgeStringLine, nutStringLine )
            writeScalePos( f, fPRSBridgePos, "PRSPickups", bridgeStringLine, nutStringLine )
            writeScalePos( f, fNewNeckPos1, "TristanPickups", bridgeStringLine, nutStringLine )
            writeScalePos( f, fNewNeckPos2, "TristanPickups", bridgeStringLine, nutStringLine )
            */
        }