I have my polygon read from a list of points on a text file, this works fine but I was wondering if there is a way to draw the Polygon read or at least the points. I couldn't find anything related on the documentation.
Is gnuplot the only solution? Hope you can help me.
You can use Geomview as mentioned in the documentation. But you will have to write the Polygon to OFF format, for which CGAL provides functions similar to write_off for many of its classes. You will have to open Geomview externally. Another option would be to write out a VTK file and visualize it with Paraview. This is what I use but you will have to write the code to convert from CGAL data structures to VTK data-structures.
Related
I have a general question as to how paraview reads a ASCII UNSTRUCTURED_GRID.
Does it sort through the cells and then points? or points then cells?
Paraview is built on the VTK library and both of them are open source, so if you are a programmer, you should be able to get all your answers by reading the code. What I assume (but I can be wrong, check sources of paraview to be sure) paraview uses for reading ASCII unstructured grids is vtkUnstructuredGridReader, source code of which you can find here: https://github.com/Kitware/VTK/blob/master/IO/Legacy/vtkUnstructuredGridReader.cxx (and here is the parent class that implements a lot of the functionality the reader uses https://github.com/Kitware/VTK/blob/master/IO/Legacy/vtkDataReader.cxx). Look at the RequestData method, the variable "output" is the outputted unstructured data.
To briefly answer your initial question, it looks like points are read before cells.
I was wondering if anybody knew of an easy, robust way to generate depth images from 3d models (i.e. surface models, vertices with faces), with specifiable camera parameters.
I'd prefer "free" options if possible (e.g. pyOpengl or some open source Java library rather than say matlab).
I believe it is possible with the python blender api (noted here), but I'm hoping there's an easier way.
Note also that this question works only for that special case.
You can use DECA repository in Github. There, in ./demos, I used demo_reconstruct.py code to save the depth image.
I am writing a program that will output 3D model files based on simple geometric shapes (e. g. rectangular prisms & cylinders) with known coordinates in 3-dimensional space. As an example, imagine creating a 3D model of stonehenge. this question suggests that OBJ files are the easiest to generate, but I'm struggling to find a good tutorial or easy-to-use library for doing so.
Can anyone either
(1) describe step-by-step how to create a simple file OR
(2) point me to a tutorial that describes how to do so
Notes:
* Using a GUI-based program to draw such files is not an option for me
* I have no prior experience with 3D modeling
* Other formats such as WRL or DAE would work for me as well
EDIT:
I do not need to use textures, just combinations of simple geometric shapes positioned in 3D space.
I strongly recommend to use some ASCII exchange format there are many out there I usually use these:
*.x DirectX object (it is a C++ source code)
this one is easiest to implement !!! But there are not many tools that can handle them. If you do not want to spend too much time coding then this is the right choice. Just copy the templates (at the start) from any *.x file to get started.
here some specs
*.iges common and importable on most CAD/CAM platform (Catia included)
this one is a bit complicated but for export purposes it is not that bad. It supports Volume operation like +,-,&,^ which are VERY HARD to implement properly but you do not have to use them :)
*.dxf AutoCAD exchange format
this one is even more complicated then IGES. I do not recommend to use it
*.ac AC3D
I first saw this one in flight gear.
here some specs
at first look it is quite easy but the sub-object implementation is really tricky. Unless you use it you should be fine.
This approach is easily verifiable in note pad or by loading to some 3D model viewer. Chose one that is most suitable for your needs and code save/load function to your Apps internal model class/struct. This way you will be compatible with other software and eliminate incompatibility problems which are native to creating 'almost known' binary formats like 3ds,...
In your case I would use IGES (Initial Graphics Exchange Specification)
For export you do not need to implement all just few basic shapes so it would not be too difficult. I code importers which are much much more complicated. Mine IGES loader class is about 30KB of C++ source code look here for more info
You did not provide any info about your 3D mesh model structure and capabilities
like what primitives you use, are your object simple or in skeleton hierarchy, are you using textures, and more ... so it is impossible to answer
Anyway export often looks like this:
create header and structure of target file format
if the format has any directory structure fill it and write it (IGES)
for sub-objects do not forget to add transformation matrices ...
write the chunks you need (points list, faces list, normals, ...)
With ASCII formats you can do this inside String variable so you can easily insert into or modify. Do all thing in memory and write the whole thing to file at the end which is fast and also add capability to work with memory instead of files. This is handy if you want to pack many files to single package file like *.pak or send/receive files through IPC or LAN ...
[Edit1] more about IGES
fileformat specs
I learned IGES from this pdf ... Have no clue where from I got it but this was first valid link I found in google today. I am sure there is some non registration link out there too. It is about 13.7 MB and original name IGES5-3_forDownload.pdf.
win32 viewer
this is free IGES viewer. I do not like the interface and handling but it works. It is necessary to have functional viewer for testing yours ...
examples
here are many tutorial files for many entities there are 3 sub-links (igs,peek,gif) where you can see example file in more ways for better understanding.
exporting to IGES
you did not provide any info about your 3D mesh internal structure so I can not help with export. There are many ways to export the same way so pick one that is closest to your App 3D mesh representation. For example you can use:
point cloud
rotation surfaces
rectangle (QUAD) surfaces
border lines representation (non solid)
trim surface and many more ...
for a university project I have to compute a 3D mesh, then display it.
By mesh I mean a list of triangles, where each point has a specific elevation.
What is the easiest tool that exists both on windows and linux that would allow me to display such a mesh?
I just want to be able to visualize the mesh and rotate it, and I can code any specific mesh format needed to be used as an input.
What I mostly want is a tool that is easy to install for the final user of my program.
Almost every tool reads the .obj format, for example MeshMan, MeshLab and ArtOfIllusion. They all work under Windows and Linux. Geomview (.off-Files) is also great, but hard to install under Windows.
I'm using for this purpose osgviewer from OpenSceneGraph
I wouldn't know about the easiest tool, but have you tried Blender? It's cross platform.
There are some standard file formats for triangle meshes. Try outputing to .ply file and using one of the existing viewers for that.
I tend to use VTK file formats since I work in scientific visualization; that would be overkill for you.
In fact, I wrote a VTK/QT based app for viewing meshes that can handle .ply files https://github.com/HalCanary/vtkviewer.
Does anyone know how to draw queue network graphs that can be included within LaTeX documents?
See, e.g., the following examples at TeXample.net for the TikZ and PGF packages:
Graphs
Automata and Petri nets
Use METAPOST for your problem.
There are many ways to include drawings/graphs/images in your latex document.
The easiest way is just to draw the graph in your drawing program of choice, then export the graph to jpg or png (or eps if you're not using PDFlatex), then use the graphicx package ( \usepackage{graphicx} in your preamble), and include the graph in your document by using the code
\includegraphics[width=4in]{filename.jpg}
As indicated in other answers, there are several drawing languages that can be used with tex: metapost, tikz, and PGF are are powerful. There is also asymptote, another code based drawing language.
You could also use graphviz, which is excellent if your graph is large and you need graph something like network traffic. And dot2tex will turn your graphviz file into something latex can handle.