2 Copyright (C) 2005,2006,2007,2008 Eugene K. Ressler, Jr.
4 This file is part of Sketch, a small, simple system for making
5 3d drawings with LaTeX and the PSTricks or TikZ package.
7 Sketch is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 Sketch is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Sketch; see the file COPYING.txt. If not, see
19 http://www.gnu.org/copyleft */
24 print_pt_2d (FILE * f
, POINT_2D pt
)
26 fprintf (f
, "(%.3f,%.3f)", pt
[X
], pt
[Y
]);
30 print_pt_3d (FILE * f
, POINT_3D pt
)
32 fprintf (f
, "(%.3f,%.3f,%.3f)", pt
[X
], pt
[Y
], pt
[Z
]);
36 print_polyline_3d (FILE * f
, POLYLINE_3D
* polyline
)
40 fprintf (f
, "\\line");
41 for (i
= 0; i
< polyline
->n_vertices
; i
++)
42 print_pt_3d (f
, polyline
->v
[i
]);
47 print_polygon_2d (FILE * f
, POLYGON_2D
* polygon
)
51 fprintf (f
, "\\polygon");
52 for (i
= 0; i
< polygon
->n_sides
; i
++)
53 print_pt_2d (f
, polygon
->v
[i
]);
58 print_polygon_3d (FILE * f
, POLYGON_3D
* polygon
)
62 fprintf (f
, "\\polygon");
63 for (i
= 0; i
< polygon
->n_sides
; i
++)
64 print_pt_3d (f
, polygon
->v
[i
]);
69 print_plane (FILE * f
, PLANE
* plane
)
71 fprintf (f
, "\\plane[n=%.3f %.3f %.3f,p=%.3f %.3f %.3f,c=%.3f]\n",
72 plane
->n
[X
], plane
->n
[Y
], plane
->n
[Z
],
73 plane
->p
[X
], plane
->p
[Y
], plane
->p
[Z
], plane
->c
);