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

Robert Ellis Parrott parrott at fas.harvard.edu
Wed Jan 23 16:47:38 EST 2002


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
>
>
>
> -----Original Message-----
> From: vtkusers-request at public.kitware.com
> [mailto:vtkusers-request at public.kitware.com]
> Sent: Wednesday, January 23, 2002 12:01 PM
> To: vtkusers at public.kitware.com
> Subject: vtkusers digest, Vol 1 #772 - 4 msgs
>
>
> Send vtkusers mailing list submissions to
> 	vtkusers at public.kitware.com
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://public.kitware.com/mailman/listinfo/vtkusers
> or, via email, send a message with subject or body 'help' to
> 	vtkusers-request at public.kitware.com
>
> You can reach the person managing the list at
> 	vtkusers-admin at public.kitware.com
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of vtkusers digest..."
>
>
> Today's Topics:
>
>    1. Re: Again, I am doing something wrong. (Mace.cxx) (Nick Edgington)
>    2. splatting a sphere onto a 2D structure/image (stefano mininel)
>    3. wxVTKWindow: controlling events. (stefano mininel)
>    4. Re: Function Plots (Andy F. Miller)
>
> --__--__--
>
> Message: 1
> From: "Nick Edgington" <OutOfTurn at Yahoo.com>
> To: <vtkusers at public.kitware.com>
> Subject: Re: [vtkusers] Again, I am doing something wrong. (Mace.cxx)
> Date: Wed, 23 Jan 2002 10:26:45 -0500
>
> Just a quick comment:
>      when I SetResolution(0) in the examples I posted  this is not
> surprising, but I just thought I would note it.
>
>
>  vtkConeSource *cone = vtkConeSource::New();
>     cone->SetResolution(0);
>
>
> void vtkGlyph3D::Execute()
> {
>
>
> ........
> numSourcePts = sourcePts->GetNumberOfPoints();  <<<==== Crashes
> .......
> }
>
>
> ----- Original Message -----
> From: "Berk Geveci" <berkgeveci at hotmail.com>
> To: <OutOfTurn at Yahoo.com>; <vtkusers at public.kitware.com>
> Sent: Tuesday, January 22, 2002 10:06 AM
> Subject: Re: [vtkusers] Again, I am doing something wrong. (Mace.cxx)
>
>
> > Here is what happens: you get the input of the glyph
> > filter and add a scalars array to it. This input is
> > also the output of another source (in this case, a
> > sphere source, as far as I can see). When the pipeline
> > executes, sphere source initializes it's output before
> > generating data and pufff your scalars are gone.
> > Whatever you do, sphere source will initialize it's
> > output everytime it runs. The simplest solution is this:
> >
> > Create a sphere source
> > Update it
> > Get it's output and severe it from the source
> > (with SetOutput(NULL);)
> > Add your scalars
> >
> > There other ways of doing this (some of which allow you
> > to keep the source in the pipeline), if you want more hints,
> > let me know.
> >
> > -Berk
> >
> >
> > >From: "Nick Edgington" <OutOfTurn at Yahoo.com>
> > >To: <vtkusers at public.kitware.com>
> > >Subject: [vtkusers] Again, I am doing something wrong. (Mace.cxx)
> > >Date: Tue, 22 Jan 2002 09:05:45 -0500
> > >
> > >     I am using Vtk40 under winnt.
> > >
> > >     I attach a scalar to a vtkGlyph3D
> > >
> > >
> > >main(){
> > >...........................
> > >      scalars = vtkFloatArray::New();
> > >
> > >
> > >       scalars->InsertTuple1(0, .5);
> > >       scalars->InsertTuple1(1, .5);
> > >       scalars->InsertTuple1(2, 1);
> > >       scalars->InsertTuple1(3, 0);
> > >       scalars->InsertTuple1(4, 1);
> > >       scalars->InsertTuple1(5, 0);
> > >
> > >         ............
> > >        vtkDataSet *input = glyph->GetInput();
> > >       vtkPointData * pd = input->GetPointData();
> > >       pd->SetScalars(scalars);
> > >}
> > >
> > >When I trace through
> > >
> > >void vtkGlyph3D::Execute()
> > >{
> > >
> > >         ...........
> > >
> > >         pd->GetScalars();      <<<<<===  returns NULL
> > >                                           <<<<< === because
> > >this->GetAttribute(SCALARS); returns -1
> > >                                           <<<<<===  even thought it
> was
> > >originally set to 0 by the pd->SetScalars(scalars);
> > >
> > >I can force it to work by changing the flag myself.
> > >
> > >                     Thanks in advance
> > >                             Nick Edgington
> > >
> > >
> > >
> > >_________________________________________________________
> > >Do You Yahoo!?
> > >Get your free @yahoo.com address at http://mail.yahoo.com
> > >
> > >_______________________________________________
> > >This is the private VTK discussion list.
> > >Please keep messages on-topic. Check the FAQ at:
> > ><http://public.kitware.com/cgi-bin/vtkfaq>
> > >Follow this link to subscribe/unsubscribe:
> > >http://public.kitware.com/mailman/listinfo/vtkusers
> >
> >
> >
> > _________________________________________________________________
> > Join the world's largest e-mail service with MSN Hotmail.
> > http://www.hotmail.com
> >
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at:
> <http://public.kitware.com/cgi-bin/vtkfaq>
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/vtkusers
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> --__--__--
>
> Message: 2
> Date: Wed, 23 Jan 2002 16:34:51 +0100
> From: stefano mininel <mininel.ml at gnbts.univ.trieste.it>
> To: vtkusers at public.kitware.com
> Subject: [vtkusers] splatting a sphere onto a 2D structure/image
>
> Sorry, it's probably something asked already, but right now I'm stuck
> and I need a helpful input/tip.
> I want to probe electrical potential values upon a sphere and save
> sphere surface as a 2D structure (image, structured points ...) like in
> a 2D world map (with poles deformed).
> My code
> "
>   vtkSphereSource *pSferaScalpoSource = vtkSphereSource::New();
>     pSferaScalpoSource->SetRadius(8.5);
>     pSferaScalpoSource->SetThetaResolution(180);
>     pSferaScalpoSource->SetPhiResolution(179);
>     pSferaScalpoSource->SetStartPhi(1);
>     pSferaScalpoSource->SetEndPhi(179);
>
>   vtk ProbeFilter *pSferaScalpoProbe = vtkProbeFilter::New();
>     pSferaScalpoProbe->SetInput(pSferaScalpoSource->GetOutput());
>     pSferaScalpoProbe->SetSource(pPotGrid);       // (pPotGrid:
> vtkUnstructuredGrid holding the potential values)
> "
> works well for the probing but ... now? I feel lost in a maze of vtk
> filters!!
> Vtk used is 3.1.2. Compiler is VC++.
> Any help or tip appreciated! Thanks in advance.
>
>     Stefano Mininel
>
>
> --__--__--
>
> Message: 3
> Date: Wed, 23 Jan 2002 16:52:15 +0100
> From: stefano mininel <mininel.ml at gnbts.univ.trieste.it>
> To: vtkusers at public.kitware.com
> Subject: [vtkusers] wxVTKWindow: controlling events.
>
> Stereo rendering with 2+ renderers in one window doesn't work correctly.
> A solution is to remove temporarily all renderers except the one to be
> put in 3D, and adding them again to the window when switching back into
> 2D. In my wxWindows/vtk application  my 2D/3D switch customized this way
> works correctly.
>
> The problem is: when "3" key is pressed this event calls the "regular"
> vtk 2D/3D switch and vtkWindow goes into a buggy stereo rendering.
>
> I tried to prevent further event processing by adding
> " if (event.GetKeyCode == 33) return; " in
> wxVTKWindow::OnKeyDown,
> wxVTKWindow::OnKeyUp,
> wxVTKWindow::OnChar
> (trying all possible combinations!) but it seems I can't prevent vtk
> from receiving the "3 key" event.
> Any idea from one of the wxWindows/vtk users?
> Thanks in advance for any help.
>
>     Stefano Mininel
>
>
> --__--__--
>
> Message: 4
> From: "Andy F. Miller" <aamiller at alumni.princeton.edu>
> To: "Vtkusers at Public. Kitware. Com (E-mail)"
> <vtkusers at public.kitware.com>
> Subject: Re: [vtkusers] Function Plots
> Date: Wed, 23 Jan 2002 08:33:51 -0800
>
> This is a multi-part message in MIME format.
>
> ------=_NextPart_000_0030_01C1A3E8.AFB6D6A0
> Content-Type: text/plain;
> 	charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
> If you don't mind a standalone program (i.e. not integrated with VTK), =
> GNUPLOT (http://www.gnuplot.vt.edu/) is very easy to use.
>
> Andy
>   ----- Original Message -----=20
>   From: Christopher R. Volpe=20
>   To: Vtkusers at Public. Kitware. Com (E-mail)=20
>   Sent: Tuesday, January 22, 2002 8:46 PM
>   Subject: [vtkusers] Function Plots
>
>
>   Is anyone using vtk to produce simple 2D function plots? I'm in need =
> of
>   doing some simple plotting, and if I can do it in vtk without a lot of
>   wheel-reinventing, that would be great. (Conversely, if people have =
> looked
>   into this and decided that vtk is the wrong tool and found something =
> better,
>   I'd be interested to hear about it. Preferably something quick and =
> dirty,
>   not something expensive with a learning curve such as Matlab or
>   Mathematica.) Thanks in advance.
>
>   -Chris
>
>
>
> ------=_NextPart_000_0030_01C1A3E8.AFB6D6A0
> Content-Type: text/html;
> 	charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META http-equiv=3DContent-Type content=3D"text/html; =
> charset=3Diso-8859-1">
> <META content=3D"MSHTML 6.00.2712.300" name=3DGENERATOR>
> <STYLE></STYLE>
> </HEAD>
> <BODY bgColor=3D#ffffff>
> <DIV><FONT face=3DArial size=3D2>If you don't mind a standalone program
> =
> (i.e. not=20
> integrated with VTK), GNUPLOT (<A=20
> href=3D"http://www.gnuplot.vt.edu/">http://www.gnuplot.vt.edu/</A>) is =
> very easy=20
> to use.</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3DArial size=3D2>Andy</FONT></DIV>
> <BLOCKQUOTE=20
> style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
> BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
>   <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
>   <DIV=20
>   style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
> black"><B>From:</B>=20
>   <A title=3Dcvolpe2 at nycap.rr.com =
> href=3D"mailto:cvolpe2 at nycap.rr.com">Christopher=20
>   R. Volpe</A> </DIV>
>   <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
> title=3Dvtkusers at public.kitware.com=20
>   href=3D"mailto:Vtkusers at Public. Kitware. Com =
> (E-mail)">Vtkusers at Public. Kitware.=20
>   Com (E-mail)</A> </DIV>
>   <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Tuesday, January 22, 2002
> =
> 8:46=20
>   PM</DIV>
>   <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> [vtkusers] Function =
> Plots</DIV>
>   <DIV><BR></DIV>Is anyone using vtk to produce simple 2D function =
> plots? I'm in=20
>   need of<BR>doing some simple plotting, and if I can do it in vtk =
> without a lot=20
>   of<BR>wheel-reinventing, that would be great. (Conversely, if people =
> have=20
>   looked<BR>into this and decided that vtk is the wrong tool and found =
> something=20
>   better,<BR>I'd be interested to hear about it. Preferably something =
> quick and=20
>   dirty,<BR>not something expensive with a learning curve such as Matlab
> =
>
>   or<BR>Mathematica.) Thanks in=20
> advance.<BR><BR>-Chris<BR><BR></BLOCKQUOTE></BODY></HTML>
>
> ------=_NextPart_000_0030_01C1A3E8.AFB6D6A0--
>
>
>
> --__--__--
>
> _______________________________________________
> vtkusers mailing list
> vtkusers at public.kitware.com
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
> End of vtkusers Digest
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>




More information about the vtkusers mailing list