Re: [ROOT] Point inside a TPolyLine

From: Olivier Couet (Olivier.Couet@cern.ch)
Date: Mon Jun 30 2003 - 16:19:57 MEST


Hi,


You can use the method IsInside in TMath

   // IsInside
   static Bool_t IsInside(Double_t xp, Double_t yp, Int_t np, Double_t *x, Double_t *y);
   static Bool_t IsInside(Float_t xp, Float_t yp, Int_t np, Float_t *x, Float_t *y);
   static Bool_t IsInside(Int_t xp, Int_t yp, Int_t np, Int_t *x, Int_t *y);

(xp, yp) is the point you would like to know if it is inside the 
polygon defined by (np, x, y) where np is the number of vertexes building 
the polygon, and x and y two vectors of dimension np containing the 
polygon vertexes.

 Cheers,        Olivier

On Fri, 27 Jun 2003, Ian Gable wrote:

> Hi All,
> 
> Given a TPolyLine I would like to determine if a point is contained in 
> the polyline. In other words, is the point inside the area filled when 
> TPolyLine::Draw("f") is called.
> 
> I was wondering if there was an easy way to do this with Root? 
> Presumably the code exists for this because it's already possible to 
> fill a TPolyLine. I would be grateful for any help.
> 
> I'm using ROOT 3.05/05 on RH 7.3
> 
> Thanks,
> 
> Ian Gable
> 

-- 
Org:    CERN - European Laboratory for Particle Physics.
Mail:   1211 Geneve 23 - Switzerland                     Mailbox: J25910      
E-Mail: Olivier.Couet@cern.ch                            Phone:   +41 22 7676522
WWW:    http://cern.ch/Olivier.Couet/                    Fax:     +41 22 7677155



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET