[vtkusers] How to get the visible face?

David.Pont at ForestResearch.co.nz David.Pont at ForestResearch.co.nz
Sun Apr 25 17:19:18 EDT 2004


Hi Larry,

1:  you can use an instance of vtkPolygon to calculate a normal
      float cNormal[3];
      vtkPoints *pts = cell->GetPoints();
      vtkPolygon::ComputeNormal( pts, cNormal );
To tidy cell:point ordering pass the polydata through vtkPolyDataNormals
with ConsistencyOn, which will: "... reorder polygons to insure consistent
orientation across polygon neighbors."

2:  I have no experience with vtk from Java. Note that
vtkCell::IntersectWithLine is virtual and is implemented in descendants
such as vtkTriangle.

    Dave P.



|---------+---------------------------->
|         |           "Larry"          |
|         |           <larry74 at 163.com>|
|         |                            |
|         |           23/04/2004 20:54 |
|         |                            |
|---------+---------------------------->
  >--------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                                |
  |       To:       <David.Pont at ForestResearch.co.nz>                                                                              |
  |       cc:       <vtkusers at vtk.org>                                                                                             |
  |       Subject:  Re: [vtkusers] How to get the visible face?                                                                    |
  >--------------------------------------------------------------------------------------------------------------------------------|




Hello, Dave,

Thank you very much for your reply, it's very helpful!

But I am still not very clear how to do it, I am new to this.

1.How to do caculate the normal?
suppose the cell has 3 points, p0,p1,p2
the normal could be caculated as n=(p1-p0)X(p2-p0).
but the 3 points maybe in any order, so the normal vector could point to
any
direction(to inside or outside to the 3d object). Then the dot product with
camera vector(cameraPoint - p0) could be - or +.

ps., those triangles face of 3d object is generated by vtk, after cut by
planes.

2. vtkCell::IntersectWithLine
I am using vtk4.2 with Java wrapper, I can not see this method. But I can
find it in the html document of vtk4.0, is that meant that the latest
version doesn't support this method.

And again thanks for your kind help!

Best Regards,
Larry

----- Original Message -----
From: <David.Pont at ForestResearch.co.nz>
To: "Larry" <larry74 at 163.com>
Cc: <vtkusers at vtk.org>
Sent: Thursday, April 22, 2004 11:31 PM
Subject: Re: [vtkusers] How to get the visible face?


>
> Hi Larry,
>    you could traverse all cells, get or calculate a cell normal and use
dot
> product with camera vector. To handle occlusion would be more tricky...
>   Dave P
>
>
> |---------+---------------------------->
> |         |           "Larry"          |
> |         |           <larry74 at 163.com>|
|
> |         |           vtkusers-admin at vt|
> |         |           k.org            |
> |         |                            |
> |         |                            |
> |         |           23/04/2004 02:10 |
> |         |                            |
> |---------+---------------------------->
>
>---------------------------------------------------------------------------

-----------------------------------------------------|
>   |
|
>   |       To:       <vtkusers at vtk.org>
|
>   |       cc:
|
>   |       Subject:  [vtkusers] How to get the visible face?
|
>
>---------------------------------------------------------------------------

-----------------------------------------------------|
>
>
>
>
> Hello, everyone!
> Suppose I have a polydata, which is consisted of triangles, I'd like to
get
> the faces which can be seen by the camera.
> That's to say, there is a point M, and an object whose faces is a set of
> triangles, How can I get the faces that can be seen by the point M? and
how
> can I get the faces that is not seen by the point M?
>
> Thanks!
> Larry
> _
>
>
>
>
>



_







More information about the vtkusers mailing list