[vtk-developers] vtkCell::IntersectWithLine issues

Kaushik . shekhar.kaushik at gmail.com
Wed Jul 2 06:03:45 EDT 2008


On Wed, Jul 2, 2008 at 3:01 PM, Will Schroeder <will.schroeder at kitware.com>
wrote:

> "From these faces I choose the one that is nearer to the
> end point of the ray and the next cell to search is the cell adjacent to
> the chosen face."
>
> What does it mean to have a face nearer to an end point? How are you
> determining this? This is not as straight frward as it sounds and could be
> an issue.


I find the intersection point of each face with the line segment (
representing the viewing ray in world coordinates ).
>From those faces that intersect the line , i choose the one whose
intersection point is closest to the farther point of the
viewing ray. And I need only those cells that intersect the viewing ray .
Only these cell will contribute to the color value
at the corresponding pixel.

I find some peculiar outputs from the intersection calculations. When I find
the intersections with the faces of a cell, I get
cases where the line intersects only one face. This does not make sense as I
have confirmed the ray for sure does not end within the cell

Upon looking into the code (vtkQuad.cxx) , I found that the intersection is
done by splitting the quad along one of the
diagonal into two triangles. What happens when the line passes exactly
through the diagonal of the quad ? Does the
triangle intersection handle this ?

shekhar


>
> W
>
> 2008/7/1 Kaushik . <shekhar.kaushik at gmail.com>:
>
>>  Hi
>>
>> I am trying to implement the following algorithm and I am stuck. I need to
>> cast rays
>> from each pixel into a dataset. Along each ray , I need to find the first
>> cell that satisfies
>> some characteristics. I go about implementing it as follows :
>> Using the vtkCellLocator::IntersectWithLine() , i find the first cell the
>> ray intersects in the dataset.
>> If this cell satisfies the conditions , we exit.
>> else we continue searching cells along the ray until one such cell is
>> found , or until we eventually reach
>> the boundary of the dataset.
>> Now this searching cell along a ray is causing me trouble. Given the first
>> cell that the ray intersected,
>> I find the faces of the cell that the ray intersects. From these faces I
>> choose the one that is nearer to the
>> end point of the ray and the next cell to search is the cell adjacent to
>> the chosen face.
>> The algorithm seems to be correct logically atleast.
>>
>> The vtkCell::IntersectWithLine() functions however seem to be giving
>> inconsistent results ! Are there
>> any known issues with these functions ? Please advise.
>>
>> Also can you please comment on the algorithm above ? Is there any other
>> way( better ? ) to do the same ?
>>
>> --
>> shekhar
>> _______________________________________________
>> vtk-developers mailing list
>> vtk-developers at vtk.org
>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>
>>
>
>
> --
> William J. Schroeder, PhD
> Kitware, Inc.
> 28 Corporate Drive
> Clifton Park, NY 12065
> will.schroeder at kitware.com
> http://www.kitware.com
> 518-371-3971 (phone and fax)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20080702/b74144db/attachment.html>


More information about the vtk-developers mailing list