Geometry typesΒΆ

In [1]:
from pythreejs import *
from IPython.display import display
from math import pi
In [2]:
# Reduce repo churn for examples with embedded state:
from pythreejs._example_helper import use_example_model_ids
use_example_model_ids()
In [3]:
BoxGeometry(
    width=5,
    height=10,
    depth=15,
    widthSegments=5,
    heightSegments=10,
    depthSegments=15)
In [4]:
BoxBufferGeometry(
    width=5,
    height=10,
    depth=15,
    widthSegments=5,
    heightSegments=10,
    depthSegments=15)
In [5]:
CircleGeometry(
    radius=10,
    segments=10,
    thetaStart=0.25,
    thetaLength=5.0)
In [6]:
CircleBufferGeometry(
    radius=10,
    segments=10,
    thetaStart=0.25,
    thetaLength=5.0)
In [7]:
CylinderGeometry(
    radiusTop=5,
    radiusBottom=10,
    height=15,
    radialSegments=6,
    heightSegments=10,
    openEnded=False,
    thetaStart=0,
    thetaLength=2.0*pi)
In [8]:
CylinderBufferGeometry(
    radiusTop=5,
    radiusBottom=10,
    height=15,
    radialSegments=6,
    heightSegments=10,
    openEnded=False,
    thetaStart=0,
    thetaLength=2.0*pi)
In [9]:
DodecahedronGeometry(radius=10, detail=0, _flat=True)
In [ ]:
# TODO:
# EdgesGeometry(...)
In [ ]:
# TODO:
# ExtrudeGeometry(...)
In [10]:
IcosahedronGeometry(radius=10, _flat=True)
In [11]:
LatheBufferGeometry(
    points=[
        [ 0, -10, 0 ],
        [ 10, -5, 0 ],
        [ 5, 5, 0 ],
        [ 0, 10, 0 ]
    ],
    segments=16,
    phiStart=0.0,
    phiLength=2.0*pi, _flat=True)
In [12]:
OctahedronGeometry(radius=10, detail=0, _flat=True)
In [13]:
ParametricGeometry(
    func="""function(u,v,out) {
        var x = 5 * (0.5 - u);
        var y = 5 * (0.5 - v);
        out.set(10 * x, 10 * y, x*x - y*y);
    }""",
    slices=5,
    stacks=10, _flat=True)
In [14]:
PlaneGeometry(
    width=10,
    height=15,
    widthSegments=5,
    heightSegments=10)
In [15]:
PlaneBufferGeometry(
    width=10,
    height=15,
    widthSegments=5,
    heightSegments=10)
In [ ]:
# TODO
# PolyhedronGeometry(...)
In [16]:
# TODO: issues when radius is 0...
RingGeometry(
    innerRadius=10,
    outerRadius=25,
    thetaSegments=8,
    phiSegments=12,
    thetaStart=0,
    thetaLength=6.283185307179586)
In [17]:
# TODO: issues when radius is 0...
RingBufferGeometry(
    innerRadius=10,
    outerRadius=25,
    thetaSegments=8,
    phiSegments=12,
    thetaStart=0,
    thetaLength=6.283185307179586)
In [ ]:
# TODO
# ShapeGeometry(...)
In [18]:
SphereGeometry(
    radius=20,
    widthSegments=8,
    heightSegments=6,
    phiStart=0,
    phiLength=1.5*pi,
    thetaStart=0,
    thetaLength=2.0*pi/3.0)
In [19]:
SphereBufferGeometry(
    radius=20,
    widthSegments=8,
    heightSegments=6,
    phiStart=0,
    phiLength=1.5*pi,
    thetaStart=0,
    thetaLength=2.0*pi/3.0)
In [20]:
TetrahedronGeometry(radius=10, detail=1, _flat=True)
In [ ]:
# TODO: font loading
# TextGeometry(...)
In [21]:
TorusGeometry(
    radius=20,
    tube=5,
    radialSegments=20,
    tubularSegments=6,
    arc=1.5*pi)
In [22]:
TorusBufferGeometry(radius=100)
In [23]:
TorusKnotGeometry(
    radius=20,
    tube=5,
    tubularSegments=64,
    radialSegments=8,
    p=2,
    q=3)
In [24]:
TorusKnotBufferGeometry(
    radius=20,
    tube=5,
    tubularSegments=64,
    radialSegments=8,
    p=2,
    q=3)
In [ ]:
# TODO: handling THREE.Curve
TubeGeometry(
    path=None,
    segments=64,
    radius=1,
    radiusSegments=8,
    close=False)
In [25]:
WireframeGeometry(geometry=TorusBufferGeometry(
    radius=20,
    tube=5,
    radialSegments=6,
    tubularSegments=20,
    arc=2.0*pi
))
In [ ]: