3
$\begingroup$

I want to draw a simple bending moment diagram: enter image description here

I did not draw its exact graph by solving the curve, my aim is to make a simple diagram by the connection between line segments or curves.

The code and the results are as follows:

pts1 = {{0, 0}, {2, -3}, {4, 0}, {5, 1}}; pts2 = {{5, 1}, {8, 1}, {8, 0}}; pts3 = {{0, 0}, {8, 0}}; Graphics@{{Thick, Black, BSplineCurve[pts1], Inset[Style["+", Red, 20], {2, -0.6}]}, {Thick, Black, Line[pts2], Inset[Style["-", Red, 20], {6.5, 0.5}]}, {Thick, Black, Line[pts3]}, Inset[Style["6.4KN\[CenterDot]m", 15], {2, -1.6}], Inset[Style["8KN\[CenterDot]m", 15], {6.5, 1.3}]} 

enter image description here

But I would like to know how to fill in the line between the curve and the axis as in the original graph?

$\endgroup$

1 Answer 1

5
$\begingroup$

Add

{HatchFilling[90 Degree, 1, 15], FilledCurve[{BSplineCurve[pts1], Line[pts2], Line[pts3]}]} 
Graphics@{{{HatchFilling[90 Degree, 1, 15], FilledCurve[{BSplineCurve[pts1], Line[pts2], Line[pts3]}]}, Thick, Black, BSplineCurve[pts1], Inset[Style["+", Red, 20], {2, -0.6}]}, {Thick, Black, Line[pts2], Inset[Style["-", Red, 20], {6.5, 0.5}]}, {Thick, Black, Line[pts3]}, Inset[Style["6.4KN·m", 15], {2, -1.6}], Inset[Style["8KN·m", 15], {6.5, 1.3}]} 

enter image description here

$\endgroup$
1
  • $\begingroup$ thanks, HatchFilling is not available in version 12.0, I'll update my version. $\endgroup$ Commented May 9, 2023 at 11:15

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.