• Non ci sono risultati.

Compitino  2    Scrivere  un  applicazione  “clustering”  command  line  che,  presa  in  ingresso  una   mesh  in  formato  .

N/A
N/A
Protected

Academic year: 2021

Condividi "Compitino  2    Scrivere  un  applicazione  “clustering”  command  line  che,  presa  in  ingresso  una   mesh  in  formato  ."

Copied!
1
0
0

Testo completo

(1)

Compitino  2    

Scrivere  un  applicazione  “clustering”  command  line  che,  presa  in  ingresso  una   mesh  in  formato  .off    e  alcuni  parametri,  ne  effettui  la  semplificazione  tramite  un   algoritmo  di  clustering.    

Più  precisamente,  gli  argomenti  dell’applicazione  saranno:  

Usage: clustering <filename> <cell_size> <clustering-options>

Where:

- <filename> is the name of the file to be simplifed

- <cell_size> is a floating point value in the range [0..1] that express the size of the clustering cell size indicated as a fraction of the diagonal of the bounding box of the object. E.g. 0.01 is a good default value. It means that the clustering cell should be 1/100 of the diagonal of the bbox.

- <clustering_options> various flags that you can optionally define to tweak the behaviour of the clustering algorithm (e.g. quadric vs medium, quadric weights).

Per  calcolare  il  rappresentativo  di  ogni  cella  avete  due  possibilità:  

Punto  medio  

 Il  rappresentativo  è  la  media  di  tutti  i  vertici  che  cadono  dentro  la  cella.  

Eventualmente  può  essere  sensato  calcolare  una  media  pesata  rispetto  all’area   dei  triangoli  cui  ogni  vertice  appartiene.  

Quadric  Minimum  

Per  ogni  cella  c  si  calcola  la  quadrica  che  rappresenta  la  somma  delle  distanze  al   quadrato  di  tutte  le  facce  che  hanno  un  vertice  dentro  la  cella  c  .  Alla  fine  si   sceglie  come  rappresentativo  il  punto  che  minimizza  questa  somma  di  distanze.  

Vedi  vcg/math/quadric.h  per  un’implementazione  dell’oggetto  quadrica.  Si   consiglia  di  fare  attenzione  ai  casi  in  cui  il  punto  che  minimizza  una  quadrica  sia   mal  definito  o  fuori  dalla  cella  stessa.  In  questi  casi  ci  sono  varie  possibilità     Per  mantenere  la  struttura  dati  delle  celle  si  consiglia  una  hashed  grid,  cioè  un   unordered  set  di  Quadric,  o  di  altre  strutture,  cui  accedo  usando  come  chiave  un   Point3i:  

std::unordered_set<Point3i,MyPerCellInfo>  grid;  

Per  trovare  facilmente  le  coordinate  intere  di  una  cella  a  partire  da  un  Point3f   potete  guardare  nelle  classi  accessorie  definite  in  vcg/space/index/grid_util.h   Al  solito,  ricordate  che  uno  dei  miei  mantra  è  “meno  codice  scrivete,  meglio  è”,   (ovviamente  al  netto  dei  commenti).    

Buon  lavoro.  

   

Riferimenti

Documenti correlati

In particular, the latter contains a more rigorous definition of elliptic and hyperbolic solutions and gives a good presentation of old and new results concerning existence,

Some have raised concerns over the internationalization of the financial markets, where the currency markets alone trade about $1 trillion a day, leaving governments

We describe here in more details the stability based technique based on the pre- diction strength method (developed by Tibshirani et al [Tibshirani et al., 2005]) to estimate the

Theorem 6. However, neither those algorithms nor their analyses transfer directly to the pseudo-concave setting. This is because, by exploiting the pseudo-linearity of the

[r]

&lt;85&gt; 26-27 dagli elementi in nostro possesso risulta probabile che il copista di L abbia voluto inserire, in maniera indipendente, questa glossa in quanto

We investigate publications trough their citation histories – the his- tory events are the citations given to the article by younger publications and the time of the event is the

In De l’esprit des lois Montesquieu shows that a multitude of variables in a society, including the laws, commerce, and religion, interact with one another to