Parametric Objects¶
The following functions can be used to create parametric surfaces. To see what these functions create, check out the example: Parametric Geometric Objects.
-
pyvista.
ParametricBohemianDome
(a=None, **kwargs)¶ Generate a Bohemian dome.
- Parameters
a (double, optional) – Construct a Bohemian dome surface with the following parameters:
vtkGetMacro(A –
double); –
- Returns
surf – ParametricBohemianDome surface
- Return type
Examples
Create a ParametricBohemianDome mesh
>>> import pyvista >>> mesh = pyvista.ParametricBohemianDome() >>> mesh.plot(color='w', smooth_shading=True)
-
pyvista.
ParametricBour
(**kwargs)¶ Generate Bour’s minimal surface.
- Returns
surf – ParametricBour surface
- Return type
Examples
Create a ParametricBour mesh
>>> import pyvista >>> mesh = pyvista.ParametricBour() >>> mesh.plot(color='w', smooth_shading=True)
-
pyvista.
ParametricBoy
(zscale=None, **kwargs)¶ Generate Boy’s surface.
ParametricBoy generates Boy’s surface. This is a Model of the projective plane without singularities. It was found by Werner Boy on assignment from David Hilbert.
For further information about this surface, please consult the technical description “Parametric surfaces” in the “VTK Technical Documents” section in the VTK.org web pages.
- Parameters
zscale (double, optional) – The scale factor for the z-coordinate. Default is 18, giving a nice shape.
- Returns
surf – ParametricBoy surface
- Return type
Examples
Create a ParametricBoy mesh
>>> import pyvista >>> mesh = pyvista.ParametricBoy() >>> mesh.plot(color='w', smooth_shading=True)
-
pyvista.
ParametricDini
(a=None, b=None, **kwargs)¶ Generate Dini’s surface.
ParametricDini generates Dini’s surface. Dini’s surface is a surface that possesses constant negative Gaussian curvature
- Parameters
a (double, optional) – The scale factor. See the definition in Parametric surfaces referred to above. Default is 1.
b (double, optional) – The scale factor. See the definition in Parametric surfaces referred to above. Default is 0.2
- Returns
surf – ParametricDini surface
- Return type
Examples
Create a ParametricDini mesh
>>> import pyvista >>> mesh = pyvista.ParametricDini() >>> mesh.plot(color='w', smooth_shading=True)
-
pyvista.
ParametricEllipsoid
(xradius=None, yradius=None, zradius=None, **kwargs)¶ Generate an ellipsoid.
ParametricEllipsoid generates an ellipsoid. If all the radii are the same, we have a sphere. An oblate spheroid occurs if RadiusX = RadiusY > RadiusZ. Here the Z-axis forms the symmetry axis. To a first approximation, this is the shape of the earth. A prolate spheroid occurs if RadiusX = RadiusY < RadiusZ.
- Parameters
xradius (double, optional) – The scaling factor for the x-axis. Default is 1.
yradius (double, optional) – The scaling factor for the y-axis. Default is 1.
zradius (double, optional) – The scaling factor for the z-axis. Default is 1.
- Returns
surf – ParametricEllipsoid surface
- Return type
Examples
Create a ParametricEllipsoid mesh
>>> import pyvista >>> mesh = pyvista.ParametricEllipsoid() >>> mesh.plot(color='w', smooth_shading=True)
-
pyvista.
ParametricEnneper
(**kwargs)¶ Generate Enneper’s surface.
ParametricEnneper generates Enneper’s surface. Enneper’s surface is a a self-intersecting minimal surface possessing constant negative Gaussian curvature
- Returns
surf – ParametricEnneper surface
- Return type
Examples
Create a ParametricEnneper mesh
>>> import pyvista >>> mesh = pyvista.ParametricEnneper() >>> mesh.plot(color='w', smooth_shading=True)
-
pyvista.
ParametricFigure8Klein
(radius=None, **kwargs)¶ Generate a figure-8 Klein bottle.
ParametricFigure8Klein generates a figure-8 Klein bottle. A Klein bottle is a closed surface with no interior and only one surface. It is unrealisable in 3 dimensions without intersecting surfaces.
- Parameters
radius (double, optional) – The radius of the bottle. Default is 1.
- Returns
surf – ParametricFigure8Klein surface
- Return type
Examples
Create a ParametricFigure8Klein mesh
>>> import pyvista >>> mesh = pyvista.ParametricFigure8Klein() >>> mesh.plot(color='w', smooth_shading=True)
-
pyvista.
ParametricHenneberg
(**kwargs)¶ Generate Henneberg’s minimal surface.
- Returns
surf – ParametricHenneberg surface
- Return type
Examples
Create a ParametricHenneberg mesh
>>> import pyvista >>> mesh = pyvista.ParametricHenneberg() >>> mesh.plot(color='w', smooth_shading=True)
-
pyvista.
ParametricKlein
(**kwargs)¶ Generate a “classical” representation of a Klein bottle.
ParametricKlein generates a “classical” representation of a Klein bottle. A Klein bottle is a closed surface with no interior and only one surface. It is unrealisable in 3 dimensions without intersecting surfaces.
- Returns
surf – ParametricKlein surface
- Return type
Examples
Create a ParametricKlein mesh
>>> import pyvista >>> mesh = pyvista.ParametricKlein() >>> mesh.plot(color='w', smooth_shading=True)
-
pyvista.
ParametricKuen
(deltav0=None, **kwargs)¶ Generate Kuens’ surface.
ParametricKuen generates Kuens’ surface. This surface has a constant negative gaussian curvature.
- Parameters
deltav0 (double, optional) – The value to use when V == 0. Default is 0.05, giving the best appearance with the default settings. Setting it to a value less than 0.05 extrapolates the surface towards a pole in the -z direction. Setting it to 0 retains the pole whose z-value is -inf.
- Returns
surf – ParametricKuen surface
- Return type
Examples
Create a ParametricKuen mesh
>>> import pyvista >>> mesh = pyvista.ParametricKuen() >>> mesh.plot(color='w', smooth_shading=True)
-
pyvista.
ParametricMobius
(radius=None, **kwargs)¶ Generate a Mobius strip.
- Parameters
radius (double, optional) – The radius of the Mobius strip. Default is 1.
- Returns
surf – ParametricMobius surface
- Return type
Examples
Create a ParametricMobius mesh
>>> import pyvista >>> mesh = pyvista.ParametricMobius() >>> mesh.plot(color='w', smooth_shading=True)
-
pyvista.
ParametricPluckerConoid
(n=None, **kwargs)¶ Generate Plucker’s conoid surface.
ParametricPluckerConoid generates Plucker’s conoid surface parametrically. Plucker’s conoid is a ruled surface, named after Julius Plucker. It is possible to set the number of folds in this class via the parameter ‘N’.
- Parameters
n (int, optional) – This is the number of folds in the conoid.
vtkGetMacro(N –
int); –
- Returns
surf – ParametricPluckerConoid surface
- Return type
Examples
Create a ParametricPluckerConoid mesh
>>> import pyvista >>> mesh = pyvista.ParametricPluckerConoid() >>> mesh.plot(color='w', smooth_shading=True)
-
pyvista.
ParametricPseudosphere
(**kwargs)¶ Generate a pseudosphere.
ParametricPseudosphere generates a parametric pseudosphere. The pseudosphere is generated as a surface of revolution of the tractrix about it’s asymptote, and is a surface of constant negative Gaussian curvature.
- Returns
surf – ParametricPseudosphere surface
- Return type
Examples
Create a ParametricPseudosphere mesh
>>> import pyvista >>> mesh = pyvista.ParametricPseudosphere() >>> mesh.plot(color='w', smooth_shading=True)
-
pyvista.
ParametricRandomHills
(numberofhills=None, hillxvariance=None, hillyvariance=None, hillamplitude=None, randomseed=None, xvariancescalefactor=None, yvariancescalefactor=None, amplitudescalefactor=None, **kwargs)¶ Generate a surface covered with randomly placed hills.
ParametricRandomHills generates a surface covered with randomly placed hills. Hills will vary in shape and height since the presence of nearby hills will contribute to the shape and height of a given hill. An option is provided for placing hills on a regular grid on the surface. In this case the hills will all have the same shape and height.
- Parameters
numberofhills (int, optional) – The number of hills. Default is 30.
hillxvariance (double, optional) – The hill variance in the x-direction. Default is 2.5.
hillyvariance (double, optional) – The hill variance in the y-direction. Default is 2.5.
hillamplitude (double, optional) – The hill amplitude (height). Default is 2.
randomseed (int, optional) – The Seed for the random number generator, a value of 1 will initialize the random number generator, a negative value will initialize it with the system time. Default is 1.
xvariancescalefactor (double, optional) – The scaling factor for the variance in the x-direction. Default is 13.
yvariancescalefactor (double, optional) – The scaling factor for the variance in the y-direction. Default is 13.
amplitudescalefactor (double, optional) – The scaling factor for the amplitude. Default is 13.
- Returns
surf – ParametricRandomHills surface
- Return type
Examples
Create a ParametricRandomHills mesh
>>> import pyvista >>> mesh = pyvista.ParametricRandomHills() >>> mesh.plot(color='w', smooth_shading=True)
-
pyvista.
ParametricRoman
(radius=None, **kwargs)¶ Generate Steiner’s Roman Surface.
- Parameters
radius (double, optional) – The radius. Default is 1.
- Returns
surf – ParametricRoman surface
- Return type
Examples
Create a ParametricRoman mesh
>>> import pyvista >>> mesh = pyvista.ParametricRoman() >>> mesh.plot(color='w', smooth_shading=True)
-
pyvista.
ParametricSuperEllipsoid
(xradius=None, yradius=None, zradius=None, n1=None, n2=None, **kwargs)¶ Generate a superellipsoid.
ParametricSuperEllipsoid generates a superellipsoid. A superellipsoid is a versatile primitive that is controlled by two parameters n1 and n2. As special cases it can represent a sphere, square box, and closed cylindrical can.
- Parameters
xradius (double, optional) – The scaling factor for the x-axis. Default is 1.
yradius (double, optional) – The scaling factor for the y-axis. Default is 1.
zradius (double, optional) – The scaling factor for the z-axis. Default is 1.
n1 (double, optional) – The “squareness” parameter in the z axis. Default is 1.
n2 (double, optional) – The “squareness” parameter in the x-y plane. Default is 1.
- Returns
surf – ParametricSuperEllipsoid surface
- Return type
Examples
Create a ParametricSuperEllipsoid mesh
>>> import pyvista >>> mesh = pyvista.ParametricSuperEllipsoid() >>> mesh.plot(color='w', smooth_shading=True)
-
pyvista.
ParametricSuperToroid
(ringradius=None, crosssectionradius=None, xradius=None, yradius=None, zradius=None, n1=None, n2=None, **kwargs)¶ Generate a supertoroid.
ParametricSuperToroid generates a supertoroid. Essentially a supertoroid is a torus with the sine and cosine terms raised to a power. A supertoroid is a versatile primitive that is controlled by four parameters r0, r1, n1 and n2. r0, r1 determine the type of torus whilst the value of n1 determines the shape of the torus ring and n2 determines the shape of the cross section of the ring. It is the different values of these powers which give rise to a family of 3D shapes that are all basically toroidal in shape.
- Parameters
ringradius (double, optional) – The radius from the center to the middle of the ring of the supertoroid. Default is 1.
crosssectionradius (double, optional) – The radius of the cross section of ring of the supertoroid. Default = 0.5.
xradius (double, optional) – The scaling factor for the x-axis. Default is 1.
yradius (double, optional) – The scaling factor for the y-axis. Default is 1.
zradius (double, optional) – The scaling factor for the z-axis. Default is 1.
n1 (double, optional) – The shape of the torus ring. Default is 1.
n2 (double, optional) – The shape of the cross section of the ring. Default is 1.
- Returns
surf – ParametricSuperToroid surface
- Return type
Examples
Create a ParametricSuperToroid mesh
>>> import pyvista >>> mesh = pyvista.ParametricSuperToroid() >>> mesh.plot(color='w', smooth_shading=True)
-
pyvista.
ParametricTorus
(ringradius=None, crosssectionradius=None, **kwargs)¶ Generate a torus.
- Parameters
ringradius (double, optional) – The radius from the center to the middle of the ring of the torus. Default is 1.0.
crosssectionradius (double, optional) – The radius of the cross section of ring of the torus. Default is 0.5.
- Returns
surf – ParametricTorus surface
- Return type
Examples
Create a ParametricTorus mesh
>>> import pyvista >>> mesh = pyvista.ParametricTorus() >>> mesh.plot(color='w', smooth_shading=True)
These functions support building parametric surfaces:
-
pyvista.
parametric_keywords
(parametric_function, min_u=0, max_u=6.283185307179586, min_v=0.0, max_v=6.283185307179586, join_u=False, join_v=False, twist_u=False, twist_v=False, clockwise=True)¶ Apply keyword arguments to a parametric function.
- Parameters
min_u (float, optional) – The minimum u-value.
max_u (float, optional) – The maximum u-value.
min_v (float, optional) – The minimum v-value.
max_v (float, optional) – The maximum v-value.
join_u (bool, optional) – Joins the first triangle strip to the last one with a twist in the u direction.
join_v (bool, optional) – joins the first triangle strip to the last one with a twist in the v direction.
twist_u (bool, optional) – Joins the first triangle strip to the last one with a twist in the u direction.
twist_v (bool, optional) – Joins the first triangle strip to the last one with a twist in the v direction.
clockwise (bool, optional) – Determines the ordering of the vertices forming the triangle strips.
-
pyvista.
surface_from_para
(parametric_function, u_res=100, v_res=100, w_res=100)¶ Construct a mesh from a parametric function.
- Parameters
parametric_function (vtk.vtkParametricFunction) – Parametric function to generate mesh from.
u_res (int, optional) – Resolution in the u direction.
v_res (int, optional) – Resolution in the v direction.
w_res (int, optional) – Resolution in the w direction.