Colored curved cube
This is a a curved cube
begin{tikzpicture}[thick,scale=3]
coordinate (A1) at (0, 0);
coordinate (A2) at (0, 1);
coordinate (A3) at (1, 1);
coordinate (A4) at (1, 0);
coordinate (B1) at (0.3, 0.3);
coordinate (B2) at (0.3, 1.3);
coordinate (B3) at (1.3, 1.3);
coordinate (B4) at (1.3, 0.3);
coordinate (C1) at (0.4, 2);
coordinate (C2) at (2, -0.4);
coordinate (C3) at (1, .6);
coordinate (C4) at (2, 0.7);
coordinate (C5) at (1, 1.6);
coordinate (C6) at (2, 0.6);
coordinate (C7) at (2, 0.1);
coordinate (C8) at (2, 1.6);
coordinate (C9) at (2, 1.1);
coordinate (C10) at (.8, 2.2);
coordinate (C11) at (1.3, 2);
coordinate (C12) at (1.6, 2);
draw[draw=black, line width=.5mm] plot [smooth, tension=1] coordinates {(A1) (A2) (C1)};
draw[draw=black, line width=.5mm] plot [smooth, tension=1] coordinates {(A1) (A4) (C2)};
draw[draw=black, line width=.5mm] plot [smooth, tension=1] coordinates {(A1) (B1) (C3)};
draw[draw=black] plot [smooth, tension=1] coordinates {(A2) (A3) (C4)};
draw[draw=black] plot [smooth, tension=1] coordinates {(A2) (B2) (C5)};
draw[draw=black] plot [smooth, tension=1] coordinates {(A4) (B4) (C6)};
draw[draw=black] plot [smooth, tension=1] coordinates {(B1) (B4) (C7)};
draw[draw=black] plot [smooth, tension=1] coordinates {(A3) (B3) (C8)};
draw[draw=black] plot [smooth, tension=1] coordinates {(B2) (B3) (C9)};
draw[draw=black] plot [smooth, tension=1] coordinates {(B1) (B2) (C10)};
draw[draw=black] plot [smooth, tension=1] coordinates {(A4) (A3) (C11)};
draw[draw=black] plot [smooth, tension=1] coordinates {(B4) (B3) (C12)};
draw[fill=blue] (0,0) circle [radius=.02cm];
draw[fill=blue] (0,1) circle [radius=.02cm];
draw[fill=blue] (1,0) circle [radius=.02cm];
draw[fill=blue] (.3,.3) circle [radius=.02cm];
draw[fill=blue] (1.3,.3) circle [radius=.02cm];
draw[fill=blue] (.3,1.3) circle [radius=.02cm];
draw[fill=blue] (1,1) circle [radius=.02cm];
draw[fill=blue] (1.3,1.3) circle [radius=.02cm];
node[black] at (-.2,0) {$M_0$};
node[black] at (1,-.2) {$M_1$};
node[black] at (.15,.35) {$M_2$};
node[black] at (-.2,1) {$M_3$};
node[black] at (1.4,.5) {$M_{12}$};
node[black] at (.6,1.6) {$M_{32}$};
node[black] at (.85,1.1) {$M_{31}$};
node[black] at (1.45,1.5) {$N$};
node[black] at (1.45,-.3) {$q_1$-linha};
node[black] at (.7,.6) {$q_2$-linha};
node[black] at (0,2) {$q_3$-linha};
end{tikzpicture}
How to fill faces with different colors?
tikz-pgf
add a comment |
This is a a curved cube
begin{tikzpicture}[thick,scale=3]
coordinate (A1) at (0, 0);
coordinate (A2) at (0, 1);
coordinate (A3) at (1, 1);
coordinate (A4) at (1, 0);
coordinate (B1) at (0.3, 0.3);
coordinate (B2) at (0.3, 1.3);
coordinate (B3) at (1.3, 1.3);
coordinate (B4) at (1.3, 0.3);
coordinate (C1) at (0.4, 2);
coordinate (C2) at (2, -0.4);
coordinate (C3) at (1, .6);
coordinate (C4) at (2, 0.7);
coordinate (C5) at (1, 1.6);
coordinate (C6) at (2, 0.6);
coordinate (C7) at (2, 0.1);
coordinate (C8) at (2, 1.6);
coordinate (C9) at (2, 1.1);
coordinate (C10) at (.8, 2.2);
coordinate (C11) at (1.3, 2);
coordinate (C12) at (1.6, 2);
draw[draw=black, line width=.5mm] plot [smooth, tension=1] coordinates {(A1) (A2) (C1)};
draw[draw=black, line width=.5mm] plot [smooth, tension=1] coordinates {(A1) (A4) (C2)};
draw[draw=black, line width=.5mm] plot [smooth, tension=1] coordinates {(A1) (B1) (C3)};
draw[draw=black] plot [smooth, tension=1] coordinates {(A2) (A3) (C4)};
draw[draw=black] plot [smooth, tension=1] coordinates {(A2) (B2) (C5)};
draw[draw=black] plot [smooth, tension=1] coordinates {(A4) (B4) (C6)};
draw[draw=black] plot [smooth, tension=1] coordinates {(B1) (B4) (C7)};
draw[draw=black] plot [smooth, tension=1] coordinates {(A3) (B3) (C8)};
draw[draw=black] plot [smooth, tension=1] coordinates {(B2) (B3) (C9)};
draw[draw=black] plot [smooth, tension=1] coordinates {(B1) (B2) (C10)};
draw[draw=black] plot [smooth, tension=1] coordinates {(A4) (A3) (C11)};
draw[draw=black] plot [smooth, tension=1] coordinates {(B4) (B3) (C12)};
draw[fill=blue] (0,0) circle [radius=.02cm];
draw[fill=blue] (0,1) circle [radius=.02cm];
draw[fill=blue] (1,0) circle [radius=.02cm];
draw[fill=blue] (.3,.3) circle [radius=.02cm];
draw[fill=blue] (1.3,.3) circle [radius=.02cm];
draw[fill=blue] (.3,1.3) circle [radius=.02cm];
draw[fill=blue] (1,1) circle [radius=.02cm];
draw[fill=blue] (1.3,1.3) circle [radius=.02cm];
node[black] at (-.2,0) {$M_0$};
node[black] at (1,-.2) {$M_1$};
node[black] at (.15,.35) {$M_2$};
node[black] at (-.2,1) {$M_3$};
node[black] at (1.4,.5) {$M_{12}$};
node[black] at (.6,1.6) {$M_{32}$};
node[black] at (.85,1.1) {$M_{31}$};
node[black] at (1.45,1.5) {$N$};
node[black] at (1.45,-.3) {$q_1$-linha};
node[black] at (.7,.6) {$q_2$-linha};
node[black] at (0,2) {$q_3$-linha};
end{tikzpicture}
How to fill faces with different colors?
tikz-pgf
1
We kindly suggest you to show a full minimal working example (MWE) includingdocumentclass{...}
and ending withend{document}
.
– Cragfelt
Mar 29 at 1:24
It is possible but cumbersome to fill the faces since their boundaries are intersection segments. I believe it will be much simpler if you redraw the paths in single stretches usingto[in=...,out=..]
such that successive stretches are smoothly connected.
– marmot
Mar 29 at 1:46
add a comment |
This is a a curved cube
begin{tikzpicture}[thick,scale=3]
coordinate (A1) at (0, 0);
coordinate (A2) at (0, 1);
coordinate (A3) at (1, 1);
coordinate (A4) at (1, 0);
coordinate (B1) at (0.3, 0.3);
coordinate (B2) at (0.3, 1.3);
coordinate (B3) at (1.3, 1.3);
coordinate (B4) at (1.3, 0.3);
coordinate (C1) at (0.4, 2);
coordinate (C2) at (2, -0.4);
coordinate (C3) at (1, .6);
coordinate (C4) at (2, 0.7);
coordinate (C5) at (1, 1.6);
coordinate (C6) at (2, 0.6);
coordinate (C7) at (2, 0.1);
coordinate (C8) at (2, 1.6);
coordinate (C9) at (2, 1.1);
coordinate (C10) at (.8, 2.2);
coordinate (C11) at (1.3, 2);
coordinate (C12) at (1.6, 2);
draw[draw=black, line width=.5mm] plot [smooth, tension=1] coordinates {(A1) (A2) (C1)};
draw[draw=black, line width=.5mm] plot [smooth, tension=1] coordinates {(A1) (A4) (C2)};
draw[draw=black, line width=.5mm] plot [smooth, tension=1] coordinates {(A1) (B1) (C3)};
draw[draw=black] plot [smooth, tension=1] coordinates {(A2) (A3) (C4)};
draw[draw=black] plot [smooth, tension=1] coordinates {(A2) (B2) (C5)};
draw[draw=black] plot [smooth, tension=1] coordinates {(A4) (B4) (C6)};
draw[draw=black] plot [smooth, tension=1] coordinates {(B1) (B4) (C7)};
draw[draw=black] plot [smooth, tension=1] coordinates {(A3) (B3) (C8)};
draw[draw=black] plot [smooth, tension=1] coordinates {(B2) (B3) (C9)};
draw[draw=black] plot [smooth, tension=1] coordinates {(B1) (B2) (C10)};
draw[draw=black] plot [smooth, tension=1] coordinates {(A4) (A3) (C11)};
draw[draw=black] plot [smooth, tension=1] coordinates {(B4) (B3) (C12)};
draw[fill=blue] (0,0) circle [radius=.02cm];
draw[fill=blue] (0,1) circle [radius=.02cm];
draw[fill=blue] (1,0) circle [radius=.02cm];
draw[fill=blue] (.3,.3) circle [radius=.02cm];
draw[fill=blue] (1.3,.3) circle [radius=.02cm];
draw[fill=blue] (.3,1.3) circle [radius=.02cm];
draw[fill=blue] (1,1) circle [radius=.02cm];
draw[fill=blue] (1.3,1.3) circle [radius=.02cm];
node[black] at (-.2,0) {$M_0$};
node[black] at (1,-.2) {$M_1$};
node[black] at (.15,.35) {$M_2$};
node[black] at (-.2,1) {$M_3$};
node[black] at (1.4,.5) {$M_{12}$};
node[black] at (.6,1.6) {$M_{32}$};
node[black] at (.85,1.1) {$M_{31}$};
node[black] at (1.45,1.5) {$N$};
node[black] at (1.45,-.3) {$q_1$-linha};
node[black] at (.7,.6) {$q_2$-linha};
node[black] at (0,2) {$q_3$-linha};
end{tikzpicture}
How to fill faces with different colors?
tikz-pgf
This is a a curved cube
begin{tikzpicture}[thick,scale=3]
coordinate (A1) at (0, 0);
coordinate (A2) at (0, 1);
coordinate (A3) at (1, 1);
coordinate (A4) at (1, 0);
coordinate (B1) at (0.3, 0.3);
coordinate (B2) at (0.3, 1.3);
coordinate (B3) at (1.3, 1.3);
coordinate (B4) at (1.3, 0.3);
coordinate (C1) at (0.4, 2);
coordinate (C2) at (2, -0.4);
coordinate (C3) at (1, .6);
coordinate (C4) at (2, 0.7);
coordinate (C5) at (1, 1.6);
coordinate (C6) at (2, 0.6);
coordinate (C7) at (2, 0.1);
coordinate (C8) at (2, 1.6);
coordinate (C9) at (2, 1.1);
coordinate (C10) at (.8, 2.2);
coordinate (C11) at (1.3, 2);
coordinate (C12) at (1.6, 2);
draw[draw=black, line width=.5mm] plot [smooth, tension=1] coordinates {(A1) (A2) (C1)};
draw[draw=black, line width=.5mm] plot [smooth, tension=1] coordinates {(A1) (A4) (C2)};
draw[draw=black, line width=.5mm] plot [smooth, tension=1] coordinates {(A1) (B1) (C3)};
draw[draw=black] plot [smooth, tension=1] coordinates {(A2) (A3) (C4)};
draw[draw=black] plot [smooth, tension=1] coordinates {(A2) (B2) (C5)};
draw[draw=black] plot [smooth, tension=1] coordinates {(A4) (B4) (C6)};
draw[draw=black] plot [smooth, tension=1] coordinates {(B1) (B4) (C7)};
draw[draw=black] plot [smooth, tension=1] coordinates {(A3) (B3) (C8)};
draw[draw=black] plot [smooth, tension=1] coordinates {(B2) (B3) (C9)};
draw[draw=black] plot [smooth, tension=1] coordinates {(B1) (B2) (C10)};
draw[draw=black] plot [smooth, tension=1] coordinates {(A4) (A3) (C11)};
draw[draw=black] plot [smooth, tension=1] coordinates {(B4) (B3) (C12)};
draw[fill=blue] (0,0) circle [radius=.02cm];
draw[fill=blue] (0,1) circle [radius=.02cm];
draw[fill=blue] (1,0) circle [radius=.02cm];
draw[fill=blue] (.3,.3) circle [radius=.02cm];
draw[fill=blue] (1.3,.3) circle [radius=.02cm];
draw[fill=blue] (.3,1.3) circle [radius=.02cm];
draw[fill=blue] (1,1) circle [radius=.02cm];
draw[fill=blue] (1.3,1.3) circle [radius=.02cm];
node[black] at (-.2,0) {$M_0$};
node[black] at (1,-.2) {$M_1$};
node[black] at (.15,.35) {$M_2$};
node[black] at (-.2,1) {$M_3$};
node[black] at (1.4,.5) {$M_{12}$};
node[black] at (.6,1.6) {$M_{32}$};
node[black] at (.85,1.1) {$M_{31}$};
node[black] at (1.45,1.5) {$N$};
node[black] at (1.45,-.3) {$q_1$-linha};
node[black] at (.7,.6) {$q_2$-linha};
node[black] at (0,2) {$q_3$-linha};
end{tikzpicture}
How to fill faces with different colors?
tikz-pgf
tikz-pgf
asked Mar 29 at 1:10
nailnail
263
263
1
We kindly suggest you to show a full minimal working example (MWE) includingdocumentclass{...}
and ending withend{document}
.
– Cragfelt
Mar 29 at 1:24
It is possible but cumbersome to fill the faces since their boundaries are intersection segments. I believe it will be much simpler if you redraw the paths in single stretches usingto[in=...,out=..]
such that successive stretches are smoothly connected.
– marmot
Mar 29 at 1:46
add a comment |
1
We kindly suggest you to show a full minimal working example (MWE) includingdocumentclass{...}
and ending withend{document}
.
– Cragfelt
Mar 29 at 1:24
It is possible but cumbersome to fill the faces since their boundaries are intersection segments. I believe it will be much simpler if you redraw the paths in single stretches usingto[in=...,out=..]
such that successive stretches are smoothly connected.
– marmot
Mar 29 at 1:46
1
1
We kindly suggest you to show a full minimal working example (MWE) including
documentclass{...}
and ending with end{document}
.– Cragfelt
Mar 29 at 1:24
We kindly suggest you to show a full minimal working example (MWE) including
documentclass{...}
and ending with end{document}
.– Cragfelt
Mar 29 at 1:24
It is possible but cumbersome to fill the faces since their boundaries are intersection segments. I believe it will be much simpler if you redraw the paths in single stretches using
to[in=...,out=..]
such that successive stretches are smoothly connected.– marmot
Mar 29 at 1:46
It is possible but cumbersome to fill the faces since their boundaries are intersection segments. I believe it will be much simpler if you redraw the paths in single stretches using
to[in=...,out=..]
such that successive stretches are smoothly connected.– marmot
Mar 29 at 1:46
add a comment |
1 Answer
1
active
oldest
votes
In general, you can recover parts of a path using pgfplots (!) library fillbetween
, and these parts can be used to fill some area they are confining. Your example is special in that you have the coordinates of the vertices explicitly. So you can store the subpaths using show path construction
. The following MWE does that in the following way:
- If you add
record path construction
, the subpaths (and their reversed versions) will be stored in a list. - You can redraw the subpaths or combine them to form a boundary of a face.
Unfortunately I find the names of your coordinates not too easy to interpret, but you will find it of course easier. For example,
fill[red,opacity=0.3,scale=1/3,redraw segments={1,4,40,13}] ;
The numbers here depend on the order in which you draw the paths.
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{decorations.pathreplacing,backgrounds}
newcounter{segments}
tikzset{record path construction/.style={decoration={show path construction,
curveto code={stepcounter{segments}stepcounter{segments}
ifdefinedLstSegments
xdefLstSegments{LstSegments,
"(tikzinputsegmentfirst) .. controls
(tikzinputsegmentsupporta) and (tikzinputsegmentsupportb)
..(tikzinputsegmentlast)","(tikzinputsegmentlast) .. controls
(tikzinputsegmentsupportb) and (tikzinputsegmentsupporta)
..(tikzinputsegmentfirst)"}
else
xdefLstSegments{"(tikzinputsegmentfirst) .. controls
(tikzinputsegmentsupporta) and (tikzinputsegmentsupportb)
..(tikzinputsegmentlast)","(tikzinputsegmentlast) .. controls
(tikzinputsegmentsupportb) and (tikzinputsegmentsupporta)
..(tikzinputsegmentfirst)"}
fi
}},postaction=decorate},
reconstruct segment/.style={/utils/exec=pgfmathsetmacro{mysegment}{{LstSegments}[#1]},
insert path=mysegment},
redraw segments/.style={/utils/exec={foreach Segment [count=nSeg] in {#1}
{pgfmathsetmacro{mysegment}{{LstSegments}[Segment]}
ifnumnSeg=1
xdefmysegments{mysegment}
else
xdefmysegments{mysegments -- mysegment}
fi}},
insert path=mysegments},%
}
begin{document}
begin{tikzpicture}[thick,scale=3]
coordinate (A1) at (0, 0);
coordinate (A2) at (0, 1);
coordinate (A3) at (1, 1);
coordinate (A4) at (1, 0);
coordinate (B1) at (0.3, 0.3);
coordinate (B2) at (0.3, 1.3);
coordinate (B3) at (1.3, 1.3);
coordinate (B4) at (1.3, 0.3);
coordinate (C1) at (0.4, 2);
coordinate (C2) at (2, -0.4);
coordinate (C3) at (1, .6);
coordinate (C4) at (2, 0.7);
coordinate (C5) at (1, 1.6);
coordinate (C6) at (2, 0.6);
coordinate (C7) at (2, 0.1);
coordinate (C8) at (2, 1.6);
coordinate (C9) at (2, 1.1);
coordinate (C10) at (.8, 2.2);
coordinate (C11) at (1.3, 2);
coordinate (C12) at (1.6, 2);
draw[draw=black, line width=.5mm,record path construction] plot [smooth, tension=1] coordinates {(A1) (A2) (C1)};
draw[draw=black, line width=.5mm,record path construction] plot [smooth, tension=1] coordinates {(A1) (A4) (C2)};
draw[draw=black, line width=.5mm,record path construction] plot [smooth, tension=1] coordinates {(A1) (B1) (C3)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A2) (A3) (C4)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A2) (B2) (C5)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A4) (B4) (C6)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(B1) (B4) (C7)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A3) (B3) (C8)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(B2) (B3) (C9)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(B1) (B2) (C10)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A4) (A3) (C11)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(B4) (B3) (C12)};
begin{scope}[on background layer]
fill[red,opacity=0.3,scale=1/3,redraw segments={8,36,17,1}];
fill[green!70!black,opacity=0.3,scale=1/3,redraw segments={12,28,33,16}];
fill[cyan,opacity=0.3,scale=1/3,redraw segments={44,33,37,24}];
fill[orange,opacity=0.3,scale=1/3,redraw segments={20,44,29,41}];
fill[blue,opacity=0.3,scale=1/3,redraw segments={1,4,40,13}];
end{scope}
% test a single segment with direction
% draw[red,thick,scale=1/3,reconstruct segment/.list={40},-latex];
% get all segments with orientation
%pgfmathruncatemacro{Ymax}{value{segments}-1}
% foreach X [count=Y starting from 0] in {1,...,value{segments}}
% {ifoddY
% else
% draw[red,thick,scale=1/3,reconstruct segment/.list={Y},-latex]
% node[midway,fill=white]{Y};
% fi}
draw[fill=blue] (0,0) circle [radius=.02cm];
draw[fill=blue] (0,1) circle [radius=.02cm];
draw[fill=blue] (1,0) circle [radius=.02cm];
draw[fill=blue] (.3,.3) circle [radius=.02cm];
draw[fill=blue] (1.3,.3) circle [radius=.02cm];
draw[fill=blue] (.3,1.3) circle [radius=.02cm];
draw[fill=blue] (1,1) circle [radius=.02cm];
draw[fill=blue] (1.3,1.3) circle [radius=.02cm];
node[black] at (-.2,0) {$M_0$};
node[black] at (1,-.2) {$M_1$};
node[black] at (.15,.35) {$M_2$};
node[black] at (-.2,1) {$M_3$};
node[black] at (1.4,.5) {$M_{12}$};
node[black] at (.6,1.6) {$M_{32}$};
node[black] at (.85,1.1) {$M_{31}$};
node[black] at (1.45,1.5) {$N$};
node[black] at (1.45,-.3) {$q_1$-linha};
node[black] at (.7,.6) {$q_2$-linha};
node[black] at (0,2) {$q_3$-linha};
end{tikzpicture}
end{document}
Figuring all the subpaths is possible but may require some patience. If you want, say, to know what segment number 40 is, do
draw[red,thick,scale=1/3,reconstruct segment/.list={40},-latex];
The arrow indicates the direction. The path number 41 will run through the same curve but in opposite direction. If you want to get a survey of all segments, uncomment
foreach X [count=Y starting from 0] in {1,...,value{segments}}
{ifoddY
else
draw[red,thick,scale=1/3,reconstruct segment/.list={Y},-latex]
node[midway,fill=white]{Y};
fi}
Notice that the way to record the paths and label/number them is not unique, there might be better ways.
... and marmot did it again!
– manooooh
Mar 29 at 5:09
1
Excellent! Unfortunately, I do not understand the construction of the "record path construction", but understand how to use it in different situations.
– nail
Mar 29 at 20:14
@nail All it does is to store certain subpaths in a list such that you can later recycle them e.g. in order to fill some area enclosed by them. The name of the decorationshow path construction
may indeed not be optimal, an alternative name would beaccess to path information
.
– marmot
Mar 29 at 20:31
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f482019%2fcolored-curved-cube%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
In general, you can recover parts of a path using pgfplots (!) library fillbetween
, and these parts can be used to fill some area they are confining. Your example is special in that you have the coordinates of the vertices explicitly. So you can store the subpaths using show path construction
. The following MWE does that in the following way:
- If you add
record path construction
, the subpaths (and their reversed versions) will be stored in a list. - You can redraw the subpaths or combine them to form a boundary of a face.
Unfortunately I find the names of your coordinates not too easy to interpret, but you will find it of course easier. For example,
fill[red,opacity=0.3,scale=1/3,redraw segments={1,4,40,13}] ;
The numbers here depend on the order in which you draw the paths.
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{decorations.pathreplacing,backgrounds}
newcounter{segments}
tikzset{record path construction/.style={decoration={show path construction,
curveto code={stepcounter{segments}stepcounter{segments}
ifdefinedLstSegments
xdefLstSegments{LstSegments,
"(tikzinputsegmentfirst) .. controls
(tikzinputsegmentsupporta) and (tikzinputsegmentsupportb)
..(tikzinputsegmentlast)","(tikzinputsegmentlast) .. controls
(tikzinputsegmentsupportb) and (tikzinputsegmentsupporta)
..(tikzinputsegmentfirst)"}
else
xdefLstSegments{"(tikzinputsegmentfirst) .. controls
(tikzinputsegmentsupporta) and (tikzinputsegmentsupportb)
..(tikzinputsegmentlast)","(tikzinputsegmentlast) .. controls
(tikzinputsegmentsupportb) and (tikzinputsegmentsupporta)
..(tikzinputsegmentfirst)"}
fi
}},postaction=decorate},
reconstruct segment/.style={/utils/exec=pgfmathsetmacro{mysegment}{{LstSegments}[#1]},
insert path=mysegment},
redraw segments/.style={/utils/exec={foreach Segment [count=nSeg] in {#1}
{pgfmathsetmacro{mysegment}{{LstSegments}[Segment]}
ifnumnSeg=1
xdefmysegments{mysegment}
else
xdefmysegments{mysegments -- mysegment}
fi}},
insert path=mysegments},%
}
begin{document}
begin{tikzpicture}[thick,scale=3]
coordinate (A1) at (0, 0);
coordinate (A2) at (0, 1);
coordinate (A3) at (1, 1);
coordinate (A4) at (1, 0);
coordinate (B1) at (0.3, 0.3);
coordinate (B2) at (0.3, 1.3);
coordinate (B3) at (1.3, 1.3);
coordinate (B4) at (1.3, 0.3);
coordinate (C1) at (0.4, 2);
coordinate (C2) at (2, -0.4);
coordinate (C3) at (1, .6);
coordinate (C4) at (2, 0.7);
coordinate (C5) at (1, 1.6);
coordinate (C6) at (2, 0.6);
coordinate (C7) at (2, 0.1);
coordinate (C8) at (2, 1.6);
coordinate (C9) at (2, 1.1);
coordinate (C10) at (.8, 2.2);
coordinate (C11) at (1.3, 2);
coordinate (C12) at (1.6, 2);
draw[draw=black, line width=.5mm,record path construction] plot [smooth, tension=1] coordinates {(A1) (A2) (C1)};
draw[draw=black, line width=.5mm,record path construction] plot [smooth, tension=1] coordinates {(A1) (A4) (C2)};
draw[draw=black, line width=.5mm,record path construction] plot [smooth, tension=1] coordinates {(A1) (B1) (C3)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A2) (A3) (C4)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A2) (B2) (C5)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A4) (B4) (C6)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(B1) (B4) (C7)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A3) (B3) (C8)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(B2) (B3) (C9)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(B1) (B2) (C10)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A4) (A3) (C11)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(B4) (B3) (C12)};
begin{scope}[on background layer]
fill[red,opacity=0.3,scale=1/3,redraw segments={8,36,17,1}];
fill[green!70!black,opacity=0.3,scale=1/3,redraw segments={12,28,33,16}];
fill[cyan,opacity=0.3,scale=1/3,redraw segments={44,33,37,24}];
fill[orange,opacity=0.3,scale=1/3,redraw segments={20,44,29,41}];
fill[blue,opacity=0.3,scale=1/3,redraw segments={1,4,40,13}];
end{scope}
% test a single segment with direction
% draw[red,thick,scale=1/3,reconstruct segment/.list={40},-latex];
% get all segments with orientation
%pgfmathruncatemacro{Ymax}{value{segments}-1}
% foreach X [count=Y starting from 0] in {1,...,value{segments}}
% {ifoddY
% else
% draw[red,thick,scale=1/3,reconstruct segment/.list={Y},-latex]
% node[midway,fill=white]{Y};
% fi}
draw[fill=blue] (0,0) circle [radius=.02cm];
draw[fill=blue] (0,1) circle [radius=.02cm];
draw[fill=blue] (1,0) circle [radius=.02cm];
draw[fill=blue] (.3,.3) circle [radius=.02cm];
draw[fill=blue] (1.3,.3) circle [radius=.02cm];
draw[fill=blue] (.3,1.3) circle [radius=.02cm];
draw[fill=blue] (1,1) circle [radius=.02cm];
draw[fill=blue] (1.3,1.3) circle [radius=.02cm];
node[black] at (-.2,0) {$M_0$};
node[black] at (1,-.2) {$M_1$};
node[black] at (.15,.35) {$M_2$};
node[black] at (-.2,1) {$M_3$};
node[black] at (1.4,.5) {$M_{12}$};
node[black] at (.6,1.6) {$M_{32}$};
node[black] at (.85,1.1) {$M_{31}$};
node[black] at (1.45,1.5) {$N$};
node[black] at (1.45,-.3) {$q_1$-linha};
node[black] at (.7,.6) {$q_2$-linha};
node[black] at (0,2) {$q_3$-linha};
end{tikzpicture}
end{document}
Figuring all the subpaths is possible but may require some patience. If you want, say, to know what segment number 40 is, do
draw[red,thick,scale=1/3,reconstruct segment/.list={40},-latex];
The arrow indicates the direction. The path number 41 will run through the same curve but in opposite direction. If you want to get a survey of all segments, uncomment
foreach X [count=Y starting from 0] in {1,...,value{segments}}
{ifoddY
else
draw[red,thick,scale=1/3,reconstruct segment/.list={Y},-latex]
node[midway,fill=white]{Y};
fi}
Notice that the way to record the paths and label/number them is not unique, there might be better ways.
... and marmot did it again!
– manooooh
Mar 29 at 5:09
1
Excellent! Unfortunately, I do not understand the construction of the "record path construction", but understand how to use it in different situations.
– nail
Mar 29 at 20:14
@nail All it does is to store certain subpaths in a list such that you can later recycle them e.g. in order to fill some area enclosed by them. The name of the decorationshow path construction
may indeed not be optimal, an alternative name would beaccess to path information
.
– marmot
Mar 29 at 20:31
add a comment |
In general, you can recover parts of a path using pgfplots (!) library fillbetween
, and these parts can be used to fill some area they are confining. Your example is special in that you have the coordinates of the vertices explicitly. So you can store the subpaths using show path construction
. The following MWE does that in the following way:
- If you add
record path construction
, the subpaths (and their reversed versions) will be stored in a list. - You can redraw the subpaths or combine them to form a boundary of a face.
Unfortunately I find the names of your coordinates not too easy to interpret, but you will find it of course easier. For example,
fill[red,opacity=0.3,scale=1/3,redraw segments={1,4,40,13}] ;
The numbers here depend on the order in which you draw the paths.
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{decorations.pathreplacing,backgrounds}
newcounter{segments}
tikzset{record path construction/.style={decoration={show path construction,
curveto code={stepcounter{segments}stepcounter{segments}
ifdefinedLstSegments
xdefLstSegments{LstSegments,
"(tikzinputsegmentfirst) .. controls
(tikzinputsegmentsupporta) and (tikzinputsegmentsupportb)
..(tikzinputsegmentlast)","(tikzinputsegmentlast) .. controls
(tikzinputsegmentsupportb) and (tikzinputsegmentsupporta)
..(tikzinputsegmentfirst)"}
else
xdefLstSegments{"(tikzinputsegmentfirst) .. controls
(tikzinputsegmentsupporta) and (tikzinputsegmentsupportb)
..(tikzinputsegmentlast)","(tikzinputsegmentlast) .. controls
(tikzinputsegmentsupportb) and (tikzinputsegmentsupporta)
..(tikzinputsegmentfirst)"}
fi
}},postaction=decorate},
reconstruct segment/.style={/utils/exec=pgfmathsetmacro{mysegment}{{LstSegments}[#1]},
insert path=mysegment},
redraw segments/.style={/utils/exec={foreach Segment [count=nSeg] in {#1}
{pgfmathsetmacro{mysegment}{{LstSegments}[Segment]}
ifnumnSeg=1
xdefmysegments{mysegment}
else
xdefmysegments{mysegments -- mysegment}
fi}},
insert path=mysegments},%
}
begin{document}
begin{tikzpicture}[thick,scale=3]
coordinate (A1) at (0, 0);
coordinate (A2) at (0, 1);
coordinate (A3) at (1, 1);
coordinate (A4) at (1, 0);
coordinate (B1) at (0.3, 0.3);
coordinate (B2) at (0.3, 1.3);
coordinate (B3) at (1.3, 1.3);
coordinate (B4) at (1.3, 0.3);
coordinate (C1) at (0.4, 2);
coordinate (C2) at (2, -0.4);
coordinate (C3) at (1, .6);
coordinate (C4) at (2, 0.7);
coordinate (C5) at (1, 1.6);
coordinate (C6) at (2, 0.6);
coordinate (C7) at (2, 0.1);
coordinate (C8) at (2, 1.6);
coordinate (C9) at (2, 1.1);
coordinate (C10) at (.8, 2.2);
coordinate (C11) at (1.3, 2);
coordinate (C12) at (1.6, 2);
draw[draw=black, line width=.5mm,record path construction] plot [smooth, tension=1] coordinates {(A1) (A2) (C1)};
draw[draw=black, line width=.5mm,record path construction] plot [smooth, tension=1] coordinates {(A1) (A4) (C2)};
draw[draw=black, line width=.5mm,record path construction] plot [smooth, tension=1] coordinates {(A1) (B1) (C3)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A2) (A3) (C4)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A2) (B2) (C5)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A4) (B4) (C6)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(B1) (B4) (C7)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A3) (B3) (C8)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(B2) (B3) (C9)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(B1) (B2) (C10)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A4) (A3) (C11)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(B4) (B3) (C12)};
begin{scope}[on background layer]
fill[red,opacity=0.3,scale=1/3,redraw segments={8,36,17,1}];
fill[green!70!black,opacity=0.3,scale=1/3,redraw segments={12,28,33,16}];
fill[cyan,opacity=0.3,scale=1/3,redraw segments={44,33,37,24}];
fill[orange,opacity=0.3,scale=1/3,redraw segments={20,44,29,41}];
fill[blue,opacity=0.3,scale=1/3,redraw segments={1,4,40,13}];
end{scope}
% test a single segment with direction
% draw[red,thick,scale=1/3,reconstruct segment/.list={40},-latex];
% get all segments with orientation
%pgfmathruncatemacro{Ymax}{value{segments}-1}
% foreach X [count=Y starting from 0] in {1,...,value{segments}}
% {ifoddY
% else
% draw[red,thick,scale=1/3,reconstruct segment/.list={Y},-latex]
% node[midway,fill=white]{Y};
% fi}
draw[fill=blue] (0,0) circle [radius=.02cm];
draw[fill=blue] (0,1) circle [radius=.02cm];
draw[fill=blue] (1,0) circle [radius=.02cm];
draw[fill=blue] (.3,.3) circle [radius=.02cm];
draw[fill=blue] (1.3,.3) circle [radius=.02cm];
draw[fill=blue] (.3,1.3) circle [radius=.02cm];
draw[fill=blue] (1,1) circle [radius=.02cm];
draw[fill=blue] (1.3,1.3) circle [radius=.02cm];
node[black] at (-.2,0) {$M_0$};
node[black] at (1,-.2) {$M_1$};
node[black] at (.15,.35) {$M_2$};
node[black] at (-.2,1) {$M_3$};
node[black] at (1.4,.5) {$M_{12}$};
node[black] at (.6,1.6) {$M_{32}$};
node[black] at (.85,1.1) {$M_{31}$};
node[black] at (1.45,1.5) {$N$};
node[black] at (1.45,-.3) {$q_1$-linha};
node[black] at (.7,.6) {$q_2$-linha};
node[black] at (0,2) {$q_3$-linha};
end{tikzpicture}
end{document}
Figuring all the subpaths is possible but may require some patience. If you want, say, to know what segment number 40 is, do
draw[red,thick,scale=1/3,reconstruct segment/.list={40},-latex];
The arrow indicates the direction. The path number 41 will run through the same curve but in opposite direction. If you want to get a survey of all segments, uncomment
foreach X [count=Y starting from 0] in {1,...,value{segments}}
{ifoddY
else
draw[red,thick,scale=1/3,reconstruct segment/.list={Y},-latex]
node[midway,fill=white]{Y};
fi}
Notice that the way to record the paths and label/number them is not unique, there might be better ways.
... and marmot did it again!
– manooooh
Mar 29 at 5:09
1
Excellent! Unfortunately, I do not understand the construction of the "record path construction", but understand how to use it in different situations.
– nail
Mar 29 at 20:14
@nail All it does is to store certain subpaths in a list such that you can later recycle them e.g. in order to fill some area enclosed by them. The name of the decorationshow path construction
may indeed not be optimal, an alternative name would beaccess to path information
.
– marmot
Mar 29 at 20:31
add a comment |
In general, you can recover parts of a path using pgfplots (!) library fillbetween
, and these parts can be used to fill some area they are confining. Your example is special in that you have the coordinates of the vertices explicitly. So you can store the subpaths using show path construction
. The following MWE does that in the following way:
- If you add
record path construction
, the subpaths (and their reversed versions) will be stored in a list. - You can redraw the subpaths or combine them to form a boundary of a face.
Unfortunately I find the names of your coordinates not too easy to interpret, but you will find it of course easier. For example,
fill[red,opacity=0.3,scale=1/3,redraw segments={1,4,40,13}] ;
The numbers here depend on the order in which you draw the paths.
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{decorations.pathreplacing,backgrounds}
newcounter{segments}
tikzset{record path construction/.style={decoration={show path construction,
curveto code={stepcounter{segments}stepcounter{segments}
ifdefinedLstSegments
xdefLstSegments{LstSegments,
"(tikzinputsegmentfirst) .. controls
(tikzinputsegmentsupporta) and (tikzinputsegmentsupportb)
..(tikzinputsegmentlast)","(tikzinputsegmentlast) .. controls
(tikzinputsegmentsupportb) and (tikzinputsegmentsupporta)
..(tikzinputsegmentfirst)"}
else
xdefLstSegments{"(tikzinputsegmentfirst) .. controls
(tikzinputsegmentsupporta) and (tikzinputsegmentsupportb)
..(tikzinputsegmentlast)","(tikzinputsegmentlast) .. controls
(tikzinputsegmentsupportb) and (tikzinputsegmentsupporta)
..(tikzinputsegmentfirst)"}
fi
}},postaction=decorate},
reconstruct segment/.style={/utils/exec=pgfmathsetmacro{mysegment}{{LstSegments}[#1]},
insert path=mysegment},
redraw segments/.style={/utils/exec={foreach Segment [count=nSeg] in {#1}
{pgfmathsetmacro{mysegment}{{LstSegments}[Segment]}
ifnumnSeg=1
xdefmysegments{mysegment}
else
xdefmysegments{mysegments -- mysegment}
fi}},
insert path=mysegments},%
}
begin{document}
begin{tikzpicture}[thick,scale=3]
coordinate (A1) at (0, 0);
coordinate (A2) at (0, 1);
coordinate (A3) at (1, 1);
coordinate (A4) at (1, 0);
coordinate (B1) at (0.3, 0.3);
coordinate (B2) at (0.3, 1.3);
coordinate (B3) at (1.3, 1.3);
coordinate (B4) at (1.3, 0.3);
coordinate (C1) at (0.4, 2);
coordinate (C2) at (2, -0.4);
coordinate (C3) at (1, .6);
coordinate (C4) at (2, 0.7);
coordinate (C5) at (1, 1.6);
coordinate (C6) at (2, 0.6);
coordinate (C7) at (2, 0.1);
coordinate (C8) at (2, 1.6);
coordinate (C9) at (2, 1.1);
coordinate (C10) at (.8, 2.2);
coordinate (C11) at (1.3, 2);
coordinate (C12) at (1.6, 2);
draw[draw=black, line width=.5mm,record path construction] plot [smooth, tension=1] coordinates {(A1) (A2) (C1)};
draw[draw=black, line width=.5mm,record path construction] plot [smooth, tension=1] coordinates {(A1) (A4) (C2)};
draw[draw=black, line width=.5mm,record path construction] plot [smooth, tension=1] coordinates {(A1) (B1) (C3)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A2) (A3) (C4)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A2) (B2) (C5)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A4) (B4) (C6)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(B1) (B4) (C7)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A3) (B3) (C8)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(B2) (B3) (C9)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(B1) (B2) (C10)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A4) (A3) (C11)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(B4) (B3) (C12)};
begin{scope}[on background layer]
fill[red,opacity=0.3,scale=1/3,redraw segments={8,36,17,1}];
fill[green!70!black,opacity=0.3,scale=1/3,redraw segments={12,28,33,16}];
fill[cyan,opacity=0.3,scale=1/3,redraw segments={44,33,37,24}];
fill[orange,opacity=0.3,scale=1/3,redraw segments={20,44,29,41}];
fill[blue,opacity=0.3,scale=1/3,redraw segments={1,4,40,13}];
end{scope}
% test a single segment with direction
% draw[red,thick,scale=1/3,reconstruct segment/.list={40},-latex];
% get all segments with orientation
%pgfmathruncatemacro{Ymax}{value{segments}-1}
% foreach X [count=Y starting from 0] in {1,...,value{segments}}
% {ifoddY
% else
% draw[red,thick,scale=1/3,reconstruct segment/.list={Y},-latex]
% node[midway,fill=white]{Y};
% fi}
draw[fill=blue] (0,0) circle [radius=.02cm];
draw[fill=blue] (0,1) circle [radius=.02cm];
draw[fill=blue] (1,0) circle [radius=.02cm];
draw[fill=blue] (.3,.3) circle [radius=.02cm];
draw[fill=blue] (1.3,.3) circle [radius=.02cm];
draw[fill=blue] (.3,1.3) circle [radius=.02cm];
draw[fill=blue] (1,1) circle [radius=.02cm];
draw[fill=blue] (1.3,1.3) circle [radius=.02cm];
node[black] at (-.2,0) {$M_0$};
node[black] at (1,-.2) {$M_1$};
node[black] at (.15,.35) {$M_2$};
node[black] at (-.2,1) {$M_3$};
node[black] at (1.4,.5) {$M_{12}$};
node[black] at (.6,1.6) {$M_{32}$};
node[black] at (.85,1.1) {$M_{31}$};
node[black] at (1.45,1.5) {$N$};
node[black] at (1.45,-.3) {$q_1$-linha};
node[black] at (.7,.6) {$q_2$-linha};
node[black] at (0,2) {$q_3$-linha};
end{tikzpicture}
end{document}
Figuring all the subpaths is possible but may require some patience. If you want, say, to know what segment number 40 is, do
draw[red,thick,scale=1/3,reconstruct segment/.list={40},-latex];
The arrow indicates the direction. The path number 41 will run through the same curve but in opposite direction. If you want to get a survey of all segments, uncomment
foreach X [count=Y starting from 0] in {1,...,value{segments}}
{ifoddY
else
draw[red,thick,scale=1/3,reconstruct segment/.list={Y},-latex]
node[midway,fill=white]{Y};
fi}
Notice that the way to record the paths and label/number them is not unique, there might be better ways.
In general, you can recover parts of a path using pgfplots (!) library fillbetween
, and these parts can be used to fill some area they are confining. Your example is special in that you have the coordinates of the vertices explicitly. So you can store the subpaths using show path construction
. The following MWE does that in the following way:
- If you add
record path construction
, the subpaths (and their reversed versions) will be stored in a list. - You can redraw the subpaths or combine them to form a boundary of a face.
Unfortunately I find the names of your coordinates not too easy to interpret, but you will find it of course easier. For example,
fill[red,opacity=0.3,scale=1/3,redraw segments={1,4,40,13}] ;
The numbers here depend on the order in which you draw the paths.
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{decorations.pathreplacing,backgrounds}
newcounter{segments}
tikzset{record path construction/.style={decoration={show path construction,
curveto code={stepcounter{segments}stepcounter{segments}
ifdefinedLstSegments
xdefLstSegments{LstSegments,
"(tikzinputsegmentfirst) .. controls
(tikzinputsegmentsupporta) and (tikzinputsegmentsupportb)
..(tikzinputsegmentlast)","(tikzinputsegmentlast) .. controls
(tikzinputsegmentsupportb) and (tikzinputsegmentsupporta)
..(tikzinputsegmentfirst)"}
else
xdefLstSegments{"(tikzinputsegmentfirst) .. controls
(tikzinputsegmentsupporta) and (tikzinputsegmentsupportb)
..(tikzinputsegmentlast)","(tikzinputsegmentlast) .. controls
(tikzinputsegmentsupportb) and (tikzinputsegmentsupporta)
..(tikzinputsegmentfirst)"}
fi
}},postaction=decorate},
reconstruct segment/.style={/utils/exec=pgfmathsetmacro{mysegment}{{LstSegments}[#1]},
insert path=mysegment},
redraw segments/.style={/utils/exec={foreach Segment [count=nSeg] in {#1}
{pgfmathsetmacro{mysegment}{{LstSegments}[Segment]}
ifnumnSeg=1
xdefmysegments{mysegment}
else
xdefmysegments{mysegments -- mysegment}
fi}},
insert path=mysegments},%
}
begin{document}
begin{tikzpicture}[thick,scale=3]
coordinate (A1) at (0, 0);
coordinate (A2) at (0, 1);
coordinate (A3) at (1, 1);
coordinate (A4) at (1, 0);
coordinate (B1) at (0.3, 0.3);
coordinate (B2) at (0.3, 1.3);
coordinate (B3) at (1.3, 1.3);
coordinate (B4) at (1.3, 0.3);
coordinate (C1) at (0.4, 2);
coordinate (C2) at (2, -0.4);
coordinate (C3) at (1, .6);
coordinate (C4) at (2, 0.7);
coordinate (C5) at (1, 1.6);
coordinate (C6) at (2, 0.6);
coordinate (C7) at (2, 0.1);
coordinate (C8) at (2, 1.6);
coordinate (C9) at (2, 1.1);
coordinate (C10) at (.8, 2.2);
coordinate (C11) at (1.3, 2);
coordinate (C12) at (1.6, 2);
draw[draw=black, line width=.5mm,record path construction] plot [smooth, tension=1] coordinates {(A1) (A2) (C1)};
draw[draw=black, line width=.5mm,record path construction] plot [smooth, tension=1] coordinates {(A1) (A4) (C2)};
draw[draw=black, line width=.5mm,record path construction] plot [smooth, tension=1] coordinates {(A1) (B1) (C3)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A2) (A3) (C4)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A2) (B2) (C5)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A4) (B4) (C6)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(B1) (B4) (C7)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A3) (B3) (C8)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(B2) (B3) (C9)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(B1) (B2) (C10)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(A4) (A3) (C11)};
draw[draw=black,record path construction] plot [smooth, tension=1] coordinates {(B4) (B3) (C12)};
begin{scope}[on background layer]
fill[red,opacity=0.3,scale=1/3,redraw segments={8,36,17,1}];
fill[green!70!black,opacity=0.3,scale=1/3,redraw segments={12,28,33,16}];
fill[cyan,opacity=0.3,scale=1/3,redraw segments={44,33,37,24}];
fill[orange,opacity=0.3,scale=1/3,redraw segments={20,44,29,41}];
fill[blue,opacity=0.3,scale=1/3,redraw segments={1,4,40,13}];
end{scope}
% test a single segment with direction
% draw[red,thick,scale=1/3,reconstruct segment/.list={40},-latex];
% get all segments with orientation
%pgfmathruncatemacro{Ymax}{value{segments}-1}
% foreach X [count=Y starting from 0] in {1,...,value{segments}}
% {ifoddY
% else
% draw[red,thick,scale=1/3,reconstruct segment/.list={Y},-latex]
% node[midway,fill=white]{Y};
% fi}
draw[fill=blue] (0,0) circle [radius=.02cm];
draw[fill=blue] (0,1) circle [radius=.02cm];
draw[fill=blue] (1,0) circle [radius=.02cm];
draw[fill=blue] (.3,.3) circle [radius=.02cm];
draw[fill=blue] (1.3,.3) circle [radius=.02cm];
draw[fill=blue] (.3,1.3) circle [radius=.02cm];
draw[fill=blue] (1,1) circle [radius=.02cm];
draw[fill=blue] (1.3,1.3) circle [radius=.02cm];
node[black] at (-.2,0) {$M_0$};
node[black] at (1,-.2) {$M_1$};
node[black] at (.15,.35) {$M_2$};
node[black] at (-.2,1) {$M_3$};
node[black] at (1.4,.5) {$M_{12}$};
node[black] at (.6,1.6) {$M_{32}$};
node[black] at (.85,1.1) {$M_{31}$};
node[black] at (1.45,1.5) {$N$};
node[black] at (1.45,-.3) {$q_1$-linha};
node[black] at (.7,.6) {$q_2$-linha};
node[black] at (0,2) {$q_3$-linha};
end{tikzpicture}
end{document}
Figuring all the subpaths is possible but may require some patience. If you want, say, to know what segment number 40 is, do
draw[red,thick,scale=1/3,reconstruct segment/.list={40},-latex];
The arrow indicates the direction. The path number 41 will run through the same curve but in opposite direction. If you want to get a survey of all segments, uncomment
foreach X [count=Y starting from 0] in {1,...,value{segments}}
{ifoddY
else
draw[red,thick,scale=1/3,reconstruct segment/.list={Y},-latex]
node[midway,fill=white]{Y};
fi}
Notice that the way to record the paths and label/number them is not unique, there might be better ways.
edited Mar 29 at 5:06
answered Mar 29 at 4:38
marmotmarmot
116k5146277
116k5146277
... and marmot did it again!
– manooooh
Mar 29 at 5:09
1
Excellent! Unfortunately, I do not understand the construction of the "record path construction", but understand how to use it in different situations.
– nail
Mar 29 at 20:14
@nail All it does is to store certain subpaths in a list such that you can later recycle them e.g. in order to fill some area enclosed by them. The name of the decorationshow path construction
may indeed not be optimal, an alternative name would beaccess to path information
.
– marmot
Mar 29 at 20:31
add a comment |
... and marmot did it again!
– manooooh
Mar 29 at 5:09
1
Excellent! Unfortunately, I do not understand the construction of the "record path construction", but understand how to use it in different situations.
– nail
Mar 29 at 20:14
@nail All it does is to store certain subpaths in a list such that you can later recycle them e.g. in order to fill some area enclosed by them. The name of the decorationshow path construction
may indeed not be optimal, an alternative name would beaccess to path information
.
– marmot
Mar 29 at 20:31
... and marmot did it again!
– manooooh
Mar 29 at 5:09
... and marmot did it again!
– manooooh
Mar 29 at 5:09
1
1
Excellent! Unfortunately, I do not understand the construction of the "record path construction", but understand how to use it in different situations.
– nail
Mar 29 at 20:14
Excellent! Unfortunately, I do not understand the construction of the "record path construction", but understand how to use it in different situations.
– nail
Mar 29 at 20:14
@nail All it does is to store certain subpaths in a list such that you can later recycle them e.g. in order to fill some area enclosed by them. The name of the decoration
show path construction
may indeed not be optimal, an alternative name would be access to path information
.– marmot
Mar 29 at 20:31
@nail All it does is to store certain subpaths in a list such that you can later recycle them e.g. in order to fill some area enclosed by them. The name of the decoration
show path construction
may indeed not be optimal, an alternative name would be access to path information
.– marmot
Mar 29 at 20:31
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f482019%2fcolored-curved-cube%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
We kindly suggest you to show a full minimal working example (MWE) including
documentclass{...}
and ending withend{document}
.– Cragfelt
Mar 29 at 1:24
It is possible but cumbersome to fill the faces since their boundaries are intersection segments. I believe it will be much simpler if you redraw the paths in single stretches using
to[in=...,out=..]
such that successive stretches are smoothly connected.– marmot
Mar 29 at 1:46