squared_distance_to_element
squared_distance_to_element(point, V, element)
Squared distance from a point to a mesh element (point, edge, triangle)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
point |
(dim,) numpy double array
|
Query point coordinates |
required |
V |
(v,dim) numpy double array
|
Matrix of mesh/polyline/pointcloud vertex coordinates |
required |
element |
(s,) numpy int array
|
Vector of element indices into V |
required |
Returns:
Name | Type | Description |
---|---|---|
sqrD |
double
|
Squared minimum distance from point to mesh element |
lmb |
(s,) numpy double array
|
Barycentric coordinates into the element of the closest point to the query point |
See Also
squared_distance.
Examples:
# Generate random mesh
V = np.random.rand(3,3)
F = np.array([0,1,2],dtype=int)
# Generate random query point
P = np.random.rand(3)
# Calculate distance from point to triangle
sqrD = gpytoolbox.squared_distance_to_element(P,V,F)
Source code in src/gpytoolbox/squared_distance_to_element.py
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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|