summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pst-solides3d/doc-en/par-datfile_en_corr.tex
blob: 6d865d979b43682db027e6acc818b1a7493c348c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
\section{Using the data file types \texttt{.obj} and \texttt{.off}}

Sometimes it will helpful to use external files, either for reading or writing.
When there is a solid which needs a long time to be calculated and which 
will be tested in different views or different colors, it is very 
interesting to save them externally and then only reread them by 
avoiding the time expensive recalculations. In particular, this technique 
is often used to generate some animations.
One can also export a solid by that method to reuse with another software.

For \texttt{pst-solides3d}, all the procedures of reading$/$writing are 
delegated to the  PostScript interpreter (and not to \TeX {} or \LaTeX).
 Consequently it is not the \LaTeX{} compilation that will cause the 
 execution of reading$/$writing, but the visualisation of the PostScript 
 file that is produced.

Generally the reading of external files by a PostScript interpreter doesn't 
cause any trouble normally. The writing of files however, can cause some 
security problems and it is often the case that the PostScript viewer forbids 
the writing by default. So the system must be configured  to get authorisation for that writing.

\encadre{By default, under Windows and Linux, the security of files on the 
hard drive is activated and doesn't allow to write on the drive.
To deactivate that security option, more or less temporarily, here the two 
corresponding procedures:

\begin{description}

  \item[Linux:] The advice from Jean-Michel \textsc{Sarlat}: the simplest will 
  be to use GhostScript directly, within the console. As there is no image to wait for:

\$$>$ gs  -dNOSAFER  monfichier.ps quit.ps
  \item[Windows:] Within the menue \texttt{Options}, the option
    \textsf{Security of files} must be turned to unchecked.
\end{description}}


\subsection{\texttt{.dat} files (specific to \texttt{pst-solides3d})}

In \texttt{pst-solides3d}, the data structure used for a solid has 4 fields. 
It can be stored in a set of $4$
\texttt{.dat} files.


\subsubsection{Writing \texttt{.dat} files}

One uses the action \verb+writesolid+ within \bs{psSolid}, and one
uses the option \verb+file+ to specify the name of the file.

For example, let's look at the code below:
\begin{verbatim}
\psSolid[object=tore,
   file=montore,
   action=writesolid]
\end{verbatim}

The command chain
\Cadre{LaTeX->dvips->GSview (Windows) or gv (Linux)}
first compiles, then transforms into PostScript to finally get
visualised.

That last operation creates 4 files:
\begin{itemize}
  \item \texttt{montore-sommets.dat  } $\rightarrow$ the list of the vertices;
  \item \texttt{montore-faces.dat    } $\rightarrow$ the list of the faces;
  \item \texttt{montore-couleurs.dat } $\rightarrow$ the colors of the faces;
  \item \texttt{montore-io.dat       } $\rightarrow$ the limits of the indices 
  of the external and internal faces.
\end{itemize}
\encadre{All these four files will automatically be saved within the same folder as the generating file.}

\subsubsection{Reading \texttt{.dat} files}

One uses the object \verb+datfile+ of \bs{psSolid}, with the argument
\verb+file+ to specify the name.
Now the code
\begin{verbatim}
\psSolid[object=datfile, file=montore]
\end{verbatim}
will allow to use the object---now saved in the \texttt{.dat} files generated---
as described in the previous paragraph.

\subsection{\texttt{.obj} files}

We use only a simplified form of the \texttt{.obj} format. In particular, the 
files should not contain a character like
\verb+#+ (the character for a comment in that format).

This format just uses a single file and permits within this file to specify 
the vertices and the faces.

\subsubsection{Writing \texttt{.obj} files}

One uses the action \verb+writeobj+ in \bs{psSolid}, and one uses
the option \verb+file+ to specify the name of the file.

For example, the code below:
\begin{verbatim}
\psSolid[object=tore,
   file=montore,
   action=writeobj]
\end{verbatim}
will produce a single file \texttt{montore.obj} (after compilation and
visualisation of the \texttt{.ps} that was produced).

\subsubsection{Reading \texttt{.obj} files}

One uses the option \verb+objfile+ of \bs{psSolid}, with the argument
\verb+file+ to specify the name of the file.
Now the following code
\begin{verbatim}
\psSolid[object=objfile, file=montore]
\end{verbatim}
will allow to use the object---now saved in the \texttt{.obj} file generated---as 
described in the previous paragraph.

\begin{LTXexample}[width=6cm]
\psset{viewpoint=20 15 10 rtp2xyz,Decran=20}
\begin{pspicture}(-3,-4)(3,3)
\psframe*[linecolor=cyan!50](-3,-4)(1,3)
\psSolid[object=objfile,
         unit=20,RotX=60,
         file=rocket]%
\end{pspicture}
\end{LTXexample}



\subsection{\texttt{.off} files}

We use only a simplified form of the \texttt{.off} format. In particular, these 
files only comprise \verb+v+ and \verb+f+ entries.

This format just uses a single file and permits within this file to specify the 
vertices and the faces.

\subsubsection{Writing \texttt{.off} files}

One uses the action \verb+writeobj+ in \bs{psSolid}, and one uses the option
 \verb+file+ to specify the name of the file.

For example the code below:
\begin{verbatim}
\psSolid[object=tore,
   file=montore,
   action=writeoff]
\end{verbatim}
will produce the \texttt{montore.off} file (after compilation and
visualisation of the \texttt{.ps} that was produced).

\subsubsection{Reading.off files}

One uses the option \verb+offfile+ of \bs{psSolid}, with the argument
\verb+file+ to specify the name of the file.
Now the following code
\begin{verbatim}
\psSolid[object=offfile, file=montore]
\end{verbatim}
will allow to use the object---now saved in the \texttt{.off} file 
generated---like described in the previous paragraph. 

\endinput