Graphics, Figures & TablesRendering a 3D Triangulation

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
tomtom
Posts: 9
Joined: Sun Jul 01, 2012 9:49 pm

Rendering a 3D Triangulation

Post by tomtom »

I have got two files one containing vertices (one per line) and another containing the three coordinates of the triangle in form of indexes, as they appear in the first file (one triangle per line).

Is there a way to render a three dimensional surface from that?
How can I access coordinates from file 1 by index? By the way, the number of vertices and triangles is known.


Any hints would be great.
Thanks.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Rendering a 3D Triangulation

Post by localghost »

For an adequate problem description and in order to avoid guesses and random shots please prepare a proper minimal example that contains all necessary but only relevant information in form of code.


Thorsten
tomtom
Posts: 9
Joined: Sun Jul 01, 2012 9:49 pm

Rendering a 3D Triangulation

Post by tomtom »

Someting like this:

Code: Select all

\begin{minipage}{\textwidth}
\begin{tikzpicture}
\begin{axis}[view/h=120, width=\linewidth]
\addplot3[
    opacity=0.5,
    patch,
    patch type=triangle,%polygon,
    patch table ={faces.data}
]
table[header=false, x index=0, y index=1, z index=2] {vert.data};
\end{tikzpicture}
\end{minipage}

I guess something is going wrong, when reading the faces.data. Don't know if I can read the file like this.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Rendering a 3D Triangulation

Post by Stefan Kottwitz »

This is not yet a Infominimal working example. Some code, but not something we could work with. Please follow the link, to learn how and why.

Stefan
LaTeX.org admin
tomtom
Posts: 9
Joined: Sun Jul 01, 2012 9:49 pm

Rendering a 3D Triangulation

Post by tomtom »

I want to render a 3d shape by triangles.

I have got two things:

1) a list of vertices
2) a list of triangles, defined by 3 numbers, which represent the linenumber in the vertices list

On http://tex.stackexchange.com/questions/ ... nce-in-the one can find an example.

I need to load both, the vertices list and the triangle list from file.

Thats what my code intends to do.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Rendering a 3D Triangulation

Post by localghost »

Please let us know which part of the instructions for preparing a proper minimal example you did not understand. Perhaps some further advice is necessary here. At the moment there is no useful information to work with.
tomtom
Posts: 9
Joined: Sun Jul 01, 2012 9:49 pm

Re: Rendering a 3D Triangulation

Post by tomtom »

Ok. Managed to do it.
Used about 1000 vertices and 3000 faces.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Rendering a 3D Triangulation

Post by localghost »

tomtom wrote:Ok. Managed to do it.
Used about 1000 vertices and 3000 faces.
And we would like to know how exactly you did that. Hence a complete solution would be very kind in order not to make this thread useless for others who may come here by search engines.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Re: Rendering a 3D Triangulation

Post by Stefan Kottwitz »

I support this. The forum is also a knowledge base with many solutions already to find. So it would be great if you would finally post your solution, also if you found it yourself. You know, if we found solutions we also post it to help.

Stefan
LaTeX.org admin
Post Reply