[vtkusers] Intersection point of a line with a Surface (vtkPolyData)

Chiang, Wen-Hsing wchiang at sspa.com
Wed Jan 23 17:08:11 EST 2002


Rob,
Thanks! But my surface is not a plane. It could be an instance of
vtkUnstructuredGrid or vtkStructuredGrid. 

I think, I might need to use 

vtkCellLocator->SetInput(myUnstructuredGrid)
vtkCellLocator->IntersectWithLine(....)

But the description of IntersectWithLine is not very clear to me. 


Wen-Hsing Chiang
http://www.sspa.com



-----Original Message-----
From: Robert Ellis Parrott [mailto:parrott at fas.harvard.edu]
Sent: Wednesday, January 23, 2002 4:48 PM
To: Chiang, Wen-Hsing
Cc: vtkusers at public.kitware.com
Subject: Re: [vtkusers] Intersection point of a line with a Surface
(vtkPolyData)



Find equation for the plane, ax + by + cz = d, and solve with equation
x=x0, y=y0, or z = d/c + a x0 /c  + b y0 /c.

To find equation of plane from normal, it's perpendicular to normal, so
( assuming plane goes through origin; shift otherwise) then
(nx, ny, nz) dot (x,y,z) = 0. If shoft is along z-axis for example, then
(nx,ny,nz) dot (x,y,z-k) = 0, so a = nx, b = ny, c = nz, and d = nz*k.

or similar derivation. In all cases a,b,c are proportaional to normal
components.


rob

----------------------------
Robert E. Parrott
Department of Physics
429 Lyman Laboratory
Harvard University
Cambridge, Massachusetts 02138
(617)-496-4013
parrott at fas.harvard.edu
Robert.E.Parrott.96 at alum.dartmouth.org (permanent)


On Wed, 23 Jan 2002, Chiang, Wen-Hsing wrote:

> Hi,
> I think the following question could be very trivial, but I could not
> find a solution.
>
> Given a surface (an instance of vtkPolyData) and a spatially vertical
> line [(x,y,-1E20)--(x, y, 1E20)], how can one calculate the
z-coordinate
> of the intersection point of the line and the surface?
>
>
> Wen-Hsing Chiang
> http://www.sspa.com
>
>
>



More information about the vtkusers mailing list