Point/Line Sets

Add Cell Connectivity to Points

class PVGeo.filters.xyz.AddCellConnToPoints(**kwargs)[source]

Bases: PVGeo.base.FilterBase

This filter will add linear cell connectivity between scattered points. You have the option to add VTK_Line or VTK_PolyLine connectivity. VTK_Line connectivity makes a straight line between the points in order (either in the order by index or using a nearest neighbor calculation). The VTK_PolyLine adds a poly line connectivity between all points as one spline (either in the order by index or using a nearest neighbor calculation). Type map is specified in vtkCellType.h.

Cell Connectivity Types:

  • 4: Poly Line
  • 3: Line
RequestData(request, inInfo, outInfo)[source]

Used by pipeline to generate output data object

SetCellType(cellType)[source]

Set the cell typ by the integer id as specified in vtkCellType.h

SetUseNearestNbr(flag)[source]

Set a flag on whether to use SciPy’s cKDTree nearest neighbor algorithms to sort the points to before adding linear connectivity.

SetUseUniquePoints(flag)[source]

Set a flag on whether to only use unique points

_ConnectCells(pdi, pdo, logTime=False)[source]

Internal helper to perfrom the connection

Append Cell Centers

class PVGeo.filters.xyz.AppendCellCenters(**kwargs)[source]

Bases: PVGeo.base.FilterPreserveTypeBase

RequestData(request, inInfoVec, outInfoVec)[source]

Overwritten by subclass to execute the algorithm.

Convert XYZ Units

class PVGeo.filters.xyz.ConvertUnits(**kwargs)[source]

Bases: PVGeo.base.FilterPreserveTypeBase

Convert points in an input data object to from meters to feet or vice versa. This simply uses a vtkTransformFilter and scales input data object with common conversions.

GetConversion()[source]

Get the conversion value

static LookupConversions(getkeys=False)[source]

All Available conversions

Returns:dictionary of conversion units
Return type:dict
RequestData(request, inInfo, outInfo)[source]

Execute on pipeline

SetConversion(key)[source]

Set the conversion via a lookup table

Extract Cell Centers

class PVGeo.filters.xyz.ExtractCellCenters(**kwargs)[source]

Bases: PVGeo.base.FilterBase

RequestData(request, inInfoVec, outInfoVec)[source]

Overwritten by subclass to execute the algorithm.

Extract Points

class PVGeo.filters.xyz.ExtractPoints[source]

Bases: PVGeo.base.FilterBase

Extracts XYZ coordinates and point/cell data from an input vtkDataSet

RequestData(request, inInfo, outInfo)[source]

Overwritten by subclass to execute the algorithm.

Iterate Over Points

class PVGeo.filters.xyz.IterateOverPoints(dt=1.0)[source]

Bases: PVGeo.base.FilterBase

Iterate over points in a time varying manner.

GetNormal()[source]
GetPoint()[source]
GetTimestepValues()[source]

Use this in ParaView decorator to register timesteps

RequestData(request, inInfo, outInfo)[source]

Overwritten by subclass to execute the algorithm.

RequestInformation(request, inInfo, outInfo)[source]

Used by pipeline to set the time information

SetDecimate(percent)[source]

Set the percent (1 to 100) to decimate

SetTimeDelta(dt)[source]

Set the time step interval in seconds

_UpdateTimeSteps()[source]

For internal use only

Lat Lon To UTM

class PVGeo.filters.xyz.LonLatToUTM(**kwargs)[source]

Bases: PVGeo.base.FilterBase

Converts Points from Lon Lat to UTM

static GetAvailableEllps(idx=None)[source]

Returns the available ellps

RequestData(request, inInfo, outInfo)[source]

Overwritten by subclass to execute the algorithm.

SetEllps(ellps)[source]
SetZone(zone)[source]
_LonLatToUTM__Convert2D(lon, lat, elev)

Converts 2D Lon Lat coords to 2D XY UTM points

Points to Tube

class PVGeo.filters.xyz.PointsToTube(**kwargs)[source]

Bases: PVGeo.filters.xyz.AddCellConnToPoints

Takes points from a vtkPolyData object and constructs a line of those points then builds a polygonal tube around that line with some specified radius and number of sides.

SetCapping(flag)[source]
SetNumberOfSides(num)[source]

Set the number of sides (resolution) for the tube

SetRadius(radius)[source]

Set the radius of the tube

_ConnectCells(pdi, pdo, logTime=False)[source]

This uses the parent’s _ConnectCells() to build a tub around

Rotate Points

class PVGeo.filters.xyz.RotatePoints(angle=45.0, origin=[0.0, 0.0], useCorner=True)[source]

Bases: PVGeo.base.FilterBase

Rotates XYZ coordinates in vtkPolyData around an origin at a given angle on the XY plane.

RequestData(request, inInfo, outInfo)[source]

Used by pipeline to generate output.

SetOrigin(xo, yo)[source]

Sets the origin to perform the rotate around.

SetRotationDegrees(theta)[source]

Sets the rotational angle in degrees.

SetUseCorner(flag)[source]

A flag to use a corner of the input data set as the rotational origin.

Rotation Tool

class PVGeo.filters.xyz.RotationTool(decimals=6)[source]

Bases: object

A class that holds a set of methods/tools for performing and estimating coordinate rotations.

static CosBetween(pts)[source]

Gets the cosine between two points

static DistanceBetween(pts)[source]

Gets the distance between two points

EstimateAndRotate(x, y, z)[source]

A method to estimate the rotation of a set of points and correct that rotation on the XY plane

static Rotate(pts, theta)[source]

Rotate points around (0,0,0) given an anlge on the XY plane

static RotateAround(pts, theta, origin)[source]

Rotate points around an origins given an anlge on the XY plane

static RotationMatrix(vector_orig, vector_fin)[source]

Calculate the rotation matrix required to rotate from one vector to another. For the rotation of one vector to another, there are an infinit series of rotation matrices possible. Due to axially symmetry, the rotation axis can be any vector lying in the symmetry plane between the two vectors. Hence the axis-angle convention will be used to construct the matrix with the rotation axis defined as the cross product of the two vectors. The rotation angle is the arccosine of the dot product of the two unit vectors. Given a unit vector parallel to the rotation axis, w = [x, y, z] and the rotation angle a, the rotation matrix R is:

    |  1 + (1-cos(a))*(x*x-1)   -z*sin(a)+(1-cos(a))*x*y   y*sin(a)+(1-cos(a))*x*z |
R = |  z*sin(a)+(1-cos(a))*x*y   1 + (1-cos(a))*(y*y-1)   -x*sin(a)+(1-cos(a))*y*z |
    | -y*sin(a)+(1-cos(a))*x*z   x*sin(a)+(1-cos(a))*y*z   1 + (1-cos(a))*(z*z-1)  |
Parameters:
  • vector_orig (umpy array, len 3) – The unrotated vector defined in the reference frame.
  • vector_fin (numpy array, len 3) – The rotated vector defined in the reference frame.

Note

This code was adopted from printipi under the MIT license.

static SinBetween(pts)[source]
_ConvergeAngle(pt1, pt2)[source]

Internal use only: pts should only be a two neighboring points.

_EstimateAngleAndSpacing(pts, sample=0.5)[source]

internal use only

static _GetRotationMatrix(theta)[source]