Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The following is a possibility to get a picture:

import re
P = Polyhedron( ieqs=[ (30, -2  , -2, -1),
                       (25, -1.5, -2, -3),
                       (20, -2  , -1, -1),
                       ( 0,  1  ,  0,  0),
                       ( 0,  0  ,  1,  0),
                       ( 0,  0  ,  0,  1), ] )
pts = P.integral_points()
tex = P.projection().tikz( view=[775,386,500], angle=105, scale=0.7, opacity=0.1 )
tex = re.sub( r'\\end\{tikzpicture\}'
              , '% \end{tikzpicture} % manually commented, we still have to work'
              , tex )

for v in P.integral_points():
    tex += ( '\n\\node[inner sep=1pt,circle,draw=red!25!black,fill=red!75!black,thick,anchor=base] at (%s, %s, %s) {};'
             % tuple(v) )

tex += '\n\n\\end{tikzpicture}'
print tex

The view point, and maybe all optional parameters declared above should be change to follow the given needs.

The string tex containz the tikz code to be inserted in a valid $\LaTeX$ document, with correct imports for tikz, e.g.

\usepackage{tikz}

should be enough. Here, as a matter of taste, manual adjustments of the code are still needed. For instance:

The faces are colored w.r.t. the specifications in the lines starting with \fill[facet], and the facet style is declared in

\begin{tikzpicture}%
    [x={(0.497546cm, 0.859773cm)},
    y={(-0.106336cm, -0.071189cm)},
    z={(0.860895cm, -0.505690cm)},
    scale=0.700000,
    back/.style={loosely dotted, thin},
    edge/.style={color=blue!95!black, thick},
    facet/.style={fill=blue!95!black,fill opacity=0.100000},
    vertex/.style={inner sep=1pt,circle,draw=green!25!black,fill=green!75!black,thick,anchor=base}]

If you need special colors for each face, than define them either inside the \begin{tikzpicture}[ ... ] as facet1/.style={...} or directly the the right place. The back style should also be adjusted. Herein is also a good place to insert for instance something like

latticepoint/.style={inner sep=1pt,circle,draw=red!25!black,fill=red!75!black,thick,anchor=base}

and to use this style to have a more compact LaTeX code. This should be a good start, good luck!

The following is a possibility to get a picture:

import re
P = Polyhedron( ieqs=[ (30, -2  , -2, -1),
                       (25, -1.5, -2, -3),
                       (20, -2  , -1, -1),
                       ( 0,  1  ,  0,  0),
                       ( 0,  0  ,  1,  0),
                       ( 0,  0  ,  0,  1), ] )
pts = P.integral_points()
tex = P.projection().tikz( view=[775,386,500], angle=105, scale=0.7, opacity=0.1 )
tex = re.sub( r'\\end\{tikzpicture\}'
              , '% \end{tikzpicture} % manually commented, we still have to work'
              , tex )

for v in P.integral_points():
    tex += ( '\n\\node[inner sep=1pt,circle,draw=red!25!black,fill=red!75!black,thick,anchor=base] at (%s, %s, %s) {};'
             % tuple(v) )

tex += '\n\n\\end{tikzpicture}'
print tex

The view point, and maybe all optional parameters declared above should be change to follow the given needs.

The string tex containz contains the tikz code to be inserted in a valid $\LaTeX$ document, with correct imports for tikz, e.g.

\usepackage{tikz}

should be enough. Here, as a matter of taste, manual adjustments of the code are still needed. For instance:

The faces are colored w.r.t. the specifications in the lines starting with \fill[facet], and the facet style is declared in

\begin{tikzpicture}%
    [x={(0.497546cm, 0.859773cm)},
    y={(-0.106336cm, -0.071189cm)},
    z={(0.860895cm, -0.505690cm)},
    scale=0.700000,
    back/.style={loosely dotted, thin},
    edge/.style={color=blue!95!black, thick},
    facet/.style={fill=blue!95!black,fill opacity=0.100000},
    vertex/.style={inner sep=1pt,circle,draw=green!25!black,fill=green!75!black,thick,anchor=base}]

If you need special colors for each face, than define them either inside the \begin{tikzpicture}[ ... ] as facet1/.style={...} or directly the at the right place. The back style should also be adjusted. Herein is also a good place to insert for instance something like

latticepoint/.style={inner sep=1pt,circle,draw=red!25!black,fill=red!75!black,thick,anchor=base}

and to use this style in the changed line of code

tex += ( '\n\\node[latticepoint] at (%s, %s, %s) {};' % tuple(v) )

to have a more compact LaTeX $\LaTeX$ code. This should be a good start, good luck!