PointI = listPoints[triangulation[i][1]]
PointJ = listPoints[triangulation[i][2]]
PointK = listPoints[triangulation[i][3]]
- output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\mpcolor{" .. color .."};"
+ output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\mpcolorcolor;"
end
-- draw and fill the bad triangle
for i=1,#badTriangles do
PointI = listPoints[triangulation[badTriangles[i]][1]]
PointJ = listPoints[triangulation[badTriangles[i]][2]]
PointK = listPoints[triangulation[badTriangles[i]][3]]
- output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\mpcolor{" .. color .."};"
- output = output .. "fill (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\mpcolor{" .. colorBack .."};"
+ output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\mpcolorcolor;"
+ output = output .. "fill (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\mpcolorcolorBack;"
end
-- draw the circoncircle
for i=1,#badTriangles do
PointJ = listPoints[triangulation[badTriangles[i]][2]]
PointK = listPoints[triangulation[badTriangles[i]][3]]
center, radius = circoncircle(PointI, PointJ, PointK)
- output = output .. "draw fullcircle scaled ("..radius .."*2u) shifted ("..center.x .. "*u," .. center.y .. "*u) dashed evenly withcolor \\mpcolor{" .. colorCircle .."};"
+ output = output .. "draw fullcircle scaled ("..radius .."*2u) shifted ("..center.x .. "*u," .. center.y .. "*u) dashed evenly withcolor \\mpcolorcolorCircle;"
end
-- mark the points
for i=1,#listPoints do
- output = output .. "dotlabel.llft (btex $\\MeshPoint_{" .. i .. "}$ etex, (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\mpcolor{" .. color .."};"
+ output = output .. "dotlabel.llft (btex $\\MeshPoint_{" .. i .. "}$ etex, (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\mpcolorcolor;"
end
-- mark the point to add
- output = output .. "dotlabel.llft (btex $\\NewPoint$ etex,(" .. P.x ..",".. P.y .. ")*u) withcolor \\mpcolor{" .. colorNew .."};"
+ output = output .. "dotlabel.llft (btex $\\NewPoint$ etex,(" .. P.x ..",".. P.y .. ")*u) withcolor \\mpcolorcolorNew;"
elseif(step == "cavity") then
polygon = buildCavity(badTriangles, triangulation)
polyNew = cleanPoly(polygon)
PointI = listPoints[triangulation[i][1]]
PointJ = listPoints[triangulation[i][2]]
PointK = listPoints[triangulation[i][3]]
- output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\mpcolor{" .. color .."};"
+ output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\mpcolorcolor;"
end
-- fill and draw the cavity
path = ""
PointI = listPoints[polyNew[i]]
path = path .. "(".. PointI.x ..",".. PointI.y ..")*u--"
end
- output = output .. "fill " .. path .. "cycle withcolor \\mpcolor{" .. colorBack .."};"
- output = output .. "draw " .. path .. "cycle withcolor \\mpcolor{" .. colorNew .."} withpen pencircle scaled 1pt;"
+ output = output .. "fill " .. path .. "cycle withcolor \\mpcolorcolorBack;"
+ output = output .. "draw " .. path .. "cycle withcolor \\mpcolorcolorNew withpen pencircle scaled 1pt;"
-- mark the points of the mesh
for i=1,#listPoints do
- output = output .. "dotlabel.llft (btex $\\MeshPoint_{" .. i .. "}$ etex, (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\mpcolor{" .. color .."};"
+ output = output .. "dotlabel.llft (btex $\\MeshPoint_{" .. i .. "}$ etex, (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\mpcolorcolor ;"
end
-- mark the adding point
- output = output .. "dotlabel.llft (btex $\\NewPoint$ etex,(" .. P.x ..",".. P.y .. ")*u) withcolor \\mpcolor{" .. colorNew .."};"
+ output = output .. "dotlabel.llft (btex $\\NewPoint$ etex,(" .. P.x ..",".. P.y .. ")*u) withcolor \\mpcolorcolorNew ;"
elseif(step == "newT") then
polygon = buildCavity(badTriangles, triangulation)
polyNew = cleanPoly(polygon)
PointI = listPoints[triangulation[i][1]]
PointJ = listPoints[triangulation[i][2]]
PointK = listPoints[triangulation[i][3]]
- output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\mpcolor{" .. color .."};"
+ output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\mpcolorcolor ;"
end
-- fill the cavity
path = ""
PointI = listPoints[polyNew[i]]
path = path .. "(".. PointI.x ..",".. PointI.y ..")*u--"
end
- output = output .. "fill " .. path .. "cycle withcolor \\mpcolor{" .. colorBack .."};"
+ output = output .. "fill " .. path .. "cycle withcolor \\mpcolorcolorBack;"
-- draw the new triangles composed by the edges of the polygon and the added point
for i=1,#polygon do
- output = output .. "draw".."(".. listPoints[polygon[i][1]].x .. "," .. listPoints[polygon[i][1]].y .. ")*u -- (" .. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y ..")*u withcolor \\mpcolor{" .. colorNew .."} withpen pencircle scaled 1pt;"
- output = output .. "draw".."(".. listPoints[polygon[i][1]].x .. "," .. listPoints[polygon[i][1]].y .. ")*u -- (" .. P.x .. "," .. P.y ..")*u withcolor \\mpcolor{" .. colorNew .."} withpen pencircle scaled 1pt;"
- output = output .. "draw".."(".. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y .. ")*u -- (" .. P.x .. "," .. P.y ..")*u withcolor \\mpcolor{" .. colorNew .."} withpen pencircle scaled 1pt;"
+ output = output .. "draw".."(".. listPoints[polygon[i][1]].x .. "," .. listPoints[polygon[i][1]].y .. ")*u -- (" .. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y ..")*u withcolor \\mpcolorcolorNew withpen pencircle scaled 1pt;"
+ output = output .. "draw".."(".. listPoints[polygon[i][1]].x .. "," .. listPoints[polygon[i][1]].y .. ")*u -- (" .. P.x .. "," .. P.y ..")*u withcolor \\mpcolorcolorNew withpen pencircle scaled 1pt;"
+ output = output .. "draw".."(".. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y .. ")*u -- (" .. P.x .. "," .. P.y ..")*u withcolor \\mpcolorcolorNew withpen pencircle scaled 1pt;"
end
-- mark points
for i=1,#listPoints do
- output = output .. "dotlabel.llft (btex $\\MeshPoint_{" .. i .. "}$ etex, (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\mpcolor{" .. color .."};"
+ output = output .. "dotlabel.llft (btex $\\MeshPoint_{" .. i .. "}$ etex, (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\mpcolorcolor ;"
end
-- mark the added point
- output = output .. "dotlabel.llft (btex $\\NewPoint$ etex,(" .. P.x ..",".. P.y .. ")*u) withcolor \\mpcolor{ " .. colorNew .."};"
+ output = output .. "dotlabel.llft (btex $\\NewPoint$ etex,(" .. P.x ..",".. P.y .. ")*u) withcolor \\mpcolorcolorNew ;"
end
return output
end
\pagestyle{empty}
\begin{document}
-\buildMesh[print=points, meshpoint = I, color=red]{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(3,1);(6,1.5)}
-
-\buildMesh[tikz, bbox = show]{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(3,1);(6,1.5)}
-
-\buildMesh[mode=ext]{mesh.txt}
-
-\meshAddOnePoint[
-meshpoint = x,
-colorNew =green!20!red,
-colorBack=red!10,
-colorCircle = green!70,
-scale=0.6cm]
-{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
-\meshAddOnePoint[
-meshpoint = x,
-colorBack=red!10,
-colorNew = green!20!red,
-scale=0.6cm,
-step=cavity]
-{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
+% \buildMesh[print=points, meshpoint = I, color=red]{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(3,1);(6,1.5)}
+
+% \buildMesh[tikz, bbox = show]{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(3,1);(6,1.5)}
+
+% \buildMesh[mode=ext]{mesh.txt}
+
+% \meshAddOnePoint[
+% meshpoint = x,
+% colorNew =green!20!red,
+% colorBack=red!10,
+% colorCircle = green!70,
+% scale=0.6cm]
+% {(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
+% \meshAddOnePoint[
+% meshpoint = x,
+% colorBack=red!10,
+% colorNew = green!20!red,
+% scale=0.6cm,
+% step=cavity]
+% {(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
\meshAddOnePoint[
meshpoint = x,
colorBack=red!10,
colorNew = green!20!red,
scale=0.6cm,
-step=newtriangles,
+step=badtriangles,
newpoint = y,
bbox = show
]
{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
+\mplibcolor\myclr{red}
-% \newcommand\mpred{\mpcolor{red}}
-% \newcommand\test{dotlabel(btex $x$ etex, (0,0));draw (0,0)--(2cm,0) withcolor red;}
+\newcommand\test{draw (0,0) -- (2cm,0) withcolor \myclr;}
-% \begin{mplibcode}
-% beginfig(0);
-% %\meshAddOnePoint[picture=embedded]{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
-% \test
-% endfig;
-% \end{mplibcode}
+\begin{mplibcode}
+ beginfig(0);
+ %\meshAddOnePoint[picture=embedded]{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
+ \test
+ endfig;
+\end{mplibcode}
\end{document}