The TriSurface class has this constructor:
) |
The surface contains ntri triangles, each having 3 vertices with 3 coordinates. The surface can be initialized from one of the following: - a (ntri,3,3) shaped array of floats ; - a 3-plex Formex with ntri elements ; - an (ncoords,3) float array of vertex coordinates and an (ntri,3) integer array of vertex numbers ; - an (ncoords,3) float array of vertex coordinates, an (nedges,2) integer array of vertex numbers, an (ntri,3) integer array of edges numbers.
Internally, the surface is stored in a (coords,edges,faces) tuple.
TriSurface objects have the following methods:
) |
elems) |
) |
This function should be called after one of the data fields have been changed.
) |
Normally, the surface definition can hold nodes that are not used in the edge/facet tables. They do however influence the bounding box of the surface. This method will remove all the unconnected nodes.
S) |
This just merges the data sets, and does not check whether the surfaces intersect or are connected! This is intended mostly for use inside higher level functions.
) |
) |
) |
) |
) |
) |
) |
) |
If an index is given, only the specified faces are retained.
idx,compress=True) |
idx can be a single element number or a list of numbers or any other index mechanism accepted by numpy's ndarray By default, the vertex list will be compressed to hold only those used in the selected elements. Setting compress==False will keep all original nodes in the surface.
p=None) |
A property array is a rank-1 integer array with dimension equal to the number of elements in the TriSurface. You can specify a single value or a list/array of integer values. If the number of passed values is less than the number of elements, they wil be repeated. If you give more, they will be ignored.
If a value None is given, the properties are removed from the TriSurface.
) |
) |
) |
) |
) |
) |
) |
) |
) |
) |
) |
) |
) |
The centroid of an element is the point whose coordinates are the mean values of all points of the element. The return value is an (nfaces,3) shaped Coords array.
None) |
None) |
None) |
nodes='all',dir=0,min=None,max=None) |
This function is very convenient in clipping a TriSurface in a specified direction. It returns a 1D integer array flagging (with a value 1 or True) the elements having nodal coordinates in the required range. Use where(result) to get a list of element numbers passing the test. Or directly use clip() or cclip() to create the clipped TriSurface
The test plane can be defined in two ways, depending on the value of dir. If dir == 0, 1 or 2, it specifies a global axis and min and max are the minimum and maximum values for the coordinates along that axis. Default is the 0 (or x) direction.
Else, dir should be compaitble with a (3,) shaped array and specifies the direction of the normal on the planes. In this case, min and max are points and should also evaluate to (3,) shaped arrays.
nodes specifies which nodes are taken into account in the comparisons. It should be one of the following: - a single (integer) point number (< the number of points in the Formex) - a list of point numbers - one of the special strings: 'all', 'any', 'none' The default ('all') will flag all the elements that have all their nodes between the planes x=min and x=max, i.e. the elements that fall completely between these planes. One of the two clipping planes may be left unspecified.
t) |
t should be a 1-D integer array with length equal to the number of elements of the TriSurface. The resulting TriSurface will contain all elements where t > 0.
t) |
) |
The normal vector in a point is the average of the normal vectors of the neighbouring triangles. The normal vectors are normalized.
distance=1.) |
All the nodes of the surface are translated over a specified distance along their normal vector. This creates a new congruent surface.
) |
clas,fn,ftype=None) |
If no file type is specified, it is derived from the filename extension. Currently supported file types: - .stl (ASCII or BINARY) - .gts - .off - .neu (Gambit Neutral) - .smesh (Tetgen)
This is a class method, not an instance method.
fname,ftype=None) |
If no filetype is given, it is deduced from the filename extension. If the filename has no extension, the 'gts' file type is used.
) |
None) |
This method is equivalent to the corresponding Coords method executed on the objects coordinates.
None) |
This method is equivalent to the corresponding Coords method executed on the objects coordinates.
None) |
This method is equivalent to the corresponding Coords method executed on the objects coordinates.
None) |
This method is equivalent to the corresponding Coords method executed on the objects coordinates.
None) |
This method is equivalent to the corresponding Coords method executed on the objects coordinates.
None) |
This method is equivalent to the corresponding Coords method executed on the objects coordinates.
) |
) |
The normal vectors are normalized. The area is always positive.
The values are returned and saved in the object.
) |
) |
) |
This will only be correct if the surface is a closed manifold.
) |
) |
) |
) |
) |
) |
) |
) |
) |
) |
The border elements are the edges having less than 2 connected elements. Returns True where edge is on the border.
) |
) |
The border nodes are the vertices belonging to the border edges. Returns a list of vertex numbers.
) |
) |
) |
method=0) |
Filling the border is done by adding a single point inside the border and connectin it with all border segments. This works well if the border is smooth and nearly planar.
) |
) |
The surface should be a manifold (max. 2 elements per edge). Edges with only one element get angles = 1.0.
) |
) |
) |
) |
) |
) |
) |
startat=0,okedges=None,front_increment=1) |
startat is an element number or list of numbers of the starting front. On first call, this function returns the starting front. Each next() call returns the next front. front_increment determines haw the property increases at each frontal step. There is an extra increment +1 at each start of a new part. Thus, the start of a new part can always be detected by a front not having the property of the previous plus front_increment.
startat=0,front_increment=1) |
startat is an element number or list of numbers of the starting front. On first call, this function returns the starting front. Each next() call returns the next front.
startat=0,nsteps=-1,okedges=None,front_increment=1) |
startat=0,nsteps=-1,front_increment=1) |
sel,mode='node',nsteps=1) |
p is a single element number or a list of numbers. The return value is a list of element numbers obtained by growing the front nsteps times. The mode argument specifies how a single frontal step is done: 'node' : include all elements that have a node in common, 'edge' : include all elements that have an edge in common.
okedges,firstprop=0,startat=0) |
okedges flags the edges where the two adjacent triangles are to be in the same part of the surface. startat is a list of elements that are in the first part. The partitioning is returned as a property type array having a value corresponding to the part number. The lowest property number will be firstprop
firstprop=0,startat=0) |
okedges flags the edges where the two adjacent triangles are to be in the same part of the surface. startat is a list of elements that are in the first part. The partitioning is returned as a property type array having a value corresponding to the part number. The lowest property number will be firstprop
) |
angle=180.,firstprop=0,startat=0) |
None) |
target,elemlist=None) |
n_iterations=2,lambda_value=0.5) |
n_iterations=2,lambda_value=0.5,alpha=0.,beta=0.2) |
verbose=False) |
base,verbose=False) |
min_edges=None,max_cost=None,mid_vertex=False,length_cost=False,max_fold=1.0,volume_weight=0.5,boundary_weight=0.5,shape_weight=0.0,progressive=False,log=False,verbose=False) |
max_edges=None,min_cost=None,log=False,verbose=False) |
lambda_value=0.5,n_iterations=2,fold_smoothing=None,verbose=False) |
surf,op,inter=False,check=False,verbose=False) |