Sometimes I have to put text on a path

Sunday, July 13, 2008

GNU Triangulated Surface Library - 3D surfaces meshed with interconnected triangles

GTS stands for the GNU Triangulated Surface Library. It is an Open Source Free Software Library intended to provide a set of useful functions to deal with 3D surfaces meshed with interconnected triangles. The source code is available free of charge under the Free Software LGPL license.

The code is written entirely in C with an object-oriented approach based mostly on the design of GTK+. Careful attention is paid to performance related issues as the initial goal of GTS is to provide a simple and efficient library to scientists dealing with 3D computational surface meshes.

A brief summary of its main features:


  • Simple object-oriented structure giving easy access to topological properties.
  • 2D dynamic Delaunay and constrained Delaunay triangulations.
  • Robust geometric predicates (orientation, in circle) using fast adaptive floating point arithmetic (adapted from the fine work of Jonathan R. Shewchuk).
  • Robust set operations on surfaces (union, intersection, difference).
  • Surface refinement and coarsening (multiresolution models).
  • Dynamic view-independent continuous level-of-detail.
  • Preliminary support for view-dependent level-of-detail.
  • Bounding-boxes trees and Kd-trees for efficient point location and collision/intersection detection.
  • Graph operations: traversal, graph partitioning.
  • Metric operations (area, volume, curvature ...).
  • Triangle strips generation for fast rendering.

The screenshots will give you an idea of what GTS can do. You can read the reference manual for more information.

Help would be very appreciated and you are very welcome to contribute.

A multi-resolution model with respectively 2918, 4849 and 15076 triangles. The original model is on the left and was refined using a midpoint insertion technique.

---ref:

http://gts.sourceforge.net/

Lessons in 3d for graphic designers afraid of the pointy end of polygons

SWIMMING IN 3D SPACE


Before you even start models you have to make a mental shift to 3d from 2d. You may think that is easy enough, but when starting work on 3d models, the first mistake that most people make is to model within one view. This is a common problem, and comes from you being used to 2d design packages. If you are not careful the model will look ok from one side and will be entirely messed up on the others. Then the first lesson really is to learn to constantly look at your model from all sides. You can either set up many views (front, back, top…) to do this or you can rotate the mesh to check it while you model.

THE 3D AXIS

To make the move from2d thinking to 3d thinking you first have to get used to that extra axis that will turn up in your work. Look at this illustration… If you hold a pencil to a sheet of paper as though you were sketching, you will see that the length and breadth of the sheet of paper form 2 axis. The pencil which is at 90 degrees angle from the sheet is the third axis. See?So you have…
  • Length = z
  • Breadth = x
  • Height = y

Different software refer to these axis differently. It doesn’t matter what LETTER you call it by, as long as you understand these 3 dimensions it applies to all 3d software. This will help you figure out the concept of views

UNDERSTANDING THE DIFFERENT VIEWS

3d ViewsIf you ever looked at a building blueprint and sketches then you already have a pretty good idea of views. Here are the different views of the letter T. The Orthographic view allows you to see the 3 dimensional view without distortion. The perspective view is the true 3d view. The others are from fixed sides. You need to switch views constantly when modeling in 3d to ensure that the model is consistent. After a while you will instinctively know which side you are looking at the model from.

VIEWING THE MODEL

NavigationTo view the model you will basically use three types of actions. These are the basic standard actions that are required to view the model in 3d space.
  • Rotating the view
  • Panning the view (Left to right or top to bottom)
  • Zooming in and out of the view

Use these in combination to the views and the axis and you have a complete understanding of how 3d environments operate.

One final detail that is interface related is how the mesh itself is viewed within the 3d modeling window. You may choose to view it as a wireframe, shaded view or textured views. Each view helps differently. You need the wiremesh view to manipulate individual mesh components. View ModeThe shaded view allows you to understand lighting and the volume created because of it. The textured view is the view of the model with it’s texturing completed. To understand the difference between shading and texturing… think of a painted terracotta pot. The inherent brown of the Terracotta is it’s Shading and the painted patterns is the texture in 3d parlance.

THE COMPONENTS OF THE MESH

Now we begin with the actual building of 3d models. There are different types of mesh construction the primary two being:
  • Polygonal or Box Modeling
  • Spline based modeling

This website deals completely with Polygonal or Box modeling methods only. The difference between the two is that spline are built out of beizer curves like the ones you use in Illustrator or Coreldraw. Box modeling involves creating a polygonal box, subdividing it into smaller pieces and manipulating them until a desired mesh is formed.

