Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding if point is inside geometry

I am writing a code that requires finding if a point is inside a specific geometry. The geometry may an n sided polygon (not necessarily convex) in 2 Dimensions or an STL geometry in 3 dimensions. I can actually write a search code using some algorithms available. But I am looking for a software library that can serve such purposes. It can be part of a bigger library. Any suggestion towards any such libraries or codes freely available would do. Thank You.

like image 877
Prapanch Nair Avatar asked Mar 26 '13 07:03

Prapanch Nair


People also ask

How do you know if a point is inside or outside the rectangle?

In any case, for any convex polygon (including rectangle) the test is very simple: check each edge of the polygon, assuming each edge is oriented in counterclockwise direction, and test whether the point lies to the left of the edge (in the left-hand half-plane). If all edges pass the test - the point is inside.

How do you know if a point is inside a box?

Transform the point with the inverse transform of the box, then the check becomes one against an axis aligned box. Alternatively do a check against each side of the box. If the point is to the left of all 4 sides (sides considered clockwise, head to tail) the point is inside the box.

How do you check if a given point lies inside or outside a polygon Python?

Use polygon. contains(point) to test if point is inside ( True ) or outside ( False ) the polygon.

Which point is inside of the triangle?

The simplest way to determine if a point lies inside a triangle is to check the number of points in the convex hull of the vertices of the triangle adjoined with the point in question. If the hull has three points, the point lies in the triangle's interior; if it is four, it lies outside the triangle.


1 Answers

How about Wykobi

Wykobi is an extremly efficient, robust and simple to use C++ 2D/3D oriented computational geometry library.

like image 96
masoud Avatar answered Oct 12 '22 09:10

masoud