Board Logo
« Hello there is a problem »

Welcome Guest. Please Login or Register.
Jan 21st, 2018, 12:52am


Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Please use the forums Search feature before asking.
Please post code using the code box described in Format Your Messages.
This will keep indentation, separate it better form the message and prevent gibberish.
If the code is too long for one post or additional files are needed, upload a ZIP archive to the Just BASIC Files Archive Site.

« Previous Topic | Next Topic »
Pages: 1 2 3  Notify Send Topic Print
 veryhotthread  Author  Topic: Hello there is a problem  (Read 632 times)
Valentin
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 130
xx Hello there is a problem
« Thread started on: Oct 28th, 2017, 06:01am »

Why the lever twists?
Please consolidate
Thank you
Code:
     NOMAINWIN
    WindowWidth = 600
    WindowHeight = 400
    UpperLeftX = (DisplayWidth-WindowWidth)-200
    UpperLeftY = 20 ' (DisplayHeight-WindowHeight)
    TEXTBOX #w.pa, 50 , 50, 80, 25
    BUTTON #w.eq, "Equal", [equ], UL, 270, 50, 50, 20
    TEXTBOX #w.pb, 500 , 50, 80, 25
    TEXTBOX #w.la, 50 , 300, 80, 25
    TEXTBOX #w.lb, 500 , 300, 80, 25
    TEXTBOX #w.testa, 210 , 300, 80, 25
    TEXTBOX #w.testb, 310 , 300, 80, 25
    TEXTBOX #w.testc, 250 , 335, 80, 25
    GRAPHICBOX #w.m 5, 5, 585, 360
    OPEN "Gloups !" FOR window_nf AS #w
    #w, "TRAPCLOSE [close]"
   ' #w.m, "when leftButtonDown [scanne]"
    #w.m, "when leftButtonMove [scanne]"
  [equ]
    dim piv(2): piv(1)=300: piv(2)=200: xa=50
    pa=50: pb=50: la=200: lb=200
    #w.pa, str$(pa);" Kg": #w.pb, str$(pb);" Kg"
    #w.la, str$(la);" cm": #w.lb, str$(lb);" cm"
    #w.testa, str$(la/pa): #w.testb, str$(lb/pb)
    dif=(la/pa)-(lb/pb)
    #w.testc, str$(dif)
    #w.m , "down"
    #w.m , "fill blue; color yellow; backcolor blue"
    #w.pa, "!contents? var$":pa=val(var$): #w.pb, "!contents? var$":pb=val(var$)
    dif=(la/pa)-(lb/pb)
  [draw]
    #w.m , "size 2": #w.m , "fill blue"
        #w.m, "PLACE 350 245": #w.m, "\ < Click and move >"
    #w.m, "PLACE 220 280": #w.m, "\ la/pa": #w.m, "PLACE 320 280": #w.m, "\ lb/lpb"
    #w.m, "PLACE 150 345": #w.m, "\ (la/pa)-(lb/pb)"
    #w.m, "line ";piv(1);" ";piv(2);" ";piv(1)+10;" ";piv(2)+30
    #w.m, "line ";piv(1);" ";piv(2);" ";piv(1)-10;" ";piv(2)+30
    #w.m , "color yellow; backcolor yellow"
    #w.m, "PLACE ";piv(1)-20;" ";piv(2)+30: #w.m, "boxfilled ";piv(1)+20;" ";piv(2)+50
    #w.m , "color black; backcolor yellow"
    #w.m, "PLACE ";piv(1)-20;" ";piv(2)+45: #w.m, "\ <": #w.m, "PLACE ";piv(1)+5;" ";piv(2)+45: #w.m, "\ >"
    #w.m , "color red"
   ' #w.m, "line ";"50";" ";piv(2);" ";piv(1);" ";piv(2): #w.m, "line ";piv(1);" ";piv(2);" ";"550";" ";piv(2)
    #w.m, "line ";"50";" ";piv(2)+dif*10;" ";piv(1);" ";piv(2) ' Here is not good
    #w.m, "line ";piv(1);" ";piv(2);" ";"550";" ";piv(2)-dif*10 ' And here so
  wait
  [scanne]
    #w.pa, "!contents? var$":pa=val(var$): #w.pb, "!contents? var$":pb=val(var$)
    mx=MouseX: my=MouseY
    if my>piv(2)+30 and my<piv(2)+50 then
       if mx<piv(1)-20 then
          piv(1)=piv(1)-5
          la=la-4: #w.la, str$(la);" cm": lb=lb+4: #w.lb, str$(lb);" cm"
          #w.testa, str$(la/pa): #w.testb, str$(lb/pb)
          dif=(la/pa)-(lb/pb): #w.testc, str$(dif)
          goto [draw]
       end if
       if mx>piv(1)+20 then
          piv(1)=piv(1)+5
          la=la+4: #w.la, str$(la);" cm": lb=lb-4: #w.lb, str$(lb);" cm"
          #w.testa, str$(la/pa): #w.testb, str$(lb/pb)
          dif=(la/pa)-(lb/pb): #w.testc, str$(dif)
          goto [draw]
       end if
    end if
  wait
  [close]
    CLOSE  #w
    END
 