To understand Polygonal modeling, let’s take a look at the component parts of a mesh or an OBJECT.

components of a mesh

An object is composed of 3 types of components.
  • The vertice
  • The Edge
  • The Face

The vertice is the smallest component while the edge is the line between 2 vertices and the face is made up of 3 or more of the lines linking together to form a face. While modeling you will manipulate vertices, edges and faces like clay to build what you have in mind. To do this 3d software offer a variety of tools such as extrusion, lathe, sweeping etc.

Extruding an Object

For example to extrude an object, you will first select a face and then extrude it in a certain direction to create a 3d object. This lampshade was entirely created through extrusions only.

Gsculpt Lampshade

Click here to download the Gsculpt lampshade file.

SMOOTHING AND ORGANIC SHAPES

By now you are wondering how you could ever arrive at smooth organic shapes by something like box modeling. 3d software use a system called subdivided surfaces to break up a large polygon into many smaller faces to smooth out the faces that make up the mesh. Sometimes a single face may be replaced by hundreds of faces so that the edges of a model become smooth. Subdivision SUrfacesObviously this puts a strain on your computer. To avoid sluggishness, softwares always maintain the low-poly (low resolution) version of the model and replace the subdivisions just before it actually renders the finished picture.

———————————————————————————

---ref:

http://thirdee.wordpress.com/about/essential-software/3d-basics/

topeScope freeware shareware 3D mac osx, UO format

http://www.ripplon.com/topeScope/

Read stl, gts, nff, q3o, obj, off, ply, tri, uo

UO (point X Y Z)

topeScope Base features:



'topeScope Plus additions:



he UO file format is used to store 3-d point sets (collection of X Y Z coordinates).
snapshot

[from the MINGLE site]

sourceforget and 3D; opensource; my list

name (alphab. order...) :

antiprism

AutoQ3DCommunity1-38qt4source

avoCADo-08.03-preAlpha-Mac

ayam1.14.macosx.aqua

blender

Fusion Viewer

geoblock

gmsh-2.2.0-MacOSX

GNU Triangulated Surface Library

gsculpt

imageJ-plugins

MagCAD

Prim_Builder_0.4.1

quesa

Stani's Python Editor

surfit

thsim

wings-0.99.02-macosx

Friday, July 11, 2008

codes matlab 2D 3D image (fr)

xes abscisses d'un graphique ?
Les objets de type Axes ne possèdent pas de propriété permettant d'incliner les labels des repères de l'axe des abscisses d'un graphique.

Il existe néanmoins plusieurs contributions disponibles sur le File EXchange qui répondent à ce besoin :


---------------

Comment mettre une étiquette à mes points ?
x=rand(3,1);
y=rand(3,1);

figure
plot(x,y,'r+');

