Cone¶
-
class
sknano.core.geometric_regions.
Cone
(p1=None, p2=None, r=1)[source] [edit on github][source]¶ Bases:
sknano.core.geometric_regions.Geometric3DRegion
Geometric3DRegion
for a cone.New in version 0.3.10.
Represents a cone with a base of radius r centered at p1=(x1,y1,z1) and a tip at p2=(x2,y2,z2).
Parameters: Notes
Cone
represents a bounded cone region {p1+ρ(1−z)cos(θ)v1+ρ(1−z)sin(θ)v2+v3z|0≤θ≤2π∧0≤ρ≤1∧0≤z≤1} where v3=p2−p1 and vectors (v1,v2,v3) are orthogonal with |v1|=|v2|=1 and p1=(x1,y1,z1) and p2=(x2,y2,z2).Calling
Cone
with no parameters is equivalent toCone
(p1=[0, 0, 0], p2=[0, 0, 2], r=1)
.Attributes
axis
Cone
axisVector
from \boldsymbol{\ell}=p_2 - p_1bounding_box
Bounding Cuboid
.center
Alias for centroid
.centroid
Cone
centroid, (c_x, c_y, c_z).fmtstr
Format string. measure
Alias for volume
, which is the measure of a 3D geometric region.ndim
Return the dimensions. p1
Center point (x_1, y_1, z_1) of Cone
base.p2
Point (x_2, y_2, z_2) of Cone
tip.pmax
Point
at maximum extent.pmin
Point
at minimum extent.r
Radius r of Cone
base.volume
Cone
volume, V=\frac{1}{3}\pi r^2 \ell.Methods
center_centroid
()Center centroid
on origin.contains
(point)Test region membership of point
inCone
.get_points
()Return list of points from GeometricRegion.points
andGeometricRegion.vectors
rotate
(**kwargs)Rotate GeometricRegion
points
andvectors
.todict
()Returns a dict
of theCone
constructor parameters.translate
(t[, fix_anchor_points])Translate GeometricRegion
points
andvectors
byVector
t
.Attributes Summary
axis
Cone
axisVector
from \boldsymbol{\ell}=p_2 - p_1centroid
Cone
centroid, (c_x, c_y, c_z).p1
Center point (x_1, y_1, z_1) of Cone
base.p2
Point (x_2, y_2, z_2) of Cone
tip.r
Radius r of Cone
base.volume
Cone
volume, V=\frac{1}{3}\pi r^2 \ell.Methods Summary
contains
(point)Test region membership of point
inCone
.todict
()Returns a dict
of theCone
constructor parameters.Attributes Documentation
-
centroid
¶ Cone
centroid, (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 Point
ofCone
centroid.Return type: Point
Methods Documentation
-
contains
(point)[source] [edit on github][source]¶ Test region membership of
point
inCone
.Parameters: point (array_like) – Returns: True
ifpoint
is withinCone
,False
otherwise.Return type: bool
Notes
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^2where 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}
-