Genie2D

Module Contents

Classes

Genie2D

Base class for 2D geometric shape representation.

class Genie2D.Genie2D(verbose=False)

Bases: lsdo_genie.bsplines.BsplineSurface.BsplineSurface

Base class for 2D geometric shape representation.

Attributes:
verbosebool

Prints out information for troubleshooting

compute_errors()

Compute error values and print to terminal

compute_phi(pts: numpy.ndarray)

Compute the phi value at a set of points

Parameters:
ptsnp.ndarray(N,2)

Set of points to be evaluated

Returns:
phinp.ndarray(N,)

The phi values at each input point

config(domain: numpy.ndarray, max_control_points: int, min_ratio: float = 0.5, order: int = 4)

Set up the Bspline for non-interference constraints

Parameters:
domainnp.ndarray(2,2)

Lower and upper bounds in each dimension for the domain of interest

max_control_pointsint

Maximum number of control points along the longest dimension

min_ratiofloat

Minimum ratio from the shortest dimension to the longest dimension to maintain uniform control point spacing

orderint

Polynomial order of the Bspline

get_basis(loc='surf', du=0, dv=0)

Convenience function for building the basis matrix for different points

Parameters:
locstr

‘surf’ for surface points or ‘hess’ for quadrature points to evaluate the hessian

duint

Derivative in the ‘u’ direction

dvint

Derivative in the ‘v’ direction

Returns:
basissps.csc_matrix(N,Ncp)

The basis matrix that can be multiplied with the control points to get (N,) output values

gradient_phi(pts: numpy.ndarray)

Compute the phi value at a set of points

Parameters:
ptsnp.ndarray(N,2)

Set of points to be evaluated

Returns:
dpdxnp.ndarray(N,)

The derivative of phi with respect to the x-coordinate

dpdynp.ndarray(N,)

The derivative of phi with respect to the y-coordinate

initialize_control_points(k: int = 6, rho: float = 10)

Initialize the control points using Hicken and Kaur’s explicit method

Parameters:
kint

Numer of nearest neighbors to include in the function

rhofloat

Smoothing parameter

Returns:
cpsnp.ndarray(Ncp,3)

The initial control points with (x,y,phi) values at each point

input_point_cloud(surface_points: numpy.ndarray = None, surface_normals: numpy.ndarray = None)

Input the point cloud data

Parameters:
surface_pointsnp.ndarray(N,2)

Positional data of the points in a point cloud

surface_normalsnp.ndarray(N,2)

Normal vectors of the points in a point cloud

solve_energy_minimization(Lp: float = 1.0, Ln: float = 1.0, Lr: float = 0.001, maxiter=None)

Solve the energy minimization problem

Parameters:
Lpfloat

Depricated weighting parameter for zero level set point energy term

Lnfloat

Weighting parameter for the normal vectors energy term

Lrfloat

Weighting parameter for the regularization energy term

spatial_to_parametric(pts: numpy.ndarray)

Convert (x,y) coordinates to (u,v) coordinates

Parameters:
ptsnp.ndarray(N,2)

The points to convert to parametric coordinates

Returns:
unp.ndarray(N,)

The ‘u’ parametric coordinates

vnp.ndarray(N,)

The ‘v’ parametric coordinates

visualize(res: int = 300)

Visualize the isocontours, control points in 3D, and phi values along the x-y axes

Parameters:
resint

The resolution in each dimension to evaluate the function for visualization