#### Previous topic

sknano.core.geometric_regions.Cylinder.translate

#### Next topic

sknano.core.geometric_regions.Cone.axis

# sknano.core.geometric_regions.Cone¶

class sknano.core.geometric_regions.Cone(p1=None, p2=None, r=1)[source][source]

Geometric3DRegion for 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: p1, p2 : array_like, optional 3-tuples or Point class instances for 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)$$. r : float, optional Radius $$r$$ of Cone base

Notes

Cone represents 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 Cone with no parameters is equivalent to Cone(p1=[0, 0, 0], p2=[0, 0, 2], r=1).

Attributes

 axis Cone axis Vector from $$\boldsymbol{\ell}=p_2 - p_1$$ 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. 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

 center_centroid() Center centroid on origin. contains(point) Test region membership of point in Cone. rotate([angle, axis, anchor_point, ...]) Rotate GeometricRegion points and vectors. todict() Returns a dict of the Cone constructor parameters. translate(t[, fix_anchor_points]) Translate GeometricRegion points and vectors by Vector t.