Cone¶
-
class
sknano.core.geometric_regions.Cone(p1=None, p2=None, r=1)[source] [edit on github][source]¶ Bases:
sknano.core.geometric_regions.Geometric3DRegionGeometric3DRegionfor a cone.New in version 0.3.10.
Represents a cone with a base of radius \(r\) centered at \(p_1=(x_1,y_1,z_1)\) and a tip at \(p_2=(x_2, y_2, z_2)\).
Parameters: Notes
Conerepresents a bounded cone region \(\left\{p_1+\rho(1-z)\cos(\theta)\mathbf{v}_1 + \rho(1-z)\sin(\theta)\mathbf{v}_2+\mathbf{v}_3 z| 0\le\theta\le 2\pi\land 0\le\rho\le 1\land 0\le z\le 1\right\}\) where \(\mathbf{v}_3=p_2-p_1\) and vectors \((\mathbf{v}_1,\mathbf{v}_2,\mathbf{v}_3)\) are orthogonal with \(|\mathbf{v}_1|=|\mathbf{v}_2|=1\) and \(p_1=(x_1,y_1,z_1)\) and \(p_2=(x_2, y_2, z_2)\).Calling
Conewith no parameters is equivalent toCone(p1=[0, 0, 0], p2=[0, 0, 2], r=1).Attributes
axisConeaxisVectorfrom \(\boldsymbol{\ell}=p_2 - p_1\)bounding_boxBounding Cuboid.centerAlias for centroid.centroidConecentroid, \((c_x, c_y, c_z)\).fmtstrFormat string. measureAlias for volume, which is the measure of a 3D geometric region.ndimReturn the dimensions. p1Center point \((x_1, y_1, z_1)\) of Conebase.p2Point \((x_2, y_2, z_2)\) of Conetip.pmaxPointat maximum extent.pminPointat minimum extent.rRadius \(r\) of Conebase.volumeConevolume, \(V=\frac{1}{3}\pi r^2 \ell\).Methods
center_centroid()Center centroidon origin.contains(point)Test region membership of pointinCone.get_points()Return list of points from GeometricRegion.pointsandGeometricRegion.vectorsrotate(**kwargs)Rotate GeometricRegionpointsandvectors.todict()Returns a dictof theConeconstructor parameters.translate(t[, fix_anchor_points])Translate GeometricRegionpointsandvectorsbyVectort.Attributes Summary
axisConeaxisVectorfrom \(\boldsymbol{\ell}=p_2 - p_1\)centroidConecentroid, \((c_x, c_y, c_z)\).p1Center point \((x_1, y_1, z_1)\) of Conebase.p2Point \((x_2, y_2, z_2)\) of Conetip.rRadius \(r\) of Conebase.volumeConevolume, \(V=\frac{1}{3}\pi r^2 \ell\).Methods Summary
contains(point)Test region membership of pointinCone.todict()Returns a dictof theConeconstructor parameters.Attributes Documentation
-
centroid¶ Conecentroid, \((c_x, c_y, c_z)\).Computed as:
\[c_x = \frac{3 x_1 + x_2}{4}\]\[c_y = \frac{3 y_1 + y_2}{4}\]\[c_z = \frac{3 z_1 + z_2}{4}\]Returns: 3D PointofConecentroid.Return type: Point
Methods Documentation
-
contains(point)[source] [edit on github][source]¶ Test region membership of
pointinCone.Parameters: point (array_like) – Returns: Trueifpointis withinCone,Falseotherwise.Return type: boolNotes
A
point\((p_x, p_y, p_z)\) is within the bounded region of a cone with a base of radius \(r\) centered at \(p_1=(x_1, y_1, z_1)\) and tip at \(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 q^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}\]
-