« Last Edit: Oct 28th, 2017, 09:38am by Valentin » User IP Logged

Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3151
xx Re: Hello there is a problem
« Reply #1 on: Oct 28th, 2017, 12:31pm »

Not sure I am understanding what you want to display. A balance arm will just swing right round to the end that is heaviest. A lever arm will continue to move also.

If you are looking to "balance" forces the pivot point should move but the arm should always be horizontal?
User IP Logged

Valentin
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 130
xx Re: Hello there is a problem
« Reply #2 on: Oct 28th, 2017, 12:55pm »

I would like to visualize the break of equilibrium by the displacement of the pivot, then later by the variations of left and right weights.
User IP Logged

bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1255
xx Re: Hello there is a problem
« Reply #3 on: Oct 28th, 2017, 2:30pm »

He wants a straight line, of course!

But I think it's kind of cute just how it is, a straight line would be kind of boring, like waiting for JB v 2.0! grin wink laugh

It just so happens I might be bored enough to help with the board.
User IP Logged

B+
Valentin
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 130
xx Re: Hello there is a problem
« Reply #4 on: Oct 28th, 2017, 2:38pm »

@bplus: Yes, it's funny, but it's not normal that the lever twists with only 50kg; and in addition, it twists in the wrong direction.
There is a problem !!!!!
User IP Logged

bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1255
xx Re: Hello there is a problem
« Reply #5 on: Oct 28th, 2017, 2:59pm »

Normally I'd agree, but I've been in funny mood lately, sorry.

L = length of board
w1 = one weight say left one
w2 = the other weight on right
x = pivot point to make board level ( it should always be straight because that is normal, unless you are an engineer and want to factor in the slight bend in board caused by heavier and heavier weights until it breaks).

For board to be straight and level:
x * w1 = (L - x) * w2

Solving for x = L * w1 / (w1 + w2)

So x = place to put pivot from left end to keep the board level.


Oh we need to know how high the pivot is from the normally level ground.

and then imagine sliding the pivot between ground and pivot from one end to the other... forget about weight differences the board length itself will provide weight difference....

Quote:
I would like to visualize the break of equilibrium by the displacement of the pivot, then


OK, slide the pivot see what happens...

I've got to check my drawing board, be right back.


« Last Edit: Oct 28th, 2017, 3:19pm by bplus » User IP Logged

B+
Valentin
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 130
xx Re: Hello there is a problem
« Reply #6 on: Oct 28th, 2017, 4:04pm »

Yes, I will add a line of ground on which the board will land
The problem is the board that is writhing
And that's not normal. undecided huh sad
User IP Logged

bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1255
xx Re: Hello there is a problem
« Reply #7 on: Oct 28th, 2017, 4:28pm »

OK imagine pivot at one end, say right end.

The lever makes angle = arcSin( pivot height / lever length)

move pivot towards center, say x distance from other end of board which always stays on ground until x reaches absolute center, then board levels.

what is angle as x goes to center:
A = arcSin (Pivot_height / x_along_ground)

so the end point of the high end of lever is
x = xStationaryEndPoint + L * cos(-A)
y = yStationaryEndPoint + L * sin(-A)

so that is our straight line:
point1 = (xStationaryEndPoint, yStationaryEndPoint)
point2 = (xStationaryEndPoint + L * cos(-A) ,yStationaryEndPoint + L * sin(-A) )

when the pivot goes from right end to just before dead center.

There are only 3 states the balance beam will be in,
1. left side on the ground the right in air
2. both sides level off ground
3. the right side on ground with left end in air
perfectly symmetrical to case 1)