str=num2str([1:numel(x)].','%1d'); % ATTENTION le premier argument de NUM2STR doit être un vecteur colonne
text(x+0.01,y+0.01,str) % Le décalage de 0.01 est arbitraire ici.
------------
omment tracer une ligne dont la couleur varie ?
x = rand(3,1);
y = rand(3,1);

figure
subplot(2,1,1)
plot(x,y)

subplot(2,1,2)

patch('xdata',[x;x(end:-1:1)],...
'ydata',[y;y(end:-1:1)],...
'facecolor','interp', ...
'edgecolor','interp',...
'facevertexcdata',[y;y(end:-1:1)])
-------------
omment animer le tracé d'une courbe ?
% Génération des données
th=0:0.02:10*pi;
y=sin(th);

% Création de l'objet Figure contenant les tracés
fig=figure;

% Première objet Axes où est tracée la courbe directe
subplot(2,1,1)
% Tracé de la courbe
plot(th,y,'r-')
% Ajustement des limites de l'objet Axes
xlim([min(th) max(th)])
ylim([min(y) max(y)])

% Second objet Axes où est tracée la courbe animée
subplot(2,1,2)

% Modification de la propriété DoubleBuffer de l'objet Figure pour
% éviter le clignotement de la fenêtre
% NECESSAIRE POUR TOUTE ANIMATION
set(fig,'doublebuffer','on')

% Tracé du premier point de la courbe
% et récupération de l'identifiant (handle) p de l'objet Line crée.
p=plot(th(1),y(1),'r-');
% Ajustement des limites de l'objet Axes
xlim([min(th) max(th)])
ylim([min(y) max(y)])

% On boucle sur le nombre de points à tracer. 
% On démarre à 2 puisque le premier est déjà tracé
for n=2:numel(th)

% Ajout des points de la courbe au fur et à mesure
% en utilisant la combinaison SET + identifiant (handle)
set(p,'xdata',th(1:n),'ydata',y(1:n));
% Forçage de l'affichage du tracé
drawnow

end
-------------
Comment récupérer les valeurs de données tracées ?
Dans tous les cas, il faut utiliser la fonction FINDOBJ pour récupérer l'identifiant de l'objet dont on veut
récupérer les données.

Pour les objets de type Line (nuage de points ou lignes), Surface ou Mesh, on récupère les propriétés XDATA, YDATA et ZDATA

Pour les objets de type Image, on récupère la propriété CDATA

Pour les objets de type Patch, on récupère, soit les propriétés XDATA, YDATA et ZDATA, soit les propriétés VERTICES et FACES


[X,Y,Z] = peaks(20)
surf(X,Y,Z);

h=findobj('type','surf');
xx=get(h,'xdata')
yy=get(h,'ydata')

zz=get(h,'zdata')
--------------------
Comment redimensionner une image ?
La première solution consiste à utiliser la fonction IMRESIZE contenue dans l'Image Processing Toolbox.

La deuxième solution utilise l'indexage des matrices. Puisqu'une
image est une matrice 2D ou 3D (RGB), il est très simple de diminuer la
taille d'une image en jouant sur l'indexage. Par exemple, pour diminuer
par deux la taille d'une image 2D, il suffit de ne conserver qu'un pixel sur deux


img=rand(150,200); % Une image 2D aléatoire
size(img)

ans =

150   200

img=img(1:2:end,1:2:end);

size(img)

ans =

75   100

--------Pour une image 3D (RGB), le code devient :
img=rand(150,200,3); % Une image 3D (RGB) aléatoire
size(img)

ans =

150   200     3

img=img(1:2:end,1:2:end,:);

size(img)

ans =

75   100     3
-----
On remarque que cette solution utilisant l'indexage se limite à des facteurs de réductions/agrandissement entier.

La troisième solution utilise les fonctions d'interpolation.

Soit INTERP2 pour diminuer par deux la taille d'une image 2D :
img = rand(150,200); % Une image 2D aléatoire
size(img)

ans =

150   200

[c,r ] = size(img); % Récupération des 2 dimensions de l'image

[ci,ri] = meshgrid(1:2:r,1:2:c); % Génération de la grille d'interpolation

img = interp2(img,ci,ri); % Interpolation des valeurs des pixels

size(img)

ans =

75   100

Soit INTERP3 pour diminuer par deux la taille d'une image 3D :
img = rand(150,200,3); % Une image 3D (RGB) aléatoire
size(img)

ans =

150   200     3

[c,r,p] = size(img); % Récupération des 3 dimensions de l'image

[ci,ri,pi] = meshgrid(1:2:r,1:2:c,1:p); % Génération de la grille d'interpolation

img = interp3(img,ci,ri,pi); % Interpolation des valeurs des pixels du plan R

size(img)

ans =

ans =

75   100     3

VRML of a segmented image

I have an image segmented in matlab (in the form of 3d matrix with
elements 0 and 1) and from that matrix I want to create a vrml model,
do you know the best way to do it (with or without matlab, even if
with matlab I have the virtual reality toolbox installed)!

f,v]=isosurface (3Dmatrix,0);
translated to vrml with a simple script:

...
[fid,errmsg] = fopen('mymodel.wrl','w+');
...

----

fprintf(fid,' coord Coordinate {\n');
fprintf(fid,' point [\n');

for i=1:size (v,1)
fprintf(fid,'%f ',v(i,1)/500);
fprintf(fid,'%f ',v(i,2)/500);
fprintf(fid,'%f ',v(i,3)/500);
fprintf(fid,'\n');
end

fprintf(fid,' ]#Point\n');
fprintf(fid,' }#Coordinate\n');
fprintf(fid,' index[\n');

for i=1:size (f,1)
fprintf(fid,'%d ',f(i,1)-1);
fprintf(fid,'%d ',f(i,2)-1);
fprintf(fid,'%d ',f(i,3)-1);
fprintf(fid,'\n');
end

fprintf(fid,' ]#index\n');

