#! drawj2d -T svg -r96 -W 150 -H 60 -X 30 -Y 20 ExampleCable2.hcl
unitlength [/ 1. 50.] m
forceunitlength 1
# bearings
set A {0 0}; dot $A; lb A SW
set B {3.0 0}; dot $B; lb B SE
# cable angle at A
set alpha 35
# forces acting on the cable
pen blue 0.35
set Q1 "0.5 0 0 5"; force2 $Q1
set Q2 "1.0 0 0 7"; force2 $Q2
set Q3 "1.5 0 3 12"; force2 $Q3
set Q4 "2.0 0 0 6"; force2 $Q4
set Q5 "2.5 0 0 4"; force2 $Q5
# resultant
set R [stat.add $Q1 $Q2 $Q3 $Q4 $Q5]
set C [XY [stat.move $R $A [++ $A [geom.polar $alpha]]]]
pen dashed gray
point $C; lb C SW
line $A $C $B
# global moment equilibrium at pos. B in order to get force FA
pen solid green
moveto $B
set fA "$A [geom.polar $alpha]"
set FA [stat.mequi $fA $R]
force $FA
# equilibrium to get force FB
set FB [stat.equi $R $FA]
set FB [stat.move $FB $A $B]; # move along action line
force $FB
# cable geometry
pen
set F1 [stat.equi $FA $Q1]
set F2 [--- $F1 $Q2]
set F3 [--- $F2 $Q3]
set F4 [--- $F3 $Q4]
set F5 [--- $F4 $Q5]
set C1 [XY [stat.move $Q1 [XY $FA] [stat.tip $FA]]]; point $C1
set C2 [XY [stat.move $Q2 [XY $F1] [stat.tip $F1]]]; point $C2
set C3 [XY [stat.move $Q3 [XY $F2] [stat.tip $F2]]]; point $C3
set C4 [XY [stat.move $Q4 [XY $F3] [stat.tip $F3]]]; point $C4
set C5 [XY [stat.move $Q5 [XY $F4] [stat.tip $F4]]]; point $C5
line $A $C1 $C2 $C3 $C4 $C5 $B
moveto $A; # verify the forces F5 and FB are equal
assert "[stat.moment $F5] ~= [stat.moment $FB]" {moment check F5 = FB}
assert "[stat.abs $F5] ~= [stat.abs $FB]" {check F5 = FB}
# force polygon
moveto 5 0; set posPolygon [here]
pen blue 0.3; font 3
texforce [FXY $Q5] Q5
texforce [FXY $Q4] Q4
texforce [FXY $Q3] Q3
texforce [FXY $Q2] Q2
texforce [FXY $Q1] Q1
pen green
texforce [FXY $FA] F_A
texforce [FXY $FB] F_B
# verify the force polygon is closed
assert "[geom.distance $posPolygon] ~= 0" {equilibrium check}