Randy & M. I'm sightly embarrassed - the light finally came on. Thanks to both of you for your replies. I guess was hoping someone had created a routine that I could pass in an arbitrary path along with my single point and I would get back a simple in or out. Looks like I will actually have to create something that looks at each segment of the path by segment type (h,v,l,c, etc.) and see if my vector intersects.
Thanks again, Jeff E. --- In [email protected], "Randy George" <[EMAIL PROTECTED]> wrote: > > Hi, > > Sorry in advance if I'm misunderstanding the problem. Svg paths can > often be made into closed paths by making sure to add the 1st vertex to the > end. > > From an algorithm point of view there are lots of sites that have > information. Here is a discussion chosen at random from a google search: > http://www.acm.org/pubs/tog/editors/erich/ptinpoly/ > > The basic idea (after closing the path) is to draw a ray from the point in > question to infinity(or just very large relative to the path space) and then > count the number of times the line intersects a segment of the closed path. > If the count is odd the point is inside if even not. > > Although, you might be inside a hole (Moveto) which could be > considered inside an outer ring, but outside the inner ring and thus outside > the multi ring. If a closed path is self intersecting life is equally > complicated, so that self-intersection is generally defined away by > preconditioning into multiple paths. .. and we haven't even brought up > correct intersection of cubic Bezier curve segments. > > Here is the classic Java api for geometric calcs: > http://www.vividsolutions.com/jts/jtshome.htm - LPGL > > Randy > > <?xml version="1.0" standalone="no"?> > <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN" > "http://www.w3.org/TR/SVG/DTD/svg10.dtd" > > <svg > xmlns:xlink="http://www.w3.org/1999/xlink" > xmlns="http://www.w3.org/2000/svg" > width="600" height="600" > preserveAspectRatio="xMinYMin" > viewBox="5.317441 -30.263707 7.082269240963304 28.294216539175043" > > > <path style="fill:white;stroke:black;stroke-width:0.1" > d="M11.3315706,-9.81481061 L12.39971036,-9.76838859 L11.70309752,-7.77224211 > L10.26343073,-8.93279238 L11.37801148,-8.93279238 L7.61630154,-10.46471881 > L9.10240909,-11.253893 L9.79902205,-10.04692071 L10.58851676,-13.29646157 > L12.02818356,-12.55370933 L10.77428016,-11.71811312 > L11.65665664,-11.30031502 L11.19224796,-10.46471881 L11.3315706,-9.81481061 > "/> > <line style="stroke:red;stroke-width:0.1" x1="10.449194" > y1="-10.603984" x2="5.433580" y2="-10.603984"/> > </svg> > > > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] > On Behalf Of rs274d > Sent: Friday, January 19, 2007 8:20 AM > To: [email protected] > Subject: [svg-developers] Re: Need help determining if a point is inside or > outside of a closed path > > --- In [email protected], "vmmdragon" <vmmdragon@> wrote: > > > > --- In [email protected], "rs274d" <jge14@> wrote: > > > > > > Can anyone someone guide me in determining if a point is inside or > > > outside of a closed path? I can manage this for polygons but I'm lost > > > where to start on paths. Alternatively has someone written code they > > > would share on converting paths to polygons? Any help is much > > appreciated. > > > > > > Thanks, > > > > > > Jeff E. > > > > > > > Take a look at http://kevlindev.com/geometry/ > > he's got a great working SVG example. > > > > M. > > > M. > > Thanks for the pointer - but I could not find an example of > determining if a point is inside or outside of a path. Lots of > examples of intersection with paths and an example of a point in a > polygon. > > What I'm trying to do is determine if a point (start of a piece of > text) in layer 1 is inside or outside of a several paths (mixed > absolute and relative) on layer 2. > > I have this working great if layer 2 containing polygons but I am > struggling for a way to do the same with paths. > > Many Thanks, > Jeff E. > > > > > > ----- > To unsubscribe send a message to: [EMAIL PROTECTED] > -or- > visit http://groups.yahoo.com/group/svg-developers and click "edit my > membership" > ---- > Yahoo! Groups Links > ----- To unsubscribe send a message to: [EMAIL PROTECTED] -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ---- Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/svg-developers/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/svg-developers/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