...

fclose (fid);

Will you please show some (first ten lines - max .1kB) of the result?

unfortunately 30 megabytes for a 218x218x128 image!

The wrl file is not an image, it is the geometry and lighting.
You are sending the browser (the program that runs the .wrl file

(sets of x,y,z vertex values along with the info to make them
into triangles and lights that become pixels.

http://www.web3d.org/x3d/specifications/ISO-IEC-19776-X3DEncodings-XML-ClassicVRML/
that's too much (for both speed and memory), even because i want to
deal with much bigger matrix!

Great, we all want that.

ref: http://newsgroups.derkeiler.com/Archive/Comp/comp.lang.vrml/2007-08/msg00007.html

blender file format data

Here are links to file format specs or implementations, with particlar focus on those useful in DCC (Digital Content Creation); CAD (Computer Assisted Design); video/web animation/3d Display formats; game content formats; 2d image formats; and lastly sound formats

The most widely supported CAD formats are DXF, DWG, IGES and STEP

The most widely supported DCC formats are OBJ, LWO, 3DS, Collada

The most widely supported web 3d content formats are Shockwave, VRML, X3D, U3D

The most widely supported image formats are Adobe Photoshop, PNG, JPG, GIF

if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); }

CAD formats













DCC file formats












  • FBX API - there is not a format spec available that I can find only specs for the library/api:





WEB file formats











Motion Capture Formats


http://gl.ict.usc.edu/animWeb/humanoid/fileFormats.html


Image Formats




Vector Image Formats




Scene Description Languages


Lectures on Scene Description languages http://www.cs.utah.edu/classes/cs6620/lecture-2005-01-28-6up.pdf http://www.cs.utah.edu/classes/cs6620/lecture-2005-01-28.pdf

PPM Format Specification http://netpbm.sourceforge.net/doc/ppm.html

Neutral File Format http://www.acm.org/pubs/tog/resources/SPD/NFF.TXT

Polygon File Format http://astronomy.swin.edu.au/%7Epbourke/geomformats/ply/

PLY Tools http://www.cc.gatech.edu/projects/large_models/ply.html

Scene Description languages
RenderMan Interface Specification https://renderman.pixar.com/products/rispec/

Radiance Scene Description language http://radsite.lbl.gov/radiance/refer/Notes/language_BNR.html

Manchester Scene Description language http://astronomy.swin.edu.au/~pbourke/dataformats/msdl/

POVRAY scene description language http://www.lobos.nih.gov/Charmm/Povray3/pov30019.html

YAFRAY scene description language (is there an official version somewhere??) http://download.blender.org/documentation/htmlI/ch30s03.html
Another list of format links (most of the links are broken) http://www.agocg.ac.uk/reports/virtual/36/appendix.htm


Universal translator tools


  • Polytrans - universal 3d format converter - very useful table of what formats are supported by different CAD programs, also explains the strengths and limitations of different formats http://www.okino.com/conv/filefrmt.htm






Misc lists of formats and universal importers/exporters




  • An extremely large list of formats and specs some with sample code

(note that for some of the formats he links there are much more complete specs availabled - ie lightwave lwo) http://astronomy.swin.edu.au/~pbourke/dataformats/


  • Material Exchange Format (a subset of the Advanced Authoring Format):

http://www.ebu.ch/trev_291-devlin.pdf

Useful overview of MEF http://www.digitalpreservation.gov/formats/fdd/fdd000013.shtml

HOOPS Streaming File Format spec - http://www.openhsf.org/specification/index.html

Imagine IOB - code to parse it http://www.pygott.demon.co.uk/prog.htm


Misc stuff



Poser related format data










Cell3D

http://www.3d-node.com/cmsimple-en/?Products%2C_Projects%26nbsp%3Band_Services:Cell3D

Introduction

Interactive 3D-Visualization of various microscopic image stacks.

First version was implemented in pure MS-Visual-c++ and OpenGl. The new version uses the MedWorld3D-VRML/X3D-Core. It supports all the (interactive) features of MedWorld3D and some new components especially for microscopic visualization.

Image import features (additionally to DICOM, ACR-NEMA): JPG, BMP, RAW, TIFF, PNG, JPEG2000, Biorad, Metamorph, Zeiss, Lucia, Nikon, Leica, Autooquant, Imagepro

Preparation features (additionally to MedWorld3D-features): innovative script mechanism for different filters and filter combinations for multiple ROIs.