The max height of up end = 2*pivot_height
The lowest = pivot_height

Well that's my theory and I am sticking with until I prove myself wrong trying to draw it.

Edit: arcTan changed to arcSin (L is hypotenuse)
« Last Edit: Oct 28th, 2017, 6:46pm by bplus » User IP Logged

B+
bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1255
xx Re: Hello there is a problem
« Reply #8 on: Oct 28th, 2017, 7:19pm »

Rough Cut, main section of interest is the plug-in section.
Code:
'lever test.txt
'new a number of graphic subs pset, line, circ, fcirc, ellips, fellipse
'wait4key$ (revised to return the key), at ,cp, seyes

global pi, xmax, ymax  'these two you can easily reset to your needs
'set these to screen width = xmax, screen height = ymax, that you want
pi = acs(-1)
xmax = 500 : ymax = 500  '<<<<<< set this as you need or from plug-in notes

global cellW, cellH
'do not mess with cellW and cellH globals for printing
cellW = 10 '10 pixels wide for characters
cellH = 20 '20 pixels high for characters
global maxRow, maxCol
'and then these are calclated from above globals
maxCol = int(xmax / cellW)  'these control printing characters
maxRow = int(ymax / cellH)
global lastC, lastR 'for loc8 (locate), pl (print a line), lp (locate and print)
lastC = 1 : lastR = 1

'mouse and key events update globals with latest info
global inkee$
global mouseX, mouseY
global lbdX, lbdY, lbmX, lbmY, lbuX, lbuY  'using -99 for inactive positions
global rbdX, rbdY, rbmX, rbmY, rbuX, rbuY  'using -99 for inactive positions

dim qb$(15) 'thanks Andy Amaya for use with his sub qColor fore, back
qb$( 0) = "  0   0   0" 'black
qb$( 1) = "  0   0 128" 'blue
qb$( 2) = "  8 128   8" 'green
qb$( 3) = "  0 128 128" 'cyan
qb$( 4) = "128   0   0" 'red
qb$( 5) = "128   0 128" 'magenta
qb$( 6) = "128  64  32" 'brown
qb$( 7) = "168 168 168" 'white
qb$( 8) = "128 128 128" 'grey
qb$( 9) = " 84  84 252" 'light blue
qb$(10) = " 42 252  42" 'light green
qb$(11) = "  0 220 220" 'light cyan
qb$(12) = "255   0   0" 'light red
qb$(13) = "255  84 255" 'light magenta
qb$(14) = "255 255   0" 'yellow
qb$(15) = "255 255 255" 'bright white

nomainwin

WindowWidth = xmax + 8
WindowHeight = ymax + 32
UpperLeftX = (DisplayWidth-WindowWidth) / 2
UpperLeftY = (DisplayHeight-WindowHeight) / 2

'graphicbox #gr, 2, 2, xmax-2, ymax-2
open "Lever Test" for graphics_nsb_nf as #gr '<, == change for plug in modules
#gr "trapclose quit"

'fonts that don't work arial, tahoma, verdana
'fonts that work
'#gr "font courier_new 10 20"
'#gr "font consolas 10 20"
#gr "font dejavu_sans_mono 10 20"

#gr "home"                  '< check drawing area
#gr "posxy w2 h2"           '<<<<<<<<<<<<<<<<<<
'notice "Screen Drawing Check";chr$(13);"Size:" + chr$(13) + "Width (w2*2) = ";w2*2;",  Height (h2*2) = ";h2*2

#gr "setfocus"
#gr "when mouseMove mMove"
#gr "when leftButtonDown leftDown"
#gr "when leftButtonMove leftMove"
#gr "when leftButtonUp leftUp"
#gr "when rightButtonDown rightDown"
#gr "when rightButtonMove rightMove"
#gr "when rightButtonUp rightUp"
#gr "when characterInput charIn"
#gr "down"
'========================================================== plug-in main modules here
yS = 300 : L = 500 : PivotHeight = 50
while 1
    scan
    call hue 255, 255, 225
    call fbox 0, 0, xmax, ymax
    mx = mouseX
    if mx < L and mx > 0 then
        if mx > .5*L + .001 then xS  = 0 else xS = L
        b = mx
    end if
    call hue 0, 128, 0
    call aline 0, 300, L, 300
    if b > .5 * L +.01 then
        A = asn(PivotHeight  /b)
        call hue 255, 0, 0
        call aline xS + b, 300, xS + b, 300 - PivotHeight
        call hue 0, 0, 255
        call aline xS, yS, xS + L * cos(-1*A), yS + L * sin(-1*A)
    else
        if .5 * L - .01 <= b and b <= .5 * L + .01 then
            call hue 255, 0, 0
            call aline  b, 300,  b, 300 - PivotHeight
            call hue 0, 0, 255
            call aline 0, 300 - PivotHeight, L, 300 - PivotHeight
        else
            'xS = 500
            A = asn(PivotHeight/(L- b))
            call hue 255, 0, 0
            call aline b, 300, b, 300 - PivotHeight
            call hue 0, 0, 255
            call aline xS, yS, xS + L * cos(pi + A), yS + L * sin(pi + A)
        end if
    end if
    call pause 30
