[vtkusers] Consistent orientation of cells

Goodwin Lawlor goodwin.lawlor at ucd.ie
Fri Apr 2 14:36:12 EST 2004


Hi Shyram,
I get the same picture as you if I use vtkCleanPolyData before using
vtkPolyDataNormals (and a slightly better one if I don't). The problems
is with the aspect ratio of the triangles on top and on one side. Use
vtkDecimate before vtkPolyDataNormals... In particular play with the
SetAspectRatio method... Set it to something like 2.0 or 3.0 and see how
you get on.

Hth

Goodwin

-----Original Message-----
From: R K Shyam Prakash [mailto:ramakrishna.prakash at quest-global.com] 
Sent: 02 April 2004 11:46
To: goodwin.lawlor at ucd.ie
Cc: VTKUserList
Subject: RE: [vtkusers] Consistent orientation of cells


Hello Goodwin,
			Thanks for the reply. I tried your suggestion
but it is not working. I have attached two file.

1. sample.vtk, a 3d file in vtk format. This model shows the problem I
was talking about. 2. normal.jpeg , this pictureshow the problem. The
area marken in red has the triangles with normal orientation.

Any ideas?

Thanks
Shyam

> -----Original Message-----
> From: Goodwin Lawlor [mailto:goodwin.lawlor at ucd.ie]
> Sent: Thursday, April 01, 2004 8:35 PM
> To: vtkusers at vtk.org
> Cc: ramakrishna.prakash at quest-global.com
> Subject: Re: [vtkusers] Consistent orientation of cells
> 
> 
> Use vtkPolyDataNormals with the method ConsistencyOn. You
> might want SplittingOff too.
> 
> Hth
> Goodwin
> 
> -----Original Message-----
> From: vtkusers-admin at vtk.org [mailto:vtkusers-admin at vtk.org]
> On Behalf Of vtkusers-request at vtk.org
> Sent: 01 April 2004 12:26
> To: vtkusers at vtk.org
> Subject: vtkusers digest, Vol 1 #2528 - 2 msgs
> 
> 
> Send vtkusers mailing list submissions to
> 	vtkusers at vtk.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://www.vtk.org/mailman/listinfo/vtkusers
> or, via email, send a message with subject or body 'help' to
> 	vtkusers-request at vtk.org
> 
> You can reach the person managing the list at
> 	vtkusers-admin at vtk.org
> 
> When replying, please edit your Subject line so it is more
> specific than
> "Re: Contents of vtkusers digest..."
> 
> 
> Today's Topics:
> 
>    1. Consistent orientation of cells (R K Shyam Prakash)
>    2. Import image from ARToolKit (Francesco Caruso)
> 
> --__--__--
> 
> Message: 1
> From: "R K Shyam Prakash" <ramakrishna.prakash at quest-global.com>
> To: "VTKUserList" <vtkusers at www.vtk.org>
> Date: Thu, 1 Apr 2004 16:24:39 +0530
> Subject: [vtkusers] Consistent orientation of cells
> 
> This is a multi-part message in MIME format.
> 
> ------=_NextPart_000_0018_01C41805.D4B94030
> Content-Type: text/plain;
> 	charset="us-ascii"
> Content-Transfer-Encoding: 7bit
> 
> Hi,
>         I have closed polydata surface representated by
> triangles. In few casesThe normals of the triangles are not 
> consistent. some of the triangles have normls oriented 
> towards outside of the surface. Is there a method which will 
> ensure that all triangle normals are pointed inside of the polydata?
>  
> Thanks
> Shyam
>  
> Disclaimer:
> 
> This electronic message and all attachments contain
> information from QuEST, which may be confidential or 
> otherwise protected from disclosure. The information is 
> intended for the addressee only. If you are not the 
> addressee, any disclosure, copy, distribution or use of the 
> contents of this message is prohibited. If you have received 
> this electronic message in error, please notify the sender 
> immediately and destroy the message.
> 
>  
> 
> ------=_NextPart_000_0018_01C41805.D4B94030
> Content-Type: text/html;
> 	charset="us-ascii"
> Content-Transfer-Encoding: quoted-printable
> 
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
> Transitional//EN"> <HTML><HEAD> <META 
> HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = 
> charset=3Dus-ascii"> <TITLE>Message</TITLE>
> 
> <META content=3D"MSHTML 6.00.2716.2200"
> name=3DGENERATOR></HEAD> <BODY> <DIV><SPAN 
> class=3D179075210-01042004><FONT face=3DArial=20 
> size=3D2>Hi,</FONT></SPAN></DIV> <DIV><SPAN = 
> class=3D179075210-01042004>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
> ;&nbsp;=20
> <FONT face=3DArial size=3D2>I have&nbsp;closed polydata 
> surface = representated by=20 triangles. In few casesThe 
> normals of the triangles are not consistent. = some of=20 the 
> triangles have normls oriented towards outside of the 
> surface. Is = there a=20 method which will ensure that all 
> triangle normals are pointed inside of = the=20 
> polydata?</FONT></SPAN></DIV> <DIV><SPAN 
> class=3D179075210-01042004><FONT face=3DArial=20 
> size=3D2></FONT></SPAN>&nbsp;</DIV>
> <DIV><SPAN class=3D179075210-01042004><FONT face=3DArial=20 
> size=3D2>Thanks</FONT></SPAN></DIV>
> <DIV><SPAN class=3D179075210-01042004><FONT face=3DArial=20 
> size=3D2>Shyam</FONT></SPAN></DIV>
> <DIV>&nbsp;</DIV>
> <DIV align=3Dleft><FONT color=3D#333399 size=3D3>
> <P><U>Disclaimer: </U></P>
> <P><U>This electronic message and all attachments contain 
> information = from=20 QuEST, which may be confidential or 
> otherwise protected from disclosure. = The=20 information is 
> intended for the addressee only. If you are not the = 
> addressee,=20 any disclosure, copy, distribution or use of 
> the contents of this = message is=20 prohibited. If you have 
> received this electronic message in error, = please notify=20 
> the sender immediately and destroy the 
> message.</U></P></FONT></DIV> <DIV>&nbsp;</DIV></BODY></HTML>
> 
> ------=_NextPart_000_0018_01C41805.D4B94030--
> 
> 
> --__--__--
> 
> Message: 2
> Date: Thu, 01 Apr 2004 12:55:30 +0200
> From: Francesco Caruso <guernika_devel at yahoo.it>
> To: vtkusers at vtk.org
> Subject: [vtkusers] Import image from ARToolKit
> 
> Hello,
> 
> i can't display image grabbed by ARToolKit...
> 
> ARToolKit grab image and store it in a vector of unsigned
> char "dataPtr". i tried to import and show it  but the 
> routine crashes due to an error 
> of access violation.
> i think my mistake is how to pass the dataPtr to vtkImageImport...
> 
> please, help!
> 
> here are the sources...
> 
> static void vtkInit( void )
> {
>     renWin        =    vtkRenderWindow::New();
>     ren              =    vtkRenderer::New();
>     importer      =    vtkImageImport::New();
>     imActor       =    vtkOpenGLImageActor::New();
> 
>     importer->SetWholeExtent(0, 319, 0, 239, 0,0);     // 320x240
> image...
>     importer->SetDataExtentToWholeExtent();
>     importer->SetNumberOfScalarComponents( 4 );     // 4 for R G B A
> ....
>     importer->SetDataSpacing(1,1,1);
>     importer->SetDataScalarTypeToUnsignedChar();
>     imActor->SetInput( importer->GetOutput() );
>     imActor->SetDisplayExtent(0, 319, 0, 239, 0, 0);
>     renWin->SetSize(640,480);
>     renWin->AddRenderer( ren );
>     ren->AddActor2D( imActor );
> }
> 
> static void artkInit( void )
> {
>     ARParam  wparam;
> 
>     /* open the video path */
>     if( arVideoOpen( vconf ) < 0 ) exit(0);
>     /* find the size of the window */
>     if( arVideoInqSize(&xsize, &ysize) < 0 ) exit(0);
>     printf("Image size (x,y) = (%d,%d)\n", xsize, ysize);
> 
>     /* set the initial camera parameters */
>     if( arParamLoad(cparam_name, 1, &wparam) < 0 ) {
>         printf("Camera parameter load error !!\n");
>         exit(0);
>     }
>     arParamChangeSize( &wparam, xsize, ysize, &cparam );
>     arInitCparam( &cparam );
>     printf("*** Camera Parameter ***\n");
>     arParamDisp( &cparam );
> 
>     if( (patt_id=arLoadPatt(patt_name)) < 0 ) {
>         printf("pattern load error !!\n");
>         exit(0);
>     }
> 
>      //argInit( &cparam, 2.0, 0, 0, 0, 0 );
>     arVideoCapStart();
> }
> 
> static void vtk2artkLoop(void)
> 
> {
>     ARUint8         *dataPtr;  // ARTK store the image 
> grabbed in this
> vector of unsigned char !!!
> 
>     /* grab a vide frame */
>     if( (dataPtr = (ARUint8 *)arVideoGetImage()) == NULL ) {
>         arUtilSleep(2);
>         return;
>     }
> 
>     importer->SetImportVoidPointer((void * ) dataPtr, 1);   
> // I think
> my mistake is HERE !!! 
>     renWin->Render();
>     arVideoCapNext();
> 
>     argSwapBuffers();
> }
> 
> void CleanUp()
> {
>   importer->Delete();
>   imActor->Delete();
>   ren->Delete();
>   renWin->Delete();
>   arVideoCapStop();
>   arVideoClose();
>   argCleanup();
> }
> 
> void main( int argc, char *argv[] )
> {
>     vtkInit();
>     artkInit();
>     for ( i=0; i<20; i++)
>         vtk2artkLoop();
>     CleanUp();
> }
> 
> 
> 
> 
> --__--__--
> 
> _______________________________________________
> vtkusers mailing list
> vtkusers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtkusers
> 
> 
> End of vtkusers Digest
> 




More information about the vtkusers mailing list