surface_poly_fit.core.MongeJetFitter¶
- class surface_poly_fit.core.MongeJetFitter[source]¶
Bases:
MongeJetFitter
Fits Monge polynomial to
PolyhedralSurface
patch vertices.FittingBasisType Descriptions¶
The
MongeJetFitter.fit_at_vertex()
andMongeJetFitter.fit_all()
methods take afit_basis_type
argument which specifies how the polynomial fitting coordinate system (fitting-basis) is calculated for a polyhedral-surface-patch:MongeJetFitter.PCA
Uses Principal Component Analysis of the patch coordinates with the smallest component assigned to the \(z\) direction and the largest component the \(x\) direction.
MongeJetFitter.VERTEX_NORMAL
Use the vertex-normal as the polynomial fitting coordinate system \(z\) direction.
MongeJetFitter.RING_NORMAL_MEAN
Use mean of all surface-patch vertex-normals as the polynomial fitting coordinate system \(z\) direction.
MongeJetFitter.RING_NORMAL_GAUSSIAN_WEIGHTED_MEAN
Use a Gaussian-weighted-mean of all surface-patch vertex-normals as the polynomial fitting coordinate system \(z\) direction. The sigma used for calculating the Gaussian weights is
num_rings / 3.0
.MongeJetFitter.RING_NORMAL_GAUSSIAN_WEIGHTED_MEAN_SIGMA
Use a Gaussian-weighted-mean of all surface-patch vertex-normals as the polynomial fitting coordinate system \(z\) direction. The sigma used for calculating the Gaussian weights is
MongeJetFitter.ring_normal_gaussian_sigma
.
Fitting Result Array Field Definitions¶
The
MongeJetFitter.fit_at_vertex()
andMongeJetFitter.fit_all()
return anumpy
structured array with fields:- “vertex_index” (
numpy.int64
) The index of the vertex at which polynomial fitting was performed.
- “degree_monge” (
numpy.uint8
) The degree of the Monge polynomial (converted from the fitting polynomial).
- “degree_poly_fit” (
numpy.uint8
) The degree of the fitting polynomial.
- “num_rings” (
numpy.int64
) The number of ring neighbours defining the polynomial fitting coordinates.
- “num_fitting_points” (
numpy.int64
) The number of neighbour coordinates (neighbours) in the “num_rings” neighbourhood. This is the number of coordinates used to fit the polynomial.
- “poly_fit_condition_number” (
numpy.float64
) The polynomial fitting matrix condition number.
- “pca_eigenvalues” (
numpy.float64
) A
(3,)
shaped array. IfMongeJetFitter.PCA
is used for the fitting basis determination, then these are the eigenvalues of the principal component analysis (otherwise all values arenumpy.nan
).- “poly_fit_basis” (
numpy.float64
) A
(3, 3)
shaped rotation matrix, indicating the orientation of the polynomial fitting coordinate-system (basis).- “poly_fit_residual_stats” (
numpy.dtype
) A struct containing statistics on the polynomial fitting residual values. See residual stats description.
- “poly_fit_bounding_area” (
numpy.dtype
) A struct containing info about 2D bounding areas of the fitting coordinates. See bounding area description.
- “origin” (
numpy.float64
) A
(3,)
shaped array indicating the Monge polynomial origin coordinate. The Monge polynomial intersects this coordinate. Note that the “vertex_index” coordinate is the origin of the fitting-coordinate-system.- “direction” (
numpy.float64
) A
(3, 3)
shaped rotation matrixR
, where columnsR[:, 0]
andR[:, 1]
are the principal curvature directions, and whereR[:, 2]
is outward facing and orthogonal toR[:, 0]
andR[:, 1]
.- “k” (
numpy.float64
) A
(2,)
shaped array of the principal curvature magnitudes.- “b” (
numpy.float64
) A
(4,)
shaped array,b[0]
andb[3]
are the directional derivatives ofk[0]
andk[1]
along their respective curvature line.b[1]
andb[2]
are the directional derivatives ofk[0]
andk[1]
along the other curvature lines.- “c” (
numpy.float64
) A
(5,)
shaped array of higher order derivatives of curvature.
The “poly_fit_residual_stats” structure contains residual statistics and has fields:
- “min” (
numpy.float64
) Minimum residual value.
- “max” (
numpy.float64
) Maximum residual value.
- “mean” (
numpy.float64
) Mean residual value.
- “median” (
numpy.float64
) Median residual value.
- “min_abs” (
numpy.float64
) Minimum absolute residual value.
- “max_abs” (
numpy.float64
) Maximum absolute residual value.
- “mean_abs” (
numpy.float64
) Mean absolute residual value.
- “median_abs” (
numpy.float64
) Median absolute residual value.
- “stdd” (
numpy.float64
) Standard deviation residual value.
The “poly_fit_bounding_area” structure has 2D bounding area info in fields:
- “rectangle_min_side_length” (
numpy.float64
) Minimum oriented bounding rectangle smallest side length.
- “rectangle_max_side_length” (
numpy.float64
) Minimum oriented bounding rectangle largest side length.
- “circle_radius” (
numpy.float64
) Minimum bounding circle radius.
- “ellipse_min_radius” (
numpy.float64
) Minimum oriented bounding ellipse smallest radius.
- “ellipse_max_radius” (
numpy.float64
) Minimum oriented bounding ellipse largest radius.
Methods
__init__
(self, poly_surface[, ...])Construct.
convert_result_to_point_data
(result_array)Convert the
result_array
record array to a point-datadict
suitable formeshio.Mesh.point_data
.fit_all
(self, num_rings, fit_basis_type)Fits a polynomial surface to the neigbourhoods of all vertices.
fit_at_vertex
(self, vertex_index, num_rings, ...)Fits a polynomial surface to the neigbourhood of vertices of vertex with index
vertex_index
.get_field_data
(result_array)Returns a
dict
which can be used asmeshio.Mesh.field_data
.to_meshio_mesh
(result_array)Return a
meshio.Mesh
version of the surface with point-data assigned from theresult_array
.Attributes
An
int
indicating the degree of the Monge polynomial.An
int
indicating the degree of the fitting polynomial.An
int
indicating the minimum number of points (vertex coordinates) required to fit a polynomial of degreedegree_poly_fit
.Polynomial patch vertex fitting performed on this
PolyhedralSurface
.The sigma
float
value used to calculate Gaussian weights when determining the polynomial fitting basis \(z\) direction.