Postprocessing features (additionally to MedWorld3D-features): 3D-Color-Manipulation, interactive chromatek 3D, object code combination

Interactive anatomical 3d-visualisation powered by X3D/VRML

Interactive 3D Visualization technique represents an important diagnosis and therapy planning tool. It cannot be compensated with simple 2D Pictures or static 3D Views.

Multimedia teaching tools which contain textual information, non-interactive videos and restricted pseudo three-dimensional scenarios can considerably contribute to the understanding of medical facts by the completion of interactive 3D Components. Multiuser environments are also an important aspect to recognize coherence of single events in patients physical health and to support medical teachings.

Until now, these techniques are not applicable every time and everywhere. Insufficient software functionality and quality, competitive and proprietary software and hardware as well as different system requirements for visualization aggravated the distribution of interactive 3D Systems.

So far, there is no common standard for 3D Geometry in medicine, like the Dicom files. These files include medical 2D Images, patient information and acquisition details in a special syntax.

Besides many simple 3D File formats, there are also considerably "more intelligent" specifications, like the XML compliant X3D specification. The new system reduces or eliminates all disadvantages of the regular systems and opens new Potentials.

http://www.3d-node.com/cmsimple-en/?Products%2C_Projects%26nbsp%3Band_Services:MedWorld3D

--------

Features (public Version 1.0.0)
  • 3D-Generator reads and creates 3d data from DICOM, JPG, BMP, RAW
  • VRML97/X3D compliant, tested with viper (vrml) and most known plugins on different OSs (vrml,x3d)
  • Platform-independent, uses a standard Browser Plugin (Best viewed with Cortona,BS-Contact,Freewrl or GLView, because of missing/bad/buggy script-implementation in octagonfree,flux,openvrml,venues,horizon,casa,vrweb - on those browsers only limited features)
  • Works with PocketCortona on Pdas
  • Ergonomic x3d/vrml interface, also for full windowxp-tabletpc use
  • 3D-manipulation functions like 3d-volume/area measuring and 3d-annotations in X3D/VRML. Transformation of 2D markers into 3d space and back. Export to ISO-SVG-Code.
  • Access to the real world via java-servlets
  • Multiprocessing, multimonitor and multiuser realtime experience trough EAI and SAI, limited only by the java-socket-interface and EAI availability (IE)
  • Multiuser database control for the 3d-manipulation system via java-servlets
  • Dicom-source-browsing via java-servlets (on next version also texture mapping)
  • Easy StepIn3D-system for vrml/x3d-beginners (plugin installation, tips, os-control)
  • Anatomical X3D/VRML-data-generation for all greyscale-datasets like CT,MR in dicoms/jpg/bmp-files (volume surface rendering with marching cube), interactive rendering control and annotation support with virtual sound and text enhancement -modular design, pluggable features via the 3d-generator-authoring-tool
  • Export of dicom-tags (patient,physician, institute...) to XML files for integration in X3D-scenes
  • Supports also special devices: X3D/VRML-viewer-software like 4d-vision stereo display software, phantom force-feedback-system, actual-systems holo-viewer (reduced vrml subset)
  • Special stereoscopic support and interface-design on all stereo-enabled devices (nvidia...) with e.g. cortona or glview
  • Hardware support for spaceball and spacemouse over special emulator software for all vrml/x3d viewers (windows only)
  • DirectX-device-support via bs-contact joystick interface and cortona keyboard-interface via plugin-independent joystick-emulator(partially third party, thanks to www.deinmeister.de)
  • Programmable POS-Keyboard support for cortona keyboard-nodes -plugin independent realtime image manipulation in the 2d-gui and 3d-gui(windows only, but next version comes also for linux and mac) -

3D Object Converter The program supports 524 file formats.

http://web.axelero.hu/karpo/

3D Object Converter, a powerful 3d model translation and interactive viewing shareware tool that allows arbitrary 3d model data to be imported from external sources, exported to various industry standard 3d file formats with great accuracy and quality. The program supports 524 file formats. It is available for Windows95/98/Me/NT/2K/2003/XP 32/XP 64/Vista 32/Vista 64.

STL bin asci        In/Out

PLY

OBJ

PRO/Engineer render

Qhull Mathematica

QuickDraw 3D Binary Mesh

VRML 1

VRML 2

X3D

DXF

brainVISA

Brainvoyager

3DS

IGES                       /only Out