Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm doing a bit of 3D primitive fugures using this code:

\documentclass[tikz,10pt]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{mathptmx}
\usetikzlibrary{arrows,shadows,calc,shapes,backgrounds,intersections,positioning} 
\newcommand{\Grid}[2]{
\draw[white] (0,0)--(#1cm,0)--(#1cm,#2cm)--(0,#2cm)--(0,0);
\draw[very thin,color=gray] (0,0) grid (#1,#2);
 \foreach \j  in {0,...,#1} {
      \node[] at (\j,0) {$\j$};
    }

 \foreach \j  in {0,...,#2} {
      \node[] at (0,\j) {$\j$};
    }}
\begin{document}

\begin{tikzpicture}[line width=1pt,node distance=.1cm]
\tikzset{drawstyle1/.style={draw=cyan,fill=brown!50}}
\tikzset{drawstyle2/.style={draw=black,fill=cyan}}

%GRID
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\Grid{8}{10}
%===================================================================
%Brown parr
\coordinate (A) at (0,2);
\coordinate (B) at (0,7);
\coordinate (C) at (0.3,7);
\coordinate (D) at (0.3,2);
\def\Anf{60}
\newcommand{\parr}[7]{
\draw[#7] (#1,#2)--(#1,#2+#3)--(#1+#5,#2+#3)--(#1+#5,#2)--cycle;

\draw[#7] (#1,#2+#3)--++(#6:#4)--++(0:#5)--(#1+#5,#2+#3)--cycle;
\draw[#7](#1+#5,#2+#3)--(#1+#5,#2)--++(#6:#4)--++(90:#3)--(#1+#5,#2+#3)--cycle;
}
\parr{0cm}{2cm}{5cm}{3cm}{0.3cm}{45}{drawstyle1}
\parr{.3cm}{2cm}{.5cm}{3cm}{7cm}{45}{drawstyle2}

\end{tikzpicture}
\end{document}

This is what I got: enter image description here

My problem is that I can not found right way to close paths? I close path in drawing rectangles by points like this:

\draw[#7] (#1,#2)--(#1,#2+#3)--(#1+#5,#2+#3)--(#1+#5,#2)--cycle;

But when I start to draw another rectangle touching first, there is a problem with lines at corners.

What is the simple or complex way to close paths correctly? Should I use clip somehow?

share|improve this question
2  
Quick fix: add line join=round to your tikzpicture options to avoid the artefacts. –  Jake Feb 18 at 10:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.