wend

wait ' ======= DE procedures color, drawing, events very useful subs or functions

sub mMove hdl$, mx, my
    mouseX = mx : mouseY = my
end sub

' dont want to use Boolean 0 for non active button so am using -99
sub leftDown hdl$, mx, my  'must have handle and mouse x,y
    lbdX = mx : lbdY = my
    lbuX = -99 : lbuY = -99
    lbmX = -99 : lbmY = -99
end sub

sub leftMove hdl$, mx, my  'must have handle and mouse x,y
    lbmX = mx : lbmY = my
end sub

sub leftUp hdl$, mx, my  'must have handle and mouse x,y
    lbuX = mx : lbuY = my
    lbdX = -99 : lbdY = -99
    lbmX = -99 : lbmY = -99
end sub

sub rightDown hdl$, mx, my  'must have handle and mouse x,y
    rbdX = mx : rbdY = my
    rbuX = -99 : rbuY = -99
    rbmX = -99 : rbmY = -99
end sub

sub rightMove hdl$, mx, my  'must have handle and mouse x,y
    rbmX = mx : rbmY = my
end sub

sub rightUp hdl$, mx, my  'must have handle and mouse x,y
    rbuX = mx : rbuY = my
    rbdX = -99 : rbdY = -99
    rbmX = -99 : rbmY = -99
end sub

sub charIn hdl$, c$
    inkee$ = c$ 
end sub

sub quit hdl$
    timer 0
    close #gr
    end
end sub

sub clear r, g, b 'clear screen to new RGB color and set backcolor
' and set up so pl (print line) will start at line 1, cell column 1)
    #gr "fill ";r;" ";g;" ";b
    #gr "backcolor ";r;" ";g;" ";b
    lastC = 1 : lastR = 1
end sub

sub fore r, g, b 'set fore color lines pixels text
    #gr "color ";r;" ";g;" ";b
end sub

sub back r, g, b 'set background color for fills
    #gr "backcolor ";r;" ";g;" ";b
end sub

sub hue r, g, b 'fore and back RGB color system
'hue sets both fore and backcolor for filled graphics commands fbox, fcirc, fellipse
    #gr "color ";r;" ";g;" ";b
    #gr "backcolor ";r;" ";g;" ";b
end sub

sub cstr rgb$
    #gr "color ";rgb$
end sub

sub bstr rgb$
    #gr "backcolor ";rgb$
end sub

Sub qColor foreColor, backColor 'thanks Andy Amaya old QB color system
    #gr "Color ";qb$(foreColor);";BackColor ";qb$(backColor)
End Sub

sub seyes thickness  'pixel, line, border size for box, fbox, circ, fcirc...
    #gr "size ";thickness
end sub

sub pset x, y 'set pixel at x, y (at whatever the current fore color is)
    #gr "set ";x;" ";y
end sub

sub aline x0, y0, x1, y1 'somethimes you might want to spec a pixel longer on end x1, y1
    #gr "line ";x0;" ";y0;" ";x1;" ";y1  'add 1 to end point
end sub

sub box x0, y0, x1, y1  'box two corners x0, y0 and x1, y1
    #gr "place ";x0;" ";y0
    #gr "box ";x1;" ";y1
end sub

sub fbox x0, y0, x1, y1   'fill box two corners x0, y0 and x1, y1
    #gr "place ";x0;" ";y0
    #gr "boxfilled ";x1;" ";y1
end sub

sub circ x, y, radius ' just circle border at center x,y
    #gr "place ";x;" ";y;"; circle ";radius
end sub

