sknano.core.geometric_regions.Cylinder.contains¶
-
Cylinder.
contains
(point)[source][source]¶ Test region membership of point in
Cylinder
.Parameters: point : array_like
Returns: True if point is within
Cylinder
, False otherwise.Notes
A point \((p_x, p_y, p_z)\) is within the bounded region of a cylinder with radius \(r\) around the line from \(p_1=(x_1, y_1, z_1)\) to \(p_2 = (x_2, y_2, z_2)\) if the following is true:
\[0\le q\le 1\land (x_1 - p_x + (x_2 - x_1) q)^2 + (y_1 - p_y + (y_2 - y_1) q)^2 + (z_1 - p_z + (z_2 - z_1) q)^2 \le r^2\]where \(q\) is:
\[q = \frac{(p_x - x_1)(x_2 - x_1) + (p_y - y_1)(y_2 - y_1) + (p_z - z_1)(z_2 - z_1)}{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}\]