signed_distance_polygon
signed_distance_polygon(P, V)
Signed distance from a set of points to a given polygon
Parameters:
Name | Type | Description | Default |
---|---|---|---|
P |
numpy double array
|
Matrix of query point coordinates |
required |
V |
numpy double array
|
Matrix of polyline vertex positions in order |
required |
Returns:
Name | Type | Description |
---|---|---|
S |
numpy double array
|
Vector of signed distances from each query point to the polyline |
Notes
This is lifted from https://www.shadertoy.com/view/wdBXRW
Examples:
# Build a polyline; for example, a square
V = np.array([ [-1.0, -1.0], [-1.0, 1.0], [1.0, 1.0], [1.0, -1.0] ])
sample_points = np.array([ [0.0,0.0],
[0.3,0.0],
[-1.5,0.5],
[1.2,0.0]])
groundtruth_vals = np.array([-1.0,-0.7,0.5,0.2])
S = gpytoolbox.signed_distance_polygon(sample_points,V)
Source code in src/gpytoolbox/signed_distance_polygon.py
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|