sub fcirc x, y, radius ' fill circle x,y center
    #gr "place ";x;" ";y;"; circlefilled ";radius
end sub

sub ellips x, y, w, h  '< no e on end! just ellipse border
    #gr "place ";x;" ";y;"; ellipse ";w;" ";h
end sub

sub fellipse x, y, w, h  ' fill ellipse
    #gr "place ";x;" ";y;"; ellipsefilled ";w;" ";h
end sub

sub loc8 x, y   'locate xColumnCell, yRowCell for printing
    if 0 < x and x < maxCol + 1 and 0 < y and y < maxRow + 1 then
        lastC = x
        lastR = y
    end if
end sub

sub pl mess$ 'print line (feed)
    startR = lastR
    for i = 1 to len(mess$)
        scan
        call lp lastC, lastR, mid$(mess$, i, 1)
        if lastR <> startR then exit for
    next
    lastC = 1
    lastR = startR + 1
    if lastR > maxRow then lastR = maxRow 'yuck!
end sub

sub lp x, y, mess$ 'locate x, y : print mess$ lp = locate and print
    'if locate = x col and y row then and top left corner locates as 1, 1
    c = x - 1: r = y
    if 0 < x and x < maxCol + 1 and 0 < y and y < maxRow + 1 then
        #gr "place ";c * cellW;" ";r * cellH - 4
        #gr "|";mess$
        lastC = x + len(mess$)
        if lastC > maxCol then lastC = 1 : lastR = lastR + 1
        if lastR > maxRow then lastR = maxRow 'yuck!
    end if
end sub

sub cp y,cpText$ 'cp Center Print on line y the cpText$
    call lp int((maxCol-len(cpText$))/2+1.5),y,cpText$
end sub

sub inp prmpt$, byref var$   'input
'prints prompt at lastC, lastR and leaves lastC = 1 lastR = pRow + 1

    inkee$ = "" 'clear last key (new fix for DE5)
    call lp lastC, lastR, prmpt$;"{"
    'this will update lastR and lastC to the starting point of input variable
    pRow = lastR : pCol = lastC 'save these for redrawing var
    call lp pCol, pRow, "}"
    OK$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"
    OK$ = OK$+ chr$(8)+ chr$(27) + chr$(13) + "1234567890!@#$%^&*()_-+={}[]|\:;'<,>.?/"
    do
        scan
        if instr(OK$, inkee$) then
            if inkee$ = Chr$(8) then
                if t$ <> "" then
                    if Len(t$)=1 then t$="" else t$=Left$(t$,Len(t$)-1)
                end if
            else
                if inkee$=Chr$(13) or inkee$=Chr$(27) then
                    'new D5, I was expecting nothing in return for my esc
                    if inkee$ = chr$(27) then t$ = ""
                    exit do
                else
                    t$=t$;inkee$
                end if
            end if
            call lp pCol, pRow, t$;"} "
            inkee$ = ""
        end if
    loop until done
    var$ = t$
    lastC = 1 : lastR = pRow + 1
end sub

sub at xPix, yPix, char$  'print a string at pixel x, y This pin point locating.
    #gr "place ";xPix;" ";yPix
    #gr "|";char$ 
end sub

function wait4key$() 'updated for DE6 from sub to function like input$(1)
'This function stops program flow for keypress, and returns keypress
    inkee$ = ""
    while len(inkee$) = 0 : scan : k$ = inkee$ : wend
    wait4key$ = k$
end function

sub pause mil   'tsh version has scan built-in
    t0 = time$("ms")
    while time$("ms") < t0 + mil : scan : wend
end sub

function sMult$(s$, mult) 'xerox a copy of a string mult times
    for i = 1 to mult
        rtn$ = rtn$ + s$
    next
    sMult$ = rtn$
end function

function rand(n1, n2)  'very handy for screen saver like eye candy
    if n1 > n2 then hi = n1 : lo = n2 else hi = n2 : lo = n1
    rand = int((hi - lo + 1) * rnd(0)) + lo
end function

 
« Last Edit: Oct 28th, 2017, 7:23pm by bplus » User IP Logged

B+
bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1255
xx Re: Hello there is a problem
« Reply #9 on: Oct 28th, 2017, 7:54pm »

Oh shoot, now that I've done it the hard way, with barely an idea for handling different weights, I see a way easier way based on using different weights. wink

User IP Logged

B+
bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1255
xx Re: Hello there is a problem
« Reply #10 on: Oct 28th, 2017, 8:13pm »

