Parametric Geometric Objects

Creating parametric objects

# sphinx_gallery_thumbnail_number = 12
import pyvista as pv
from math import pi

This example demonstrates how to plot parametric objects using pyvista

Supertoroid

supertoroid = pv.ParametricSuperToroid(n1=0.5)
supertoroid.plot(color="tan", smooth_shading=True)
create parametric geometric objects

Out:

[(4.861253025523928, 4.861441853038577, 4.861253025523928),
 (0.0, 0.0001888275146484375, 0.0),
 (0.0, 0.0, 1.0)]

Parametric Ellipsoid

# Ellipsoid with a long x axis
ellipsoid = pv.ParametricEllipsoid(10, 5, 5)
ellipsoid.plot(color="tan")
create parametric geometric objects

Out:

[(27.315001924719024, 27.312485178198028, 27.312485178198028),
 (0.0025167465209960938, 0.0, 0.0),
 (0.0, 0.0, 1.0)]

Partial Parametric Ellipsoid

# cool plotting direction
cpos = [
    (21.9930, 21.1810, -30.3780),
    (-1.1640, -1.3098, -0.1061),
    (0.8498, -0.2515, 0.4631),
]


# half ellipsoid
part_ellipsoid = pv.ParametricEllipsoid(10, 5, 5, max_v=pi / 2)
part_ellipsoid.plot(color="tan", smooth_shading=True, cpos=cpos)
create parametric geometric objects

Out:

[(21.993, 21.181, -30.378),
 (-1.164, -1.3098, -0.1061),
 (0.8498535849578507, -0.2515158585748405, 0.4631292012167341)]

Pseudosphere

pseudosphere = pv.ParametricPseudosphere()
pseudosphere.plot(color="tan", smooth_shading=True)
create parametric geometric objects

Out:

[(9.462503792668267, 9.462755175257607, 9.462755175257607),
 (-0.00025138258934020996, 0.0, 0.0),
 (0.0, 0.0, 1.0)]

Bohemian Dome

bohemiandome = pv.ParametricBohemianDome()
bohemiandome.plot(color="tan")
create parametric geometric objects

Out:

[(5.110031624561594, 5.109779899245546, 5.110157494670198),
 (-0.00012587010860443115, -0.0003775954246520996, 0.0),
 (0.0, 0.0, 1.0)]

Bour

bour = pv.ParametricBour()
bour.plot(color="tan")
create parametric geometric objects

Out:

[(4.470163982016577, 4.844779532057776, 4.84779826889707),
 (-0.37461555004119873, 0.0, 0.0030187368392944336),
 (0.0, 0.0, 1.0)]

Boy’s Surface

boy = pv.ParametricBoy()
boy.plot(color="tan")
create parametric geometric objects

Out:

[(3.496735663209918, 3.346730412040713, 3.8289746279463794),
 (0.14987602829933167, -0.00012922286987304688, 0.4821149930357933),
 (0.0, 0.0, 1.0)]

Catalan Minimal

catalanminimal = pv.ParametricCatalanMinimal()
catalanminimal.plot(color="tan")
create parametric geometric objects

Out:

[(31.542660281331067, 32.54206828799916, 31.542660519749646),
 (0.0, 0.9994080066680908, 2.384185791015625e-07),
 (0.0, 0.0, 1.0)]

Conic Spiral

conicspiral = pv.ParametricConicSpiral()
conicspiral.plot(color="tan")
create parametric geometric objects

Out:

[(1.947212285780989, 1.9478484759569992, 2.297827556216799),
 (0.04939731955528259, 0.050033509731292725, 0.4000125899910927),
 (0.0, 0.0, 1.0)]

Cross Cap

crosscap = pv.ParametricCrossCap()
crosscap.plot(color="tan")
create parametric geometric objects

Out:

[(3.8628927898895045, 3.8628927302848597, 3.8631445301067133),
 (0.0, -5.960464477539063e-08, 0.0002517402172088623),
 (0.0, 0.0, 1.0)]

Dini

dini = pv.ParametricDini()
dini.plot(color="tan")
create parametric geometric objects

Out:

[(10.672493040603099, 10.6722411811766, 8.641864776652751),
 (0.0002517104148864746, -1.4901161193847656e-07, -2.0303765535354614),
 (0.0, 0.0, 1.0)]

Enneper

enneper = pv.ParametricEnneper()
enneper.plot(cpos="yz")
create parametric geometric objects

Out:

[(42.946638627281644, 0.0, 0.0),
 (0.0, 0.0, 0.0),
 (0.0, 0.0, 1.0)]

Figure-8 Klein

figure8klein = pv.ParametricFigure8Klein()
figure8klein.plot()
create parametric geometric objects

Out:

[(6.471927580738704, 6.241271850968044, 6.241280195618312),
 (0.23064738512039185, -8.344650268554688e-06, 0.0),
 (0.0, 0.0, 1.0)]

Henneberg

henneberg = pv.ParametricHenneberg()
henneberg.plot(color="tan")
create parametric geometric objects

Out:

[(30.00421257084943, 30.00421209401227, 30.002318335238467),
 (0.0, -4.76837158203125e-07, -0.001894235610961914),
 (0.0, 0.0, 1.0)]

Klein

klein = pv.ParametricKlein()
klein.plot(color="tan")
create parametric geometric objects

Out:

[(6.361395375111999, 8.311908181557236, 6.208944455960693),
 (0.15245109796524048, 2.102963904410476, 1.7881393432617188e-07),
 (0.0, 0.0, 1.0)]

Kuen

kuen = pv.ParametricKuen()
kuen.plot(color="tan")
create parametric geometric objects

Out:

[(39.704327196761035, 40.19100275723543, 55.22279772250261),
 (0.0, 0.48667556047439575, 15.518470525741577),
 (0.0, 0.0, 1.0)]

Mobius

mobius = pv.ParametricMobius()
mobius.plot(color="tan")
create parametric geometric objects

Out:

[(5.656253133787988, 5.208850894942163, 5.656253252997278),
 (0.0, -0.4474022388458252, 1.1920928955078125e-07),
 (0.0, 0.0, 1.0)]

Plucker Conoid

pluckerconoid = pv.ParametricPluckerConoid()
pluckerconoid.plot(color="tan")
create parametric geometric objects

Out:

[(9.721636508639419, 9.722391699488723, 9.72163638943013),
 (0.0, 0.0007551908493041992, -1.1920928955078125e-07),
 (0.0, 0.0, 1.0)]

Random Hills

randomhills = pv.ParametricRandomHills()
randomhills.plot(color="tan")
create parametric geometric objects

Out:

[(32.59238063266725, 42.5923804083449, 36.404716943411536),
 (0.0, 9.99999977567765, 3.8123363107442856),
 (0.0, 0.0, 1.0)]

Roman

roman = pv.ParametricRoman()
roman.plot(color="tan")
create parametric geometric objects

Out:

[(1.9315274394739659, 1.9315274394739659, 1.9315274394739659),
 (0.0, 0.0, 0.0),
 (0.0, 0.0, 1.0)]

Super Ellipsoid

superellipsoid = pv.ParametricSuperEllipsoid(n1=0.1, n2=2)
superellipsoid.plot(color="tan")
create parametric geometric objects

Out:

[(3.862698653641108, 3.862195322218302, 3.862698653641108),
 (0.0, -0.0005033314228057861, 0.0),
 (0.0, 0.0, 1.0)]

Torus

torus = pv.ParametricTorus()
torus.plot(color="tan")
create parametric geometric objects

Out:

[(4.860818269572256, 4.861195864996908, 4.860818269572256),
 (0.0, 0.0003775954246520996, 0.0),
 (0.0, 0.0, 1.0)]

Circular Arc

pointa = [-1, 0, 0]
pointb = [0, 1, 0]
center = [0, 0, 0]
resolution = 100

arc = pv.CircularArc(pointa, pointb, center, resolution)

pl = pv.Plotter()
pl.add_mesh(arc, color='k', line_width=4)
pl.show_bounds()
pl.view_xy()
pl.show()
create parametric geometric objects

Out:

[(-0.5000000000499987, 0.5, 2.7320508074322785),
 (-0.5000000000499987, 0.5, 0.0),
 (0.0, 1.0, 0.0)]

Extruded Half Arc

pointa = [-1, 0, 0]
pointb = [1, 0, 0]
center = [0, 0, 0]
resolution = 100

arc = pv.CircularArc(pointa, pointb, center, resolution)
poly = arc.extrude([0, 0, 1])
poly.plot(color="tan", cpos='iso', show_edges=True)
create parametric geometric objects

Out:

[(2.7320508075688776, 2.2320508075688776, 3.2320508075688776),
 (0.0, -0.5, 0.5),
 (0.0, 0.0, 1.0)]

Total running time of the script: ( 0 minutes 15.970 seconds)

Gallery generated by Sphinx-Gallery