“L shaped†springs in tikz
Clash Royale CLAN TAG#URR8PPP
up vote
5
down vote
favorite
This is my code:
documentclassstandalone usepackagetikz
usetikzlibrarycalc,patterns,decorations.pathmorphing,decorations.markings,positioning
begindocument
tikzsetspring/.style=thick,decorate,decoration=zigzag,pre
length=0.3cm,post length=0.3cm,segment length=6, short
spring/.style=thick,decorate,decoration=zigzag,pre
length=0.05cm,post length=0.05cm,segment length=6,
damper/.style=thick,decoration=markings, mark connection node=dmp,
mark=at position 0.5 with node (dmp) [thick,inner
sep=0pt,transform shape,rotate=-90,minimum width=15pt,minimum
height=3pt,draw=none] ; draw [thick] ($(dmp.north east)+(2pt,0)$)
-- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$); draw [thick] ($(dmp.north)+(0,-5pt)$) --
($(dmp.north)+(0,5pt)$); , decorate,
ground/.style=fill,pattern=north east lines,draw=none,minimum
width=0.75cm,minimum height=0.3cm,
ground_magenta/.style=fill,pattern=north east lines,pattern
color=magenta,draw=none,minimum width=0.75cm,minimum height=0.3cm
begintikzpicture[every node/.style=draw,outer
sep=0pt,thick,font=sffamily]
node (m_1) [minimum width=1cm,minimum
height=0.5cm]$m_1$; node (m_2)[right of= m_1,node
distance=2.5cm,minimum width=1cm,minimum height=0.5cm]$m_2$; draw
[spring] (m_1.east) -- (m_2.west)
node[midway,below=1mm,draw=none]$k_12$; node (ground1) at
(m_1.south west)
[ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] ; draw
(ground1.south west) -- (ground1.south east);
enddocument
How to draw the L Shaped spring in the picture below?
tikz-pgf
add a comment |Â
up vote
5
down vote
favorite
This is my code:
documentclassstandalone usepackagetikz
usetikzlibrarycalc,patterns,decorations.pathmorphing,decorations.markings,positioning
begindocument
tikzsetspring/.style=thick,decorate,decoration=zigzag,pre
length=0.3cm,post length=0.3cm,segment length=6, short
spring/.style=thick,decorate,decoration=zigzag,pre
length=0.05cm,post length=0.05cm,segment length=6,
damper/.style=thick,decoration=markings, mark connection node=dmp,
mark=at position 0.5 with node (dmp) [thick,inner
sep=0pt,transform shape,rotate=-90,minimum width=15pt,minimum
height=3pt,draw=none] ; draw [thick] ($(dmp.north east)+(2pt,0)$)
-- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$); draw [thick] ($(dmp.north)+(0,-5pt)$) --
($(dmp.north)+(0,5pt)$); , decorate,
ground/.style=fill,pattern=north east lines,draw=none,minimum
width=0.75cm,minimum height=0.3cm,
ground_magenta/.style=fill,pattern=north east lines,pattern
color=magenta,draw=none,minimum width=0.75cm,minimum height=0.3cm
begintikzpicture[every node/.style=draw,outer
sep=0pt,thick,font=sffamily]
node (m_1) [minimum width=1cm,minimum
height=0.5cm]$m_1$; node (m_2)[right of= m_1,node
distance=2.5cm,minimum width=1cm,minimum height=0.5cm]$m_2$; draw
[spring] (m_1.east) -- (m_2.west)
node[midway,below=1mm,draw=none]$k_12$; node (ground1) at
(m_1.south west)
[ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] ; draw
(ground1.south west) -- (ground1.south east);
enddocument
How to draw the L Shaped spring in the picture below?
tikz-pgf
add a comment |Â
up vote
5
down vote
favorite
up vote
5
down vote
favorite
This is my code:
documentclassstandalone usepackagetikz
usetikzlibrarycalc,patterns,decorations.pathmorphing,decorations.markings,positioning
begindocument
tikzsetspring/.style=thick,decorate,decoration=zigzag,pre
length=0.3cm,post length=0.3cm,segment length=6, short
spring/.style=thick,decorate,decoration=zigzag,pre
length=0.05cm,post length=0.05cm,segment length=6,
damper/.style=thick,decoration=markings, mark connection node=dmp,
mark=at position 0.5 with node (dmp) [thick,inner
sep=0pt,transform shape,rotate=-90,minimum width=15pt,minimum
height=3pt,draw=none] ; draw [thick] ($(dmp.north east)+(2pt,0)$)
-- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$); draw [thick] ($(dmp.north)+(0,-5pt)$) --
($(dmp.north)+(0,5pt)$); , decorate,
ground/.style=fill,pattern=north east lines,draw=none,minimum
width=0.75cm,minimum height=0.3cm,
ground_magenta/.style=fill,pattern=north east lines,pattern
color=magenta,draw=none,minimum width=0.75cm,minimum height=0.3cm
begintikzpicture[every node/.style=draw,outer
sep=0pt,thick,font=sffamily]
node (m_1) [minimum width=1cm,minimum
height=0.5cm]$m_1$; node (m_2)[right of= m_1,node
distance=2.5cm,minimum width=1cm,minimum height=0.5cm]$m_2$; draw
[spring] (m_1.east) -- (m_2.west)
node[midway,below=1mm,draw=none]$k_12$; node (ground1) at
(m_1.south west)
[ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] ; draw
(ground1.south west) -- (ground1.south east);
enddocument
How to draw the L Shaped spring in the picture below?
tikz-pgf
This is my code:
documentclassstandalone usepackagetikz
usetikzlibrarycalc,patterns,decorations.pathmorphing,decorations.markings,positioning
begindocument
tikzsetspring/.style=thick,decorate,decoration=zigzag,pre
length=0.3cm,post length=0.3cm,segment length=6, short
spring/.style=thick,decorate,decoration=zigzag,pre
length=0.05cm,post length=0.05cm,segment length=6,
damper/.style=thick,decoration=markings, mark connection node=dmp,
mark=at position 0.5 with node (dmp) [thick,inner
sep=0pt,transform shape,rotate=-90,minimum width=15pt,minimum
height=3pt,draw=none] ; draw [thick] ($(dmp.north east)+(2pt,0)$)
-- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$); draw [thick] ($(dmp.north)+(0,-5pt)$) --
($(dmp.north)+(0,5pt)$); , decorate,
ground/.style=fill,pattern=north east lines,draw=none,minimum
width=0.75cm,minimum height=0.3cm,
ground_magenta/.style=fill,pattern=north east lines,pattern
color=magenta,draw=none,minimum width=0.75cm,minimum height=0.3cm
begintikzpicture[every node/.style=draw,outer
sep=0pt,thick,font=sffamily]
node (m_1) [minimum width=1cm,minimum
height=0.5cm]$m_1$; node (m_2)[right of= m_1,node
distance=2.5cm,minimum width=1cm,minimum height=0.5cm]$m_2$; draw
[spring] (m_1.east) -- (m_2.west)
node[midway,below=1mm,draw=none]$k_12$; node (ground1) at
(m_1.south west)
[ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] ; draw
(ground1.south west) -- (ground1.south east);
enddocument
How to draw the L Shaped spring in the picture below?
tikz-pgf
tikz-pgf
edited 1 hour ago


CarLaTeX
26.4k444116
26.4k444116
asked 1 hour ago
iacopo
57319
57319
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
4
down vote
Method 1
Here is a way to do it using -|
which draws a right angle between the two points (ground1.south)
and (m_1.south)
.
But, it requires you to manually adjust the pre length
and post length
of the spring so that it fits nicely in the horizontal segment of the line. Also some adjustment to the position of the label is required.
documentclass[margin=0.5mm]standalone
usepackagetikz
usetikzlibrarycalc,patterns,decorations.pathmorphing,decorations.markings,positioning
begindocument
tikzsetspring/.style=thick,decorate,decoration=zigzag,pre
length=0.3cm,post length=0.3cm,segment length=6, short
spring/.style=thick,decorate,decoration=zigzag,pre
length=0.05cm,post length=0.05cm,segment length=6,
damper/.style=thick,decoration=markings, mark connection node=dmp,
mark=at position 0.5 with node (dmp) [thick,inner
sep=0pt,transform shape,rotate=-90,minimum width=15pt,minimum
height=3pt,draw=none] ; draw [thick] ($(dmp.north east)+(2pt,0)$)
-- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$); draw [thick] ($(dmp.north)+(0,-5pt)$) --
($(dmp.north)+(0,5pt)$); , decorate,
ground/.style=fill,pattern=north east lines,draw=none,minimum
width=0.75cm,minimum height=0.3cm,
ground_magenta/.style=fill,pattern=north east lines,pattern
color=magenta,draw=none,minimum width=0.75cm,minimum height=0.3cm
begintikzpicture[every node/.style=draw,outer
sep=0pt,thick,font=sffamily]
node (m_1) [minimum width=1cm,minimum height=0.5cm]$m_1$;
node (m_2)[right of= m_1,node distance=2.5cm,minimum width=1cm,minimum height=0.5cm]$m_2$;
draw [spring] (m_1.east) -- (m_2.west) node[midway,below=1mm,draw=none]$k_12$;
node (ground1) at (m_1.south west) [ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] ;
draw (ground1.south west) -- (ground1.south east);
draw [thick,decorate,decoration=zigzag,pre
length=0.1cm,post length=0.85cm,segment length=6] (ground1.south) -| (m_1.south) node[midway,below=1mm,xshift=-3mm,draw=none]$k_g1$ ;
endtikzpicture
enddocument
Method 2
Another method could be to draw the two lines separately. This potentially allows you better control over the spring, as it is just specified for the horizontal segment (therefore you can set the same post
and pre
lengths). And the label is nicely centred underneath it.
But, there is a small break between the two lines at the intersection point. I'm not sure how you fix this, perhaps there is an easy solution? (I welcome any comments)
documentclass[margin=0.5mm]standalone
usepackagetikz
usetikzlibrarycalc,patterns,decorations.pathmorphing,decorations.markings,positioning
begindocument
tikzsetspring/.style=thick,decorate,decoration=zigzag,pre
length=0.3cm,post length=0.3cm,segment length=6, short
spring/.style=thick,decorate,decoration=zigzag,pre
length=0.07cm,post length=0.07cm,segment length=6,
damper/.style=thick,decoration=markings, mark connection node=dmp,
mark=at position 0.5 with node (dmp) [thick,inner
sep=0pt,transform shape,rotate=-90,minimum width=15pt,minimum
height=3pt,draw=none] ; draw [thick] ($(dmp.north east)+(2pt,0)$)
-- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$); draw [thick] ($(dmp.north)+(0,-5pt)$) --
($(dmp.north)+(0,5pt)$); , decorate,
ground/.style=fill,pattern=north east lines,draw=none,minimum
width=0.75cm,minimum height=0.3cm,
ground_magenta/.style=fill,pattern=north east lines,pattern
color=magenta,draw=none,minimum width=0.75cm,minimum height=0.3cm
begintikzpicture[every node/.style=draw,outer
sep=0pt,thick,font=sffamily]
node (m_1) [minimum width=1cm,minimum height=0.5cm]$m_1$;
node (m_2)[right of= m_1,node distance=2.5cm,minimum width=1cm,minimum height=0.5cm]$m_2$;
draw [spring] (m_1.east) -- (m_2.west) node[midway,below=1mm,draw=none]$k_12$;
node (ground1) at (m_1.south west) [ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] ;
draw (ground1.south west) -- (ground1.south east);
path (ground1.south) -| coordinate (midpoint) (m_1.south);
draw [short spring] (ground1.south) -- (midpoint) node [midway, below=1mm,draw=none] $k_g1$;
draw [thick] (midpoint)--(m_1.south);
endtikzpicture
enddocument
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
Method 1
Here is a way to do it using -|
which draws a right angle between the two points (ground1.south)
and (m_1.south)
.
But, it requires you to manually adjust the pre length
and post length
of the spring so that it fits nicely in the horizontal segment of the line. Also some adjustment to the position of the label is required.
documentclass[margin=0.5mm]standalone
usepackagetikz
usetikzlibrarycalc,patterns,decorations.pathmorphing,decorations.markings,positioning
begindocument
tikzsetspring/.style=thick,decorate,decoration=zigzag,pre
length=0.3cm,post length=0.3cm,segment length=6, short
spring/.style=thick,decorate,decoration=zigzag,pre
length=0.05cm,post length=0.05cm,segment length=6,
damper/.style=thick,decoration=markings, mark connection node=dmp,
mark=at position 0.5 with node (dmp) [thick,inner
sep=0pt,transform shape,rotate=-90,minimum width=15pt,minimum
height=3pt,draw=none] ; draw [thick] ($(dmp.north east)+(2pt,0)$)
-- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$); draw [thick] ($(dmp.north)+(0,-5pt)$) --
($(dmp.north)+(0,5pt)$); , decorate,
ground/.style=fill,pattern=north east lines,draw=none,minimum
width=0.75cm,minimum height=0.3cm,
ground_magenta/.style=fill,pattern=north east lines,pattern
color=magenta,draw=none,minimum width=0.75cm,minimum height=0.3cm
begintikzpicture[every node/.style=draw,outer
sep=0pt,thick,font=sffamily]
node (m_1) [minimum width=1cm,minimum height=0.5cm]$m_1$;
node (m_2)[right of= m_1,node distance=2.5cm,minimum width=1cm,minimum height=0.5cm]$m_2$;
draw [spring] (m_1.east) -- (m_2.west) node[midway,below=1mm,draw=none]$k_12$;
node (ground1) at (m_1.south west) [ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] ;
draw (ground1.south west) -- (ground1.south east);
draw [thick,decorate,decoration=zigzag,pre
length=0.1cm,post length=0.85cm,segment length=6] (ground1.south) -| (m_1.south) node[midway,below=1mm,xshift=-3mm,draw=none]$k_g1$ ;
endtikzpicture
enddocument
Method 2
Another method could be to draw the two lines separately. This potentially allows you better control over the spring, as it is just specified for the horizontal segment (therefore you can set the same post
and pre
lengths). And the label is nicely centred underneath it.
But, there is a small break between the two lines at the intersection point. I'm not sure how you fix this, perhaps there is an easy solution? (I welcome any comments)
documentclass[margin=0.5mm]standalone
usepackagetikz
usetikzlibrarycalc,patterns,decorations.pathmorphing,decorations.markings,positioning
begindocument
tikzsetspring/.style=thick,decorate,decoration=zigzag,pre
length=0.3cm,post length=0.3cm,segment length=6, short
spring/.style=thick,decorate,decoration=zigzag,pre
length=0.07cm,post length=0.07cm,segment length=6,
damper/.style=thick,decoration=markings, mark connection node=dmp,
mark=at position 0.5 with node (dmp) [thick,inner
sep=0pt,transform shape,rotate=-90,minimum width=15pt,minimum
height=3pt,draw=none] ; draw [thick] ($(dmp.north east)+(2pt,0)$)
-- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$); draw [thick] ($(dmp.north)+(0,-5pt)$) --
($(dmp.north)+(0,5pt)$); , decorate,
ground/.style=fill,pattern=north east lines,draw=none,minimum
width=0.75cm,minimum height=0.3cm,
ground_magenta/.style=fill,pattern=north east lines,pattern
color=magenta,draw=none,minimum width=0.75cm,minimum height=0.3cm
begintikzpicture[every node/.style=draw,outer
sep=0pt,thick,font=sffamily]
node (m_1) [minimum width=1cm,minimum height=0.5cm]$m_1$;
node (m_2)[right of= m_1,node distance=2.5cm,minimum width=1cm,minimum height=0.5cm]$m_2$;
draw [spring] (m_1.east) -- (m_2.west) node[midway,below=1mm,draw=none]$k_12$;
node (ground1) at (m_1.south west) [ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] ;
draw (ground1.south west) -- (ground1.south east);
path (ground1.south) -| coordinate (midpoint) (m_1.south);
draw [short spring] (ground1.south) -- (midpoint) node [midway, below=1mm,draw=none] $k_g1$;
draw [thick] (midpoint)--(m_1.south);
endtikzpicture
enddocument
add a comment |Â
up vote
4
down vote
Method 1
Here is a way to do it using -|
which draws a right angle between the two points (ground1.south)
and (m_1.south)
.
But, it requires you to manually adjust the pre length
and post length
of the spring so that it fits nicely in the horizontal segment of the line. Also some adjustment to the position of the label is required.
documentclass[margin=0.5mm]standalone
usepackagetikz
usetikzlibrarycalc,patterns,decorations.pathmorphing,decorations.markings,positioning
begindocument
tikzsetspring/.style=thick,decorate,decoration=zigzag,pre
length=0.3cm,post length=0.3cm,segment length=6, short
spring/.style=thick,decorate,decoration=zigzag,pre
length=0.05cm,post length=0.05cm,segment length=6,
damper/.style=thick,decoration=markings, mark connection node=dmp,
mark=at position 0.5 with node (dmp) [thick,inner
sep=0pt,transform shape,rotate=-90,minimum width=15pt,minimum
height=3pt,draw=none] ; draw [thick] ($(dmp.north east)+(2pt,0)$)
-- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$); draw [thick] ($(dmp.north)+(0,-5pt)$) --
($(dmp.north)+(0,5pt)$); , decorate,
ground/.style=fill,pattern=north east lines,draw=none,minimum
width=0.75cm,minimum height=0.3cm,
ground_magenta/.style=fill,pattern=north east lines,pattern
color=magenta,draw=none,minimum width=0.75cm,minimum height=0.3cm
begintikzpicture[every node/.style=draw,outer
sep=0pt,thick,font=sffamily]
node (m_1) [minimum width=1cm,minimum height=0.5cm]$m_1$;
node (m_2)[right of= m_1,node distance=2.5cm,minimum width=1cm,minimum height=0.5cm]$m_2$;
draw [spring] (m_1.east) -- (m_2.west) node[midway,below=1mm,draw=none]$k_12$;
node (ground1) at (m_1.south west) [ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] ;
draw (ground1.south west) -- (ground1.south east);
draw [thick,decorate,decoration=zigzag,pre
length=0.1cm,post length=0.85cm,segment length=6] (ground1.south) -| (m_1.south) node[midway,below=1mm,xshift=-3mm,draw=none]$k_g1$ ;
endtikzpicture
enddocument
Method 2
Another method could be to draw the two lines separately. This potentially allows you better control over the spring, as it is just specified for the horizontal segment (therefore you can set the same post
and pre
lengths). And the label is nicely centred underneath it.
But, there is a small break between the two lines at the intersection point. I'm not sure how you fix this, perhaps there is an easy solution? (I welcome any comments)
documentclass[margin=0.5mm]standalone
usepackagetikz
usetikzlibrarycalc,patterns,decorations.pathmorphing,decorations.markings,positioning
begindocument
tikzsetspring/.style=thick,decorate,decoration=zigzag,pre
length=0.3cm,post length=0.3cm,segment length=6, short
spring/.style=thick,decorate,decoration=zigzag,pre
length=0.07cm,post length=0.07cm,segment length=6,
damper/.style=thick,decoration=markings, mark connection node=dmp,
mark=at position 0.5 with node (dmp) [thick,inner
sep=0pt,transform shape,rotate=-90,minimum width=15pt,minimum
height=3pt,draw=none] ; draw [thick] ($(dmp.north east)+(2pt,0)$)
-- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$); draw [thick] ($(dmp.north)+(0,-5pt)$) --
($(dmp.north)+(0,5pt)$); , decorate,
ground/.style=fill,pattern=north east lines,draw=none,minimum
width=0.75cm,minimum height=0.3cm,
ground_magenta/.style=fill,pattern=north east lines,pattern
color=magenta,draw=none,minimum width=0.75cm,minimum height=0.3cm
begintikzpicture[every node/.style=draw,outer
sep=0pt,thick,font=sffamily]
node (m_1) [minimum width=1cm,minimum height=0.5cm]$m_1$;
node (m_2)[right of= m_1,node distance=2.5cm,minimum width=1cm,minimum height=0.5cm]$m_2$;
draw [spring] (m_1.east) -- (m_2.west) node[midway,below=1mm,draw=none]$k_12$;
node (ground1) at (m_1.south west) [ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] ;
draw (ground1.south west) -- (ground1.south east);
path (ground1.south) -| coordinate (midpoint) (m_1.south);
draw [short spring] (ground1.south) -- (midpoint) node [midway, below=1mm,draw=none] $k_g1$;
draw [thick] (midpoint)--(m_1.south);
endtikzpicture
enddocument
add a comment |Â
up vote
4
down vote
up vote
4
down vote
Method 1
Here is a way to do it using -|
which draws a right angle between the two points (ground1.south)
and (m_1.south)
.
But, it requires you to manually adjust the pre length
and post length
of the spring so that it fits nicely in the horizontal segment of the line. Also some adjustment to the position of the label is required.
documentclass[margin=0.5mm]standalone
usepackagetikz
usetikzlibrarycalc,patterns,decorations.pathmorphing,decorations.markings,positioning
begindocument
tikzsetspring/.style=thick,decorate,decoration=zigzag,pre
length=0.3cm,post length=0.3cm,segment length=6, short
spring/.style=thick,decorate,decoration=zigzag,pre
length=0.05cm,post length=0.05cm,segment length=6,
damper/.style=thick,decoration=markings, mark connection node=dmp,
mark=at position 0.5 with node (dmp) [thick,inner
sep=0pt,transform shape,rotate=-90,minimum width=15pt,minimum
height=3pt,draw=none] ; draw [thick] ($(dmp.north east)+(2pt,0)$)
-- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$); draw [thick] ($(dmp.north)+(0,-5pt)$) --
($(dmp.north)+(0,5pt)$); , decorate,
ground/.style=fill,pattern=north east lines,draw=none,minimum
width=0.75cm,minimum height=0.3cm,
ground_magenta/.style=fill,pattern=north east lines,pattern
color=magenta,draw=none,minimum width=0.75cm,minimum height=0.3cm
begintikzpicture[every node/.style=draw,outer
sep=0pt,thick,font=sffamily]
node (m_1) [minimum width=1cm,minimum height=0.5cm]$m_1$;
node (m_2)[right of= m_1,node distance=2.5cm,minimum width=1cm,minimum height=0.5cm]$m_2$;
draw [spring] (m_1.east) -- (m_2.west) node[midway,below=1mm,draw=none]$k_12$;
node (ground1) at (m_1.south west) [ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] ;
draw (ground1.south west) -- (ground1.south east);
draw [thick,decorate,decoration=zigzag,pre
length=0.1cm,post length=0.85cm,segment length=6] (ground1.south) -| (m_1.south) node[midway,below=1mm,xshift=-3mm,draw=none]$k_g1$ ;
endtikzpicture
enddocument
Method 2
Another method could be to draw the two lines separately. This potentially allows you better control over the spring, as it is just specified for the horizontal segment (therefore you can set the same post
and pre
lengths). And the label is nicely centred underneath it.
But, there is a small break between the two lines at the intersection point. I'm not sure how you fix this, perhaps there is an easy solution? (I welcome any comments)
documentclass[margin=0.5mm]standalone
usepackagetikz
usetikzlibrarycalc,patterns,decorations.pathmorphing,decorations.markings,positioning
begindocument
tikzsetspring/.style=thick,decorate,decoration=zigzag,pre
length=0.3cm,post length=0.3cm,segment length=6, short
spring/.style=thick,decorate,decoration=zigzag,pre
length=0.07cm,post length=0.07cm,segment length=6,
damper/.style=thick,decoration=markings, mark connection node=dmp,
mark=at position 0.5 with node (dmp) [thick,inner
sep=0pt,transform shape,rotate=-90,minimum width=15pt,minimum
height=3pt,draw=none] ; draw [thick] ($(dmp.north east)+(2pt,0)$)
-- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$); draw [thick] ($(dmp.north)+(0,-5pt)$) --
($(dmp.north)+(0,5pt)$); , decorate,
ground/.style=fill,pattern=north east lines,draw=none,minimum
width=0.75cm,minimum height=0.3cm,
ground_magenta/.style=fill,pattern=north east lines,pattern
color=magenta,draw=none,minimum width=0.75cm,minimum height=0.3cm
begintikzpicture[every node/.style=draw,outer
sep=0pt,thick,font=sffamily]
node (m_1) [minimum width=1cm,minimum height=0.5cm]$m_1$;
node (m_2)[right of= m_1,node distance=2.5cm,minimum width=1cm,minimum height=0.5cm]$m_2$;
draw [spring] (m_1.east) -- (m_2.west) node[midway,below=1mm,draw=none]$k_12$;
node (ground1) at (m_1.south west) [ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] ;
draw (ground1.south west) -- (ground1.south east);
path (ground1.south) -| coordinate (midpoint) (m_1.south);
draw [short spring] (ground1.south) -- (midpoint) node [midway, below=1mm,draw=none] $k_g1$;
draw [thick] (midpoint)--(m_1.south);
endtikzpicture
enddocument
Method 1
Here is a way to do it using -|
which draws a right angle between the two points (ground1.south)
and (m_1.south)
.
But, it requires you to manually adjust the pre length
and post length
of the spring so that it fits nicely in the horizontal segment of the line. Also some adjustment to the position of the label is required.
documentclass[margin=0.5mm]standalone
usepackagetikz
usetikzlibrarycalc,patterns,decorations.pathmorphing,decorations.markings,positioning
begindocument
tikzsetspring/.style=thick,decorate,decoration=zigzag,pre
length=0.3cm,post length=0.3cm,segment length=6, short
spring/.style=thick,decorate,decoration=zigzag,pre
length=0.05cm,post length=0.05cm,segment length=6,
damper/.style=thick,decoration=markings, mark connection node=dmp,
mark=at position 0.5 with node (dmp) [thick,inner
sep=0pt,transform shape,rotate=-90,minimum width=15pt,minimum
height=3pt,draw=none] ; draw [thick] ($(dmp.north east)+(2pt,0)$)
-- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$); draw [thick] ($(dmp.north)+(0,-5pt)$) --
($(dmp.north)+(0,5pt)$); , decorate,
ground/.style=fill,pattern=north east lines,draw=none,minimum
width=0.75cm,minimum height=0.3cm,
ground_magenta/.style=fill,pattern=north east lines,pattern
color=magenta,draw=none,minimum width=0.75cm,minimum height=0.3cm
begintikzpicture[every node/.style=draw,outer
sep=0pt,thick,font=sffamily]
node (m_1) [minimum width=1cm,minimum height=0.5cm]$m_1$;
node (m_2)[right of= m_1,node distance=2.5cm,minimum width=1cm,minimum height=0.5cm]$m_2$;
draw [spring] (m_1.east) -- (m_2.west) node[midway,below=1mm,draw=none]$k_12$;
node (ground1) at (m_1.south west) [ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] ;
draw (ground1.south west) -- (ground1.south east);
draw [thick,decorate,decoration=zigzag,pre
length=0.1cm,post length=0.85cm,segment length=6] (ground1.south) -| (m_1.south) node[midway,below=1mm,xshift=-3mm,draw=none]$k_g1$ ;
endtikzpicture
enddocument
Method 2
Another method could be to draw the two lines separately. This potentially allows you better control over the spring, as it is just specified for the horizontal segment (therefore you can set the same post
and pre
lengths). And the label is nicely centred underneath it.
But, there is a small break between the two lines at the intersection point. I'm not sure how you fix this, perhaps there is an easy solution? (I welcome any comments)
documentclass[margin=0.5mm]standalone
usepackagetikz
usetikzlibrarycalc,patterns,decorations.pathmorphing,decorations.markings,positioning
begindocument
tikzsetspring/.style=thick,decorate,decoration=zigzag,pre
length=0.3cm,post length=0.3cm,segment length=6, short
spring/.style=thick,decorate,decoration=zigzag,pre
length=0.07cm,post length=0.07cm,segment length=6,
damper/.style=thick,decoration=markings, mark connection node=dmp,
mark=at position 0.5 with node (dmp) [thick,inner
sep=0pt,transform shape,rotate=-90,minimum width=15pt,minimum
height=3pt,draw=none] ; draw [thick] ($(dmp.north east)+(2pt,0)$)
-- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$); draw [thick] ($(dmp.north)+(0,-5pt)$) --
($(dmp.north)+(0,5pt)$); , decorate,
ground/.style=fill,pattern=north east lines,draw=none,minimum
width=0.75cm,minimum height=0.3cm,
ground_magenta/.style=fill,pattern=north east lines,pattern
color=magenta,draw=none,minimum width=0.75cm,minimum height=0.3cm
begintikzpicture[every node/.style=draw,outer
sep=0pt,thick,font=sffamily]
node (m_1) [minimum width=1cm,minimum height=0.5cm]$m_1$;
node (m_2)[right of= m_1,node distance=2.5cm,minimum width=1cm,minimum height=0.5cm]$m_2$;
draw [spring] (m_1.east) -- (m_2.west) node[midway,below=1mm,draw=none]$k_12$;
node (ground1) at (m_1.south west) [ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] ;
draw (ground1.south west) -- (ground1.south east);
path (ground1.south) -| coordinate (midpoint) (m_1.south);
draw [short spring] (ground1.south) -- (midpoint) node [midway, below=1mm,draw=none] $k_g1$;
draw [thick] (midpoint)--(m_1.south);
endtikzpicture
enddocument
edited 8 mins ago
answered 23 mins ago


Milo
5,63821345
5,63821345
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f457322%2fl-shaped-springs-in-tikz%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password