Oh hey! If neither side touches the ground, the pivot is longer than the lever, then the thing goes vertical with the heavy weight at the bottom and light one at top.
User IP Logged

B+
Valentin
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 130
xx Re: Hello there is a problem
« Reply #11 on: Oct 29th, 2017, 05:29am »

@bplus: Your system works very well but is very complex; I only have to adapt it to my program.
If my brain resists your equations.
You borrow me for a year of reflection
« Last Edit: Oct 29th, 2017, 05:50am by Valentin » User IP Logged

bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1255
xx Re: Hello there is a problem
« Reply #12 on: Oct 29th, 2017, 08:17am »

Prayer of Narcissus:
God please save us from our reflections!

I am not God but maybe we can cut a half a year off your reflecting wink

The lever length L is same as our screen width, so we saved our self from extra space to get lost in. xmax = L

For square deal, I made screen height the same ymax = xmax = L
(xmax is my name for screen width, it is maximum x you can still see at right border, ymax is my name for screen height, it is maximum y you can see at bottom edge of screen.)

To ground this exercise, I made the distance from top of screen to ground for pivot 300, not too far from the Golden ratio. 300/500, well anyway, it pleases my eye. (It also puts pivot or 50 exactly in middle of screen when lever has both sides balanced.)

So if we lay the lever on the ground, it extends from one end of the screen to the other x = 0 to 500 at y = 300

Now, prop up one end to pivotHeight say = 50

say the left end stays on ground at (0, 300)

now the other end of the lever is off ground by 50 (300 - 50 = 250)

and we form a right triangle, the hypotenuse, = the lever, falls short of width of screen = 500 but still is 500 because it is bored and won't change.

So we have 2 sides of right triangle therefore we can find the Angle:
A = arcSin(pivotHeight/L) at the left side.

Trig Review: SIN(Angle) = ratio of ( side opposite / hypotenuse )

ArcSin(of trig ratio) is the Angle whose SIN(Angle) = opposite / hypotenuse.

Remember in JB this function will be returned in Radian units not degrees. Either because Radians are rad or radians are warmer than degrees which uses tiny o for unit icon, and we all know 0 degrees is pretty cold and we will need our radiant heaters... I digress.

Where was I? Oh x, where is x when the lever is up in the air?
BTW, the y of the end point of lever up in the air is 300 - pivotHeight. Just one more data item to find to draw our line for lever x.

Back to Trig: x would be side adjacent to Angle on left end, still on ground (0, 300)

The Ratio of the side adjacent / hypotenuse is called COS so COS(A) = adjacent / hypotenuse

therefore side adjacent = hypotenuse * COS(A)

x = L * COS(A)

Now it is time to give our brains a rest, so that we can digest what we've just been served.

but our line coordinates are (0, 300) on left end of lever and
y = 300 - 50 = 250
x = L * COS(A)
so point (L*COS(A), 250) on the right side of lever under which the pivot sleeps bored to death by all this math stuff.

And we all know 2 points make a straight line
(0,300) - (L*COS(A), 250)

And straight lines are what we were after at the start of this thread.

(This is all so much easier to see on chalk board than written out in text! That, plus you need the Trig ratios drilled into your head until you say them in your sleep SIN(A) = opp / hyp and COS(A) = adj/hyp... at least learn those 2 but again you need the diagram! A picture is worth a 1000 words and maybe tsh or Rod has a picture of this basic lesson for right triangles they could add to illustrate what the heck I am going on and on about.)
« Last Edit: Oct 29th, 2017, 09:08am by bplus » User IP Logged

B+
Valentin
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 130
xx Re: Hello there is a problem
« Reply #13 on: Oct 29th, 2017, 10:37am »

Everything is perfectly clear concerning degrees and radiators, hypothenuse and right angles Pythagoras can rest easy. No doubt this beautiful demonstration will serve more than one.
I'm going to bother my brain on your code; I, who do not like subs and functions, are well served.
Thank you very much. smiley
User IP Logged

zzz000abc
Full Member
ImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 268
xx Re: Hello there is a problem
« Reply #14 on: Oct 29th, 2017, 4:09pm »

interesting problem but I think as the pivot moves from the mid point to either extreme the balance beam starts first swinging then touches the ground.
User IP Logged

Pages: 1 2 3  Notify Send Topic Print
« Previous Topic | Next Topic »

Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls