The coords module defines the Coords class, which is the basic data structure in pyFormex to store the coordinates of points in a 3D space.
This module implements a data class for storing large sets of 3D coordinates and provides an extensive set of methods for transforming these coordinates. Most of pyFormex’s classes which represent geometry (e.g. Geometry, Formex, Mesh, TriSurface, Curve) use a Coords object to store their coordinates, and thus inherit all the transformation methods of this class.
While the user will mostly use the higher level classes, he might occasionally find good reason to use the Coords class directly as well.
Classes defined in module coords
A structured collection of points in a 3D cartesian space.
The Coords class is the basic data structure used throughout pyFormex to store coordinates of points in a 3D space. It is used by other classes, such as Formex and Surface, which thus inherit the same transformation capabilities. Applications will mostly use the higher level classes, which usually have more elaborated consistency checking and error handling.
Coords is implemented as a subclass of numpy.ndarray, and thus inherits all its methods. The last axis of the Coords always has a length equal to 3. Each set of 3 values along the last axis represents a single point in 3D cartesian space. The float datatype is only checked at creation time. It is the responsibility of the user to keep this consistent throughout the lifetime of the object.
A new Coords object is created with the following syntax
Coords(data=None,dtyp=Float,copy=False)
Parameters:
Example:
>>> Coords([1.,0.])
Coords([ 1., 0., 0.], dtype=float32)
Returns the Coords object as a simple set of points.
This reshapes the array to a 2-dimensional array, flattening the structure of the points.
Returns the shape of the Coords object.
This is the shape of the NumPy array with the last axis removed. The full shape of the Coords array can be obtained from its shape attribute.
Return the total number of points.
Return the total number of points.
Returns the X-coordinates of all points.
Returns an array with all the X-coordinates in the Coords. The returned array has the same shape as the Coords array along its first ndim-1 axes. This is equivalent with
asarray(self[...,0])
Return the Y-coordinates of all points.
Returns an array with all the Y-coordinates in the Coords. The returned array has the same shape as the Coords array along its first ndim-1 axes. This is equivalent with
asarray(self[...,1])
Returns the Z-coordinates of all points.
Returns an array with all the Z-coordinates in the Coords. The returned array has the same shape as the Coords array along its first ndim-1 axes. This is equivalent with
asarray(self[...,2])
Returns the bounding box of a set of points.
The bounding box is the smallest rectangular volume in the global coordinates, such that no point of the Coords are outside that volume.
Returns a Coords object with shape(2,3): the first point contains the minimal coordinates, the second has the maximal ones.
Example:
>>> X = Coords([[[0.,0.,0.],[3.,0.,0.],[0.,3.,0.]]])
>>> print(X.bbox())
[[ 0. 0. 0.]
[ 3. 3. 0.]]
Returns an alignment point of a Coords.
Alignment point are points whose coordinates are either the minimal value, the maximal value or the middle value for the Coords. Combining the three values with the three dimensions, a Coords has in 27 (3**3) alignment points. The corner points of the bounding box are a subset of these.
The 27 points are addressed by an alignment string of three characters, one for each direction. Each character should be one of the following
Any other character will set the corresponding coordinate to zero.
A string ‘000’ is equivalent with center(). The values ‘—’ and ‘+++’ give the points of the bounding box.
Example:
>>> X = Coords([[[0.,0.,0.],[1.,1.,1.]]])
>>> print(X.apt('-0+'))
[ 0. 0.5 1. ]
Returns the center of the Coords.
The center of a Coords is the center of its bbox(). The return value is a (3,) shaped Coords object.
Example:
>>> X = Coords([[[0.,0.,0.],[3.,0.,0.],[0.,3.,0.]]])
>>> print(X.center())
[ 1.5 1.5 0. ]
See also: centroid()
Returns a (weighted) average of the Coords.
The average of a Coords is a Coords with one axis less than the original, obtained by averaging all the points along that axis. The weights array can either be 1-D (in which case its length must be the size along the given axis) or of the same shape as a. Weights can be specified as a 1-D array with the length of that axis, or as an array with the same shape as the Coords. The sum of the weights (along the specified axis if not 1-D) will generally be equal to 1.0. If wts=None, then all points are assumed to have a weight equal to one divided by the length of the specified axis.
Example:
>>> X = Coords([[[0.,0.,0.],[1.,0.,0.],[2.,0.,0.]], [[4.,0.,0.],[5.,0.,0.],[6.,0.,0.]]])
>>> print(X.average())
[[ 2. 0. 0.]
[ 3. 0. 0.]
[ 4. 0. 0.]]
>>> print(X.average(axis=1))
[[ 1. 0. 0.]
[ 5. 0. 0.]]
>>> print(X.average(wts=[0.5,0.25,0.25],axis=1))
[[ 0.75 0. 0. ]
[ 4.75 0. 0. ]]
Returns the centroid of the Coords.
The centroid of a Coords is the point whose coordinates are the mean values of all points. The return value is a (3,) shaped Coords object.
Example:
>>> print(Coords([[[0.,0.,0.],[3.,0.,0.],[0.,3.,0.]]]).centroid())
[ 1. 1. 0.]
See also: center()
Returns the sizes of the Coords.
Returns an array with the length of the bbox along the 3 axes.
Example:
>>> print(Coords([[[0.,0.,0.],[3.,0.,0.],[0.,3.,0.]]]).sizes())
[ 3. 3. 0.]
Returns an estimate of the global size of the Coords.
This estimate is the length of the diagonal of the bbox().
Example:
>>> print(Coords([[[0.,0.,0.],[3.,0.,0.],[0.,3.,0.]]]).dsize())
4.24264
Returns the diameter of the bounding sphere of the Coords.
The bounding sphere is the smallest sphere with center in the center() of the Coords, and such that no points of the Coords are lying outside the sphere.
Example:
>>> print(Coords([[[0.,0.,0.],[3.,0.,0.],[0.,3.,0.]]]).bsphere())
2.12132024765
Returns the bboxes of all elements in the coords array.
The returned array has shape (...,2,3). Along the -2 axis are stored the minimal and maximal values of the Coords along that axis.
Returns inertia related quantities of the Coords.
Parameters:
Returns a tuple of:
Returns the distance of all points from the plane (p,n).
Parameters:
The return value is a float array with shape self.pshape() with the distance of each point to the plane through p and having normal n. Distance values are positive if the point is on the side of the plane indicated by the positive normal.
Example:
>>> X = Coords([[[0.,0.,0.],[3.,0.,0.],[0.,3.,0.]]])
>>> print(X.distanceFromPlane([0.,0.,0.],[1.,0.,0.]))
[[ 0. 3. 0.]]
Returns the distance of all points from the line (p,n).
p,n are (1,3) or (npts,3) arrays defining 1 or npts lines
Parameters:
The return value is a [...] shaped array with the distance of each point to the line through p with direction n. All distance values are positive or zero.
Example:
>>> X = Coords([[[0.,0.,0.],[3.,0.,0.],[0.,3.,0.]]])
>>> print(X.distanceFromLine([0.,0.,0.],[1.,0.,0.]))
[[ 0. 0. 3.]]
Returns the distance of all points from the point p.
p is a single point specified by 3 coordinates.
The return value is a [...] shaped array with the distance of each point to point p. All distance values are positive or zero.
Example:
>>> X = Coords([[[0.,0.,0.],[3.,0.,0.],[0.,3.,0.]]])
>>> print(X.distanceFromPoint([0.,0.,0.]))
[[ 0. 3. 3.]]
Returns the point closest to point p.
Returns the extreme distances from the plane p,n.
Parameters:
The return value is a tuple of two float values specifying the extreme distances from the plane p,n.
Returns extremal planes in the direction n.
n and p have the same meaning as in directionalSize.
The return value is a list of two points on the line (p,n), such that the planes with normal n through these points define the extremal planes of the Coords.
Returns the width of a Coords in the given direction.
The direction can be specified by a 3 component vector or by a single integer 0..2 designating one of the coordinate axes.
The return value is the thickness of the object in the direction n.
Flag points having coordinates between min and max.
Tests the position of the points of the Coords with respect to one or two planes. This method is very convenient in clipping a Coords in a specified direction. In most cases the clipping direction is one of the global cooordinate axes, but a general direction may be used as well.
Parameters:
Returns:
A 1D integer array with same length as the number of points. For each point the value is 1 (True) if the point is above the minimum clipping plane and below the maximum clipping plane, or 0 (False) otherwise. An unspecified clipping plane corresponds with an infinitely low or high value. The return value can directly be used as an index to obtain a Coords with the points satisfying the test (or not). See the examples below.
Example:
>>> x = Coords([[0.,0.],[1.,0.],[0.,1.],[0.,2.]])
>>> print(x.test(min=0.5))
[False True False False]
>>> t = x.test(dir=1,min=0.5,max=1.5)
>>> print(x[t])
[[ 0. 1. 0.]]
>>> print(x[~t])
[[ 0. 0. 0.]
[ 1. 0. 0.]
[ 0. 2. 0.]]
Formatted printing of a Coords object.
The supplied format should contain 3 formatting sequences for the three coordinates of a point.
Set the coordinates from those in the given array.
Returns a copy scaled with scale[i] in direction i.
The scale should be a list of 3 scaling factors for the 3 axis directions, or a single scaling factor. In the latter case, dir (a single axis number or a list) may be given to specify the direction(s) to scale. The default is to produce a homothetic scaling. The center of the scaling, if not specified, is the global origin. If a center is specified, the result is equivalent to:
self.translate(-center).scale(scale,dir).translate(center)
Example:
>>> print(Coords([1.,1.,1.]).scale(2))
[ 2. 2. 2.]
>>> print(Coords([1.,1.,1.]).scale([2,3,4]))
[ 2. 3. 4.]
Translate a Coords object.
Translates the Coords in the direction dir over a distance step * length(dir).
Parameters:
Example:
>>> x = Coords([1.,1.,1.])
>>> print(x.translate(1))
[ 1. 2. 1.]
>>> print(x.translate(1,1.))
[ 1. 2. 1.]
>>> print(x.translate([0,1,0]))
[ 1. 2. 1.]
>>> print(x.translate([0,2,0],0.5))
[ 1. 2. 1.]
Returns a centered copy of the Coords.
Returns a Coords which is a translation thus that the center coincides with the origin. This is equivalent with:
self.trl(-self.center())
Align a Coords on a given point.
Alignment involves a translation such that the bounding box of the Coords object becomes aligned with a given point. By default this is the origin of the global axes. The requested alignment is determined by a string of three characters, one for each of the coordinate axes. The character determines how the structure is aligned in the corresponding direction:
Any other value will make the alignment in that direction unchanged.
The default alignment string '---' results in a translation which puts all the points in the octant with all positive coordinate values. A string '000' will center the object around the origin, just like the (slightly faster) centered() method.
See also the coords.align() function.
Returns a copy rotated over angle around axis.
The angle is specified in degrees. The axis is either one of (0,1,2) designating the global axes, or a vector specifying an axis through the origin. If no axis is specified, rotation is around the 2(z)-axis. This is convenient for working on 2D-structures.
As a convenience, the user may also specify a 3x3 rotation matrix, in which case the function rotate(mat) is equivalent to affine(mat).
All rotations are performed around the point [0.,0.,0.], unless a rotation origin is specified in the argument ‘around’.
Returns a copy skewed in the direction dir of plane (dir,dir1).
The coordinate dir is replaced with (dir + skew * dir1).
Reflect the coordinates in direction dir against plane at pos.
Parameters:
Perform a general affine transformation.
Parameters:
The returned object has coordinates given by self * mat + vec. If mat is a rotation matrix, than the operation performs a rigid rotation of the object plus a translation.
Position an object so that points x are aligned with y.
Parameters are as for arraytools.trfMatrix()
Converts from cylindrical to cartesian after scaling.
Parameters:
The resulting angle is interpreted in degrees.
Converts from cartesian to cylindrical coordinates.
Parameters:
The angle value is given in degrees.
Converts from spherical to cartesian after scaling.
Parameters:
Angles are interpreted in degrees. Latitude, i.e. the elevation angle, is measured from equator in direction of north pole(90). South pole is -90.
If colat=True, the third coordinate is the colatitude (90-lat) instead.
Performs a superspherical transformation.
superSpherical is much like spherical, but adds some extra parameters to enable the creation of virtually any surface.
Just like with spherical(), the input coordinates are interpreted as the longitude, latitude and distance in a spherical coordinate system.
Parameters:
Converts from cartesian to spherical coordinates.
Parameters:
The returned angle values are given in degrees.
Returns a Coords with a one-dimensional bump.
Parameters:
Returns a Coords with a two-dimensional bump.
Parameters:
Returns a Coords with a bump.
A bump is a modification of a set of coordinates by a non-matching point. It can produce various effects, but one of the most common uses is to force a surface to be indented by some point.
Parameters:
Create a flare at the end of a Coords block.
The flare extends over a distance xf at the start (end=0) or end (end=1) in direction dir[0] of the coords block, and has a maximum amplitude of f in the dir[1] direction.
Map a Coords by a 3-D function.
This is one of the versatile mapping functions.
Parameters:
The function must be applicable to arrays, so it should only include numerical operations and functions understood by the numpy module. This method is one of several mapping methods. See also map1 and mapd.
Example:
>>> print(Coords([[1.,1.,1.]]).map(lambda x,y,z: [2*x,3*y,4*z]))
[[ 2. 3. 4.]]
Map one coordinate by a 1-D function of one coordinate.
Parameters:
The function must be applicable on arrays, so it should only include numerical operations and functions understood by the numpy module. This method is one of several mapping methods. See also map and mapd.
Map one coordinate by a function of the distance to a point.
Parameters:
This method is one of several mapping methods. See also map3() and map1().
Example:
E.mapd(2,lambda d:sqrt(10**2-d**2),E.center(),[0,1])
maps E on a sphere with radius 10.
Maps the coordinates to an egg-shape
Replace the coordinates along the axes i by those along j.
i and j are lists of axis numbers or single axis numbers. replace ([0,1,2],[1,2,0]) will roll the axes by 1. replace ([0,1],[1,0]) will swap axes 0 and 1. An optionally third argument may specify another Coords object to take the coordinates from. It should have the same dimensions.
Swap coordinate axes i and j.
Beware! This is different from numpy’s swapaxes() method !
Roll the axes over the given amount.
Default is 1, thus axis 0 becomes the new 1 axis, 1 becomes 2 and 2 becomes 0.
Project a Coords on a plane (or planes).
Parameters:
Note
For planes parallel to a coordinate plane, it is far more efficient to specify the normal by an axis number than by a three component vector.
Note
This method will also work if any or both of P and n have a shape (ncoords,3), where ncoords is the total number of points in the Coords. This allows to project each point on an individual plane.
Returns a Coords with same shape as original, with all the points projected on the specified plane(s).
Project Coords on a sphere.
The default sphere is a unit sphere at the origin. The center of the sphere should not be part of the Coords.
Project Coords on a cylinder with axis parallel to a global axis.
The default cylinder has its axis along the x-axis and a unit radius. No points of the Coords should belong to the axis..
Project the Coords on a triangulated surface.
The points of the Coords are projected in the specified direction dir onto the surface S.
Parameters:
Returns:
A Coords with the same shape as the input. If return_indices is True, also returns an index of the points that have a projection on the surface. This index is a sequential one, no matter what the shape of the input Coords is.
Perform an isoparametric transformation on a Coords.
This is a convenience method to transform a Coords object through an isoparametric transformation. It is equivalent to:
Isopar(eltype,coords,oldcoords).transform(self)
See plugins.isopar for more details.
Perform a coordinate system transformation on the Coords.
This method transforms the Coords object by the transformation that turns the initial coordinate system into the current coordinate system.
currentCS and initialCS are (4,3) shaped Coords instances defining a coordinate system as described in CoordinateSystem. If initialCS is None, the global (x,y,z) axes are used.
E.g. the default initialCS and currentCS equal to:
0. 1. 0.
-1. 0. 0.
0. 0. 1.
0. 0. 0.
result in a rotation of 90 degrees around the z-axis.
This is a convenience function equivalent to:
self.isopar('tet4',currentCS,initialCS)
Add random noise to a Coords.
A random amount is added to eacho individual coordinate in the Coords. The difference of any coordinate from its original value will not be r than asize+rsize*self.sizes().max(). The default is to set it to 0.05 times the geometrical size of the structure.
Replicate a Coords n times with fixed step in any direction.
Returns a Coords object with shape (n,) + self.shape, thus having an extra first axis. Each component along the axis 0 is equal to the previous component translated over (dir,step), where dir and step are interpreted just like in the translate() method. The first component along the axis 0 is identical to the original Coords.
Split the coordinate array in blocks along first axis.
The result is a sequence of arrays with shape self.shape[1:]. Raises an error if self.ndim < 2.
Sort points in the specified order of their coordinates.
The points are sorted based on their coordinate values. There is a maximum number of points (above 2 million) that can be sorted. If you need to to sort more, first split up your data according to the first axis.
Parameters:
Returns:
An int array which is a permutation of range(self.npoints()). If taken in the specified order, it is guaranteed that no point can have a coordinate that is larger that the corresponding coordinate of the next point.
Create a grid of equally sized boxes spanning the points x.
A regular 3D grid of equally sized boxes is created spanning all the points x. The size, position and number of boxes are determined from the specified parameters.
Parameters:
Returns a tuple of:
Find (almost) identical nodes and return a compressed set.
This method finds the points that are very close and replaces them with a single point.
Returns a tuple of two arrays:
The procedure works by first dividing the 3D space in a number of equally sized boxes, with a mean population of ppb. The boxes are numbered in the 3 directions and a unique integer scalar is computed, that is then used to sort the nodes. Then only nodes inside the same box are compared on almost equal coordinates, using the numpy allclose() function. Two coordinates are considered close if they are within a relative tolerance rtol or absolute tolerance atol. See numpy for detail. The default atol is set larger than in numpy, because pyformex typically runs with single precision. Close nodes are replaced by a single one.
Running the procedure once does not guarantee to find all close nodes: two close nodes might be in adjacent boxes. The performance hit for testing adjacent boxes is rather high, and the probability of separating two close nodes with the computed box limits is very small. Therefore, the most sensible way is to run the procedure twice, with a different shift value (they should differ more than the tolerance). Specifying repeat=True will automatically do this.
Match points form another Coords object.
This method finds the points from coords that coincide with (or are very close to) points of self.
Parameters:
This method works by concatenating the serialized point sets of both Coords and then fusing them.
Returns:
Append coords to a Coords object.
The appended coords should have matching dimensions in all but the first axis.
Returns the concatenated Coords object, without changing the current.
This is comparable to numpy.append(), but the result is a Coords object, the default axis is the first one instead of the last, and it is a method rather than a function.
Concatenate a list of Coords object.
All Coords object in the list L should have the same shape except for the length of the specified axis. This function is equivalent to the numpy concatenate, but makes sure the result is a Coords object,and the default axis is the first one instead of the last.
The result is at least a 2D array, even when the list contains a single Coords with a single point.
>>> X = Coords([1.,1.,0.])
>>> Y = Coords([[2.,2.,0.],[3.,3.,0.]])
>>> print(Coords.concatenate([X,Y]))
[[ 1. 1. 0.]
[ 2. 2. 0.]
[ 3. 3. 0.]]
>>> print(Coords.concatenate([X,X]))
[[ 1. 1. 0.]
[ 1. 1. 0.]]
>>> print(Coords.concatenate([Y]))
[[ 2. 2. 0.]
[ 3. 3. 0.]]
>>> print(Coords.concatenate([X]))
[[ 1. 1. 0.]]
Create a Coords object with data from a string.
This convenience function uses the numpy.fromstring() function to read coordinates from a string.
Parameters:
The return value is Coords object.
Read a Coords from file.
This convenience function uses the numpy fromfile function to read the coordinates from file. You just have to make sure that the coordinates are read in order (X,Y,Z) for subsequent points, and that the total number of coordinates read is a multiple of 3.
Create interpolations between two Coords.
Parameters:
Returns:
A Coords with an extra (first) axis, containing the concatenation of the interpolations of self and X at all values in div. Its shape is (n,) + self.shape, where n is the number of values in div.
An interpolation of F and G at value v is a Coords H where each coordinate Hijk is obtained from: Fijk = Fijk + v * (Gijk-Fijk). Thus, X.interpolate(Y,[0.,0.5,1.0]) will contain all points of X and Y and all points with mean coordinates between those of X and Y.
F.interpolate(G,n) is equivalent with F.interpolate(G,arange(0,n+1)/float(n))
Returns a copy rotated over angle around axis.
The angle is specified in degrees. The axis is either one of (0,1,2) designating the global axes, or a vector specifying an axis through the origin. If no axis is specified, rotation is around the 2(z)-axis. This is convenient for working on 2D-structures.
As a convenience, the user may also specify a 3x3 rotation matrix, in which case the function rotate(mat) is equivalent to affine(mat).
All rotations are performed around the point [0.,0.,0.], unless a rotation origin is specified in the argument ‘around’.
Translate a Coords object.
Translates the Coords in the direction dir over a distance step * length(dir).
Parameters:
Example:
>>> x = Coords([1.,1.,1.])
>>> print(x.translate(1))
[ 1. 2. 1.]
>>> print(x.translate(1,1.))
[ 1. 2. 1.]
>>> print(x.translate([0,1,0]))
[ 1. 2. 1.]
>>> print(x.translate([0,2,0],0.5))
[ 1. 2. 1.]
Replicate a Coords n times with fixed step in any direction.
Returns a Coords object with shape (n,) + self.shape, thus having an extra first axis. Each component along the axis 0 is equal to the previous component translated over (dir,step), where dir and step are interpreted just like in the translate() method. The first component along the axis 0 is identical to the original Coords.
Functions defined in module coords
Compute the bounding box of a list of objects.
The bounding box of an object is the smallest rectangular cuboid in the global Cartesian coordinates, such that no points of the objects lie outside that cuboid. The resulting bounding box of the list of objects is the smallest bounding box that encloses all the objects in the list. Objects that do not have a bbox() method or whose bbox() method returns invalid values, are ignored.
Parameters:
Returns:
A Coords object with two points: the first contains the minimal coordinate values, the second has the maximal ones of the overall bounding box.
Example:
>>> from formex import *
>>> bbox([Coords([-1.,1.,0.]),Formex('l:5')])
Coords([[-1., 0., 0.],
[ 1., 1., 0.]], dtype=float32)
Compute the intersection of the bounding box of two objects.
A and B are objects having a bbox method. The intersection of the two bounding boxes is returned in boox format.
Test which part of A is inside a given bbox, applied in directions dirs.
Parameters:
The result is a bool array flagging the elements that are inside the given bounding box.
Return a single point with coordinates [0.,0.,0.].
Returns a Coords object with shape(3,) holding three zero coordinates.
Return a series of points lying on a regular grid.
This function creates a series of points that lie on a regular grid with unit step. These points are created from a string input, interpreting each character as a code specifying how to move to the next point. The start position is always the origin (0.,0.,0.).
Currently the following codes are defined:
Any other character raises an error.
When looking at the x,y-plane with the x-axis to the right and the y-axis up, we have the following basic moves: 1 = East, 2 = North, 3 = West, 4 = South, 5 = NE, 6 = NW, 7 = SW, 8 = SE.
Adding 16 to the ordinal of the character causes an extra move of +1. in the z-direction. Adding 48 causes an extra move of -1. This means that ‘ABCDEFGHI’, resp. ‘abcdefghi’, correspond with ‘123456789’ with an extra z +/-= 1. This gives the following schema:
z+=1 z unchanged z -= 1
F B E 6 2 5 f b e
| | |
| | |
C----I----A 3----9----1 c----i----a
| | |
| | |
G D H 7 4 8 g d h
The special character ‘/’ can be put before any character to make the move without inserting the new point. You need to start the string with a ‘0’ or ‘9’ to include the origin in the output.
Parameters:
Returns a Coords with the generated points (default) or a list of tuples with 3 integer coordinates (if aslist is True).
Example:
>>> print(pattern('0123'))
[[ 0. 0. 0.]
[ 1. 0. 0.]
[ 1. 1. 0.]
[ 0. 1. 0.]]
Create a Coords object from a string pattern.
This is like pattern, but allows grouping the points into elements. First, the string is expanded to a list of points by calling pattern(s). Then the resulting list of points is transformed in a 2D table of points where each row has the length nplex.
If the number of points produced by s is not a multiple of nplex, an error is raised.
Example:
>>> print(xpattern('.12.34',3))
[[[ 0. 0. 0.]
[ 1. 0. 0.]
[ 1. 1. 0.]]
[[ 1. 1. 0.]
[ 0. 1. 0.]
[ 0. 0. 0.]]]
Align a list of geometrical objects.
L is a list of geometrical objects (Coords or Geometry or subclasses thereof) and thus having an appropriate align method. align is a string of three characters, one for each coordinate direction, defining how the subsequent objects have to be aligned in that direction:
E.g., the string '|--' will juxtapose the objects in the x-direction, while aligning them on their minimal coordinates in the y- and z- direction.
An offset may be specified to create a space between the object, instead of juxtaposing them.
Returns: a list with the aligned objects.
Sweep a Coords object along a path, returning a series of copies.
origin and normal define the local path position and direction on the mesh.
At each point of the curve, a copy of the Coords object is created, with its origin in the curve’s point, and its normal along the curve’s direction. In case of a PolyLine, directions are pointing to the next point by default. If avgdir==True, average directions are taken at the intermediate points avgdir can also be an array like sequence of shape (N,3) to explicitely set the the directions for ALL the points of the path
Missing end directions can explicitely be set by enddir, and are by default taken along the last segment. enddir is a list of 2 array like values of shape (3). one of the two can also be an empty list If the curve is closed, endpoints are treated as any intermediate point, and the user should normally not specify enddir.
At each point of the curve, the original Coords object can be scaled in x and y direction by specifying scalex and scaley. The number of values specified in scalex and scaly should be equal to the number of points on the curve.
The return value is a sequence of the transformed Coords objects.