|
[Sponsors] |
To find whether a point lies inside or outside a curve defined by points |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 2, 2015, 06:40 |
To find whether a point lies inside or outside a curve defined by points
|
#1 |
New Member
casper
Join Date: Sep 2015
Posts: 6
Rep Power: 11 |
Hello all,
I have a closed curve defined by points and not equation. I have find if a point lies inside the curve or outside. Is there a way to do this without having to fit an equation to the curve? Here by points I mean computational nodes and the points on the curve need not coincide with the nodes. |
|
November 2, 2015, 08:25 |
|
#2 |
New Member
Join Date: Sep 2012
Posts: 11
Rep Power: 14 |
Hello,
have a look here: https://en.wikipedia.org/wiki/Point_in_polygon In short: Draw an infinite horizontal line in one direction beginning at the point in question. Now, count how often this line intersects the edges of the polygon. If you get 0 or an even number, the point lies outside. If you get an odd number, the point lies inside. You only have to think about what happens when your point lies on an edge of the polygon. |
|
November 3, 2015, 00:53 |
|
#3 |
New Member
casper
Join Date: Sep 2015
Posts: 6
Rep Power: 11 |
Hey,
This would be easy if we had the equation of the curve. In my case, the curve is defined by points and cannot be very easily fit into an equation. |
|
November 3, 2015, 03:35 |
|
#4 |
New Member
Join Date: Sep 2012
Posts: 11
Rep Power: 14 |
Hello casper,
this is a point-in-polygon test. In a polygon the discrete points are connected by edges, which are simple straight lines. Have a look here: https://www.ics.uci.edu/~eppstein/161/960307.html You can find some pseudo-code there. Don't think too complicated |
|
November 3, 2015, 04:48 |
|
#5 |
New Member
casper
Join Date: Sep 2015
Posts: 6
Rep Power: 11 |
Thats awesome! Also the link has detailed description for the procedure.
Thanks Julian |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[snappyHexMesh] .STL: non-closed manifold surface | giulio.topazio | OpenFOAM Meshing & Mesh Conversion | 32 | November 25, 2016 04:15 |
[snappyHexMesh] No layers in a small gap | bobburnquist | OpenFOAM Meshing & Mesh Conversion | 6 | August 26, 2015 10:38 |
block-structured mesh for t-junction | Robert@cfd | ANSYS Meshing & Geometry | 20 | November 11, 2011 05:59 |
Errors running allwmake in OpenFOAM141dev with WM_COMPILE_OPTION%3ddebug | unoder | OpenFOAM Installation | 11 | January 30, 2008 21:30 |
How to determine a point is inside a tetrahedral? | G.P. Xia | Main CFD Forum | 16 | January 12, 2000 12:15 |