Menu

Why use triangle in surf , not quadrilateral

Help
lotus
2006-09-04
2013-04-22
  • lotus

    lotus - 2006-09-04

    I had seen surf.m code and found than surf.m used tri_surf.m. tri_surf used triangle for draw surface.

    But if surf.m use quadrilateral for plot surface( ex. if exist quad_surf.m), the number of polygon reduces to half. I think this can reduce the time for plot.

    Is there any reason for using triangle for plot surface?

     
    • Dragan Tubic

      Dragan Tubic - 2006-09-05

      > Is there any reason for using triangle for plot surface?

      No, except that it was easier that way. If you know how to do it please feel free to implement the function with quads, I'll be happy to include it in octaviz.

      Cheers,

      Dragan

       
    • lotus

      lotus - 2006-09-07

      Sorry, actually I do not use octave.

      My platform is c# on winXP and vtk 5.0.
      So I can not fully implement it with octave.
      But each binding of vtk is very similar, I can give some clue to quad_mesh.m

      The method is really simple.

      ----- in surf.m -------------------
      octaviz make triangle like

      t=[i*n+j,(i+1)*n+j,(i+1)*n+(j+1) ; (i+1)*n+(j+1),i*n+(j+1),i*n+j];
      upper triangles; lower triangles

      you can make quad like this
      quad = [i*n+j,(i+1)*n+j,(i+1)*n+(j+1),  i*n+j+1];

      ------ in quad_surf.m -------------
      finally, change number 3 to 4 at the dimention check routines etc..
      and

      no_quad = size(quad,1);
      t = [ones(no_quad,1)*4 t-1]';

      this can make quad surf easily.

      I tested it with c# binding of vtk, and I used vtk 5.0

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.