s3dlib.surface Functions¶
Contents¶
Geometry Functions¶
|
Rotation matrix from Euler angles, X or Y convention. |
|
Rotation matrix from rotation about a directional axis |
|
Rotations matrix from two vectors |
|
2D histogram density, Data_density = f(x,y) from a x,y dataset. |
|
Y = f(x) from a collection of linear segment functions f(x) |
|
Create surface from obj formatted 'file'. |
|
Export 'surface' geometry to obj formatted file. |
|
xyz coordinate points, marker colors array, and ScalarMappable object. |
Matplotlib 3D Visualization Functions¶
The following methods are used prior to adding objects to the Matplotlib 3D axis.
|
Transform direction vector 'relative to view' axis viewing angles. |
|
Unit vector in the terms of angular position. |
|
Scale Axes3d using object bounds. |
|
Add XYZ origin coordinate axis Vector3DCollection to the axes. |
|
Add XYZ origin coordinate axis Vector3DCollection and set the axis viewing angle, projection type and clear planes. |
Code Documentation¶
- s3dlib.surface.auto_scale(axes, *obj3d, **kargs)[source]¶
Scale Axes3d using object bounds.
- Parameters:
axes (Matplotlib 3D axes.) –
obj3d (positional arguments of s3dlib objects) –
uscale (scaling in the range (0.5,2.5)) – if neither uscale or rscale are defined - . Each axes ranges are independently . set by sizes of input objects. if both uscale and rscale are defined - . uscale will be ignored. if defined using an int or float - . Each axes ranges have the same scalar . length, set by the values of the objects. . Out of range values will set the scaling . to the minimum or maximum. else - scaling is one.
rscale (scaling in the range (0.5,2.5)) – if neither uscale or rscale are defined - . Each axes ranges are independently . set by sizes of input objects. if both uscale and rscale are defined - . uscale will be ignored. if defined using an int or float - . Each axes ranges have the same minimum . and maximum, set by the values of the . objects radial extent from the origin. . Out of range values will set the scaling . to the maximum. else - scaling is one.
- Returns:
axes, which has been scaled
- s3dlib.surface.axisRot(alpha, direction, inrad=False)[source]¶
Rotation matrix from rotation about a directional axis
- s3dlib.surface.density_function(vals, bins=(10, 10), scale=True, xbnd=True, ybnd=True, kind='linear')[source]¶
2D histogram density, Data_density = f(x,y) from a x,y dataset.
- Parameters:
vals (2 X N array of x,y data values.) –
bins ([int,int], the number of bins for each dimension.) –
scale (bool or number, default: True) – If True, normalize values to the average. If False, scale is 1, the density value of data per bin area. When numerical, multiplier for the density value.
xbnd (bool, default : True) – If True, x values are extended for density of zero. For cyclic mapping, this should be set to False.
ybnd (bool, default : True) – If True, y values are extended for density of zero. For cyclic mapping, this should be set to False.
kind ({‘linear’, ‘cubic’, ‘quintic’}, default: 'linear') – The kind of spline interpolation to use.
- Returns:
A function f(x,y)
- s3dlib.surface.elev_azim_2vector(elev, azim, inrad=False)[source]¶
Unit vector in the terms of angular position.
- s3dlib.surface.eulerRot(theta, phi, psi=0, useXconv=True, inrad=False)[source]¶
Rotation matrix from Euler angles, X or Y convention.
- s3dlib.surface.frame_to_value(x, *valList, **kargs)[source]¶
Y = f(x) from a collection of linear segment functions f(x)
- Parameters:
x (float value between 0 and 1.) –
valList (list of values, evenly spaced along x. For multiple lists, all must be the same length.) –
stepped (boolean, default is False.) – If True, function evaluate to a constant of the first value between valList values. If False, function is linear between valList values. For True, number of linear segments is the valList length. For False, number of linear segments is one less than valList length.
- Returns:
List of values of size valList arguments number.
- s3dlib.surface.get_points_from_cloud(cloud, domain=1, cmap=None, fade=None)[source]¶
xyz coordinate points, marker colors array, and ScalarMappable object.
- Parameters:
cloud (a (M,N,P) shaped array of point cloud values.) –
domain (a number, list or array, default: 1) – The domain of the function evaluation. For a number, n, the x,y,z axes domains will be [-n,n]. For a 1-dimensional 2-element list, [a,b] will be assigned the domain for all 3 axes. Using a list of list (array), as [ [a,b],[c,d],[e,f] ], the domain is assigned individually for each of the three coordinate axes.
cmap (str or Colormap, default: Matplotlib default colormap) – A Colormap instance or registered colormap name.
fade (an float, default: None) – Powerlaw adjust point opacity for emphasizing upper/lower values. The absolute values of fade must be in the range 0.1 to 10.
- Returns:
xyz (a 3 X S array, where S is the number of points in the domain.)
colors (array of point colors.)
ScMap (a Matplotlib ScalarMappable object.)
- s3dlib.surface.get_surfgeom_from_obj(file, **kargs)[source]¶
Create surface from obj formatted ‘file’. kargs passed to instantiate surface in constructor. ‘Proof of concept’ for future versions.
- s3dlib.surface.rtv(direction, elev=None, azim=None)[source]¶
Transform direction vector ‘relative to view’ axis viewing angles.
- s3dlib.surface.save_surfgeom_to_obj(file, surface)[source]¶
Export ‘surface’ geometry to obj formatted file. ‘Proof of concept’ for future versions.
- s3dlib.surface.setupAxis(axes, **kargs)[source]¶
Add XYZ origin coordinate axis Vector3DCollection to the axes.
- Parameters:
axes (Matplotlib 3D axes object.) –
length (coordinate axis length (single or 3-value list), default: 1.5) –
color (axis color (single or 3-value list), default: 'black') –
offset (axis vector offset from the origin (single or 3-value list), default: 0) –
labels (axis label (single or 3-value list), default: ['X','Y','Z']) –
pad (label padding from the vector axis head (single or 3-value list), default: 0.15) –
width (axis line widths, default: 2) –
negaxis (show negative axis line, default: False) –
alr (axis length ratio, head size to axis length, default: 0.2) –
- Returns:
axes