yade.pack module¶
Creating packings and filling volumes defined by boundary representation or constructive solid geometry.
For examples, see
- yade.pack.SpherePack_toSimulation(self, rot=Matrix3(1, 0, 0, 0, 1, 0, 0, 0, 1), **kw)[source]¶
Append spheres directly to the simulation. In addition calling O.bodies.append, this method also appropriately sets periodic cell information of the simulation.
>>> from yade import pack; from math import * >>> sp=pack.SpherePack()
Create random periodic packing with 20 spheres:
>>> sp.makeCloud((0,0,0),(5,5,5),rMean=.5,rRelFuzz=.5,periodic=True,num=20) 20
Virgin simulation is aperiodic:
>>> O.reset() >>> O.periodic False
Add generated packing to the simulation, rotated by 45° along +z
>>> sp.toSimulation(rot=Quaternion((0,0,1),pi/4),color=(0,0,1)) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
Periodic properties are transferred to the simulation correctly, including rotation (this could be avoided by explicitly passing “hSize=O.cell.hSize” as an argument):
>>> O.periodic True >>> O.cell.refSize Vector3(5,5,5) >>> O.cell.hSize Matrix3(3.53553,-3.53553,0, 3.53553,3.53553,0, 0,0,5)
The current state (even if rotated) is taken as mechanically undeformed, i.e. with identity transformation:
>>> O.cell.trsf Matrix3(1,0,0, 0,1,0, 0,0,1)
- Parameters:
rot (Quaternion/Matrix3) – rotation of the packing, which will be applied on spheres and will be used to set Cell.trsf as well.
**kw – passed to utils.sphere
- Returns:
list of body ids added (like O.bodies.append)
- yade.pack.filterSpherePack(predicate, spherePack, returnSpherePack=None, **kw)[source]¶
Using given SpherePack instance, return spheres that satisfy predicate. It returns either a pack.SpherePack (if returnSpherePack) or a list. The packing will be recentered to match the predicate and warning is given if the predicate is larger than the packing.
- yade.pack.gtsSurface2Facets(surf, **kw)[source]¶
Construct facets from given GTS surface. **kw is passed to utils.facet.
- yade.pack.gtsSurfaceBestFitOBB(surf)[source]¶
Return (Vector3 center, Vector3 halfSize, Quaternion orientation) describing best-fit oriented bounding box (OBB) for the given surface. See cloudBestFitOBB for details.
- yade.pack.hexaNet(radius, cornerCoord=[0, 0, 0], xLength=1.0, yLength=0.5, mos=0.08, a=0.04, b=0.04, startAtCorner=True, isSymmetric=False, **kw)[source]¶
Definition of the particles for a hexagonal wire net in the x-y-plane for the WireMatPM.
- Parameters:
radius – radius of the particle
cornerCoord – coordinates of the lower left corner of the net
xLenght – net length in x-direction
yLenght – net length in y-direction
mos – mesh opening size (horizontal distance between the double twists)
a – length of double-twist
b – height of single wire section
startAtCorner – if true the generation starts with a double-twist at the lower left corner
isSymmetric – defines if the net is symmetric with respect to the y-axis
- Returns:
set of spheres which defines the net (net) and exact dimensions of the net (lx,ly).
Note
This packing works for the WireMatPM only. The particles at the corner are always generated first. For examples on how to use this packing see examples/WireMatPM. In order to create the proper interactions for the net the interaction radius has to be adapted in the simulation.
- class yade.pack.inConvexPolyhedron(inherits Predicate)[source]¶
- aabb((Predicate)arg1) tuple : [source]¶
lower and upper corner of predicate’s axis aligned bounding box
aabb( (Predicate)arg1) -> None
- containsPoint((Predicate)arg1, (Vector3)pt[, (float)pad=0]) bool : ¶
if given point is inside the predicate or not.
pred.containsPoint(pt,pad)
is equivalent to directly calling predicate itselfpred(pt,pad)
containsPoint( (Predicate)arg1, (Vector3)arg2, (float)arg3) -> None
- class yade.pack.inGtsSurface_py(inherits Predicate)[source]¶
This class was re-implemented in c++, but should stay here to serve as reference for implementing Predicates in pure python code. C++ allows us to play dirty tricks in GTS which are not accessible through pygts itself; the performance penalty of pygts comes from fact that if constructs and destructs bb tree for the surface at every invocation of gts.Point().is_inside(). That is cached in the c++ code, provided that the surface is not manipulated with during lifetime of the object (user’s responsibility).
—
Predicate for GTS surfaces. Constructed using an already existing surfaces, which must be closed.
import gts surf=gts.read(open(‘horse.gts’)) inGtsSurface(surf)
Note
Padding is optionally supported by testing 6 points along the axes in the pad distance. This must be enabled in the ctor by saying doSlowPad=True. If it is not enabled and pad is not zero, warning is issued.
- aabb((Predicate)arg1) tuple : [source]¶
lower and upper corner of predicate’s axis aligned bounding box
aabb( (Predicate)arg1) -> None
- center((Predicate)arg1) Vector3 : ¶
center of the predicate
- containsPoint((Predicate)arg1, (Vector3)pt[, (float)pad=0]) bool : ¶
if given point is inside the predicate or not.
pred.containsPoint(pt,pad)
is equivalent to directly calling predicate itselfpred(pt,pad)
containsPoint( (Predicate)arg1, (Vector3)arg2, (float)arg3) -> None
- dim((Predicate)arg1) Vector3 : ¶
axis aligned dimensions of the predicate
- class yade.pack.inHalfSpace(inherits Predicate)[source]¶
Predicate returning True any points, with infinite bounding box.
- aabb((Predicate)arg1) tuple : [source]¶
lower and upper corner of predicate’s axis aligned bounding box
aabb( (Predicate)arg1) -> None
- containsPoint((Predicate)arg1, (Vector3)pt[, (float)pad=0]) bool : ¶
if given point is inside the predicate or not.
pred.containsPoint(pt,pad)
is equivalent to directly calling predicate itselfpred(pt,pad)
containsPoint( (Predicate)arg1, (Vector3)arg2, (float)arg3) -> None
- class yade.pack.inSpace(inherits Predicate)[source]¶
Predicate returning True for any points, with infinite bounding box.
- aabb((Predicate)arg1) tuple : [source]¶
lower and upper corner of predicate’s axis aligned bounding box
aabb( (Predicate)arg1) -> None
- containsPoint((Predicate)arg1, (Vector3)pt[, (float)pad=0]) bool : ¶
if given point is inside the predicate or not.
pred.containsPoint(pt,pad)
is equivalent to directly calling predicate itselfpred(pt,pad)
containsPoint( (Predicate)arg1, (Vector3)arg2, (float)arg3) -> None
- yade.pack.randomDensePack(predicate, radius, material=-1, dim=None, cropLayers=0, rRelFuzz=0.0, spheresInCell=0, memoizeDb=None, useOBB=False, memoDbg=False, color=None, returnSpherePack=None, seed=-1)[source]¶
Generator of random dense packing with given geometry properties, using TriaxialTest (aperiodic) or PeriIsoCompressor (periodic). The periodicity depens on whether the spheresInCell parameter is given.
O.switchScene() magic is used to have clean simulation for TriaxialTest without deleting the original simulation. This function therefore should never run in parallel with some code accessing your simulation.
- Parameters:
predicate – solid-defining predicate for which we generate packing
spheresInCell – if given, the packing will be periodic, with given number of spheres in the periodic cell.
radius – mean radius of spheres
rRelFuzz – relative fuzz of the radius – e.g. radius=10, rRelFuzz=.2, then spheres will have radii 10 ± (10*.2)), with an uniform distribution. 0 by default, meaning all spheres will have exactly the same radius.
cropLayers – (aperiodic only) how many layers of spheres will be added to the computed dimension of the box so that there no (or not so much, at least) boundary effects at the boundaries of the predicate.
dim – dimension of the packing, to override dimensions of the predicate (if it is infinite, for instance)
memoizeDb – name of sqlite database (existent or nonexistent) to find an already generated packing or to store the packing that will be generated, if not found (the technique of caching results of expensive computations is known as memoization). Fuzzy matching is used to select suitable candidate – packing will be scaled, rRelFuzz and dimensions compared. Packing that are too small are dictarded. From the remaining candidate, the one with the least number spheres will be loaded and returned.
useOBB – effective only if a inGtsSurface predicate is given. If true (not default), oriented bounding box will be computed first; it can reduce substantially number of spheres for the triaxial compression (like 10× depending on how much asymmetric the body is), see examples/gts-horse/gts-random-pack-obb.py
memoDbg – show packings that are considered and reasons why they are rejected/accepted
returnSpherePack – see the corresponding argument in pack.filterSpherePack
- Returns:
SpherePack object with spheres, filtered by the predicate.
- yade.pack.randomPeriPack(radius, initSize, rRelFuzz=0.0, memoizeDb=None, noPrint=False, seed=-1)[source]¶
Generate periodic dense packing.
A cell of initSize is stuffed with as many spheres as possible, then we run periodic compression with PeriIsoCompressor, just like with randomDensePack.
- Parameters:
radius – mean sphere radius
rRelFuzz – relative fuzz of sphere radius (equal distribution); see the same param for randomDensePack.
initSize – initial size of the periodic cell.
- Returns:
SpherePack object, which also contains periodicity information.
- yade.pack.regularHexa(predicate, radius, gap, **kw)[source]¶
Return set of spheres in regular hexagonal grid, clipped inside solid given by predicate. Created spheres will have given radius and will be separated by gap space.
- yade.pack.regularOrtho(predicate, radius, gap, **kw)[source]¶
Return set of spheres in regular orthogonal grid, clipped inside solid given by predicate. Created spheres will have given radius and will be separated by gap space.
- yade.pack.revolutionSurfaceMeridians(sects, angles, origin=Vector3(0, 0, 0), orientation=Quaternion((1, 0, 0), 0))[source]¶
Revolution surface given sequences of 2d points and sequence of corresponding angles, returning sequences of 3d points representing meridian sections of the revolution surface. The 2d sections are turned around z-axis, but they can be transformed using the origin and orientation arguments to give arbitrary orientation.
- yade.pack.sweptPolylines2gtsSurface(pts, threshold=0, capStart=False, capEnd=False)[source]¶
Create swept suface (as GTS triangulation) given same-length sequences of points (as 3-tuples).
If threshold is given (>0), then
degenerate faces (with edges shorter than threshold) will not be created
gts.Surface().cleanup(threshold) will be called before returning, which merges vertices mutually closer than threshold. In case your pts are closed (last point concident with the first one) this will the surface strip of triangles. If you additionally have capStart==True and capEnd==True, the surface will be closed.
Note
capStart and capEnd make the most naive polygon triangulation (diagonals) and will perhaps fail for non-convex sections.
Warning
the algorithm connects points sequentially; if two polylines are mutually rotated or have inverse sense, the algorithm will not detect it and connect them regardless in their given order.
Creation, manipulation, IO for generic sphere packings.
- class yade._packSpheres.SpherePack¶
Set of spheres represented as centers and radii. This class is returned by pack.randomDensePack, pack.randomPeriPack and others. The object supports iteration over spheres, as in
>>> sp=SpherePack() >>> for center,radius in sp: print(center,radius)
>>> for sphere in sp: print(sphere[0],sphere[1]) ## same, but without unpacking the tuple automatically
>>> for i in range(0,len(sp)): print(sp[i][0], sp[i][1]) ## same, but accessing spheres by index
Special constructors
Construct from list of
[(c1,r1),(c2,r2),…]
. To convert two same-length lists ofcenters
andradii
, construct withzip(centers,radii)
.- __init__((object)arg1[, (list)list]) None : ¶
Empty constructor, optionally taking list [ ((cx,cy,cz),r), … ] for initial data.
- aabb((SpherePack)arg1) tuple : ¶
Get axis-aligned bounding box coordinates, as 2 3-tuples.
- add((SpherePack)arg1, (Vector3)arg2, (float)arg3) None : ¶
Add single sphere to packing, given center as 3-tuple and radius
- property appliedPsdScaling¶
A factor between 0 and 1, uniformly applied on all sizes of of the PSD.
- cellFill((SpherePack)arg1, (Vector3)arg2) None : ¶
Repeat the packing (if periodic) so that the results has dim() >= given size. The packing retains periodicity, but changes cellSize. Raises exception for non-periodic packing.
- cellRepeat((SpherePack)arg1, (Vector3i)arg2) None : ¶
Repeat the packing given number of times in each dimension. Periodicity is retained, cellSize changes. Raises exception for non-periodic packing.
- property cellSize¶
Size of periodic cell; is Vector3(0,0,0) if not periodic. (Change this property only if you know what you’re doing).
- center((SpherePack)arg1) Vector3 : ¶
Return coordinates of the bounding box center.
- dim((SpherePack)arg1) Vector3 : ¶
Return dimensions of the packing in terms of aabb(), as a 3-tuple.
- fromList((SpherePack)arg1, (list)arg2) None : ¶
Make packing from given list, same format as for constructor. Discards current data.
- fromList( (SpherePack)arg1, (object)centers, (object)radii) -> None :
Make packing from given list, same format as for constructor. Discards current data.
- fromSimulation((SpherePack)arg1) None : ¶
Make packing corresponding to the current simulation. Discards current data.
- getClumps((SpherePack)arg1) tuple : ¶
Return lists of sphere ids sorted by clumps they belong to. The return value is (standalones,[clump1,clump2,…]), where each item is list of id’s of spheres.
- hasClumps((SpherePack)arg1) bool : ¶
Whether this object contains clumps.
- property isPeriodic¶
was the packing generated in periodic boundaries?
- load((SpherePack)arg1, (str)fileName) None : ¶
Load packing from external text file (current data will be discarded).
- makeCloud((SpherePack)arg1[, (Vector3)minCorner=Vector3(0, 0, 0)[, (Vector3)maxCorner=Vector3(0, 0, 0)[, (float)rMean=-1[, (float)rRelFuzz=0[, (int)num=-1[, (bool)periodic=False[, (float)porosity=0.65[, (object)psdSizes=[][, (object)psdCumm=[][, (bool)distributeMass=False[, (int)seed=-1[, (Matrix3)hSize=Matrix3(0, 0, 0, 0, 0, 0, 0, 0, 0)]]]]]]]]]]]]) int : ¶
Create a random cloud of particles enclosed in a parallelepiped. The resulting packing is a gas-like state with no contacts between particles initially. Usually used as a first step before reaching a dense packing.
- Parameters:
minCorner (Vector3) – lower corner of an axis-aligned box
maxCorner (Vector3) – upper corner of an axis-aligned box
hSize (Matrix3) – base vectors of a generalized box (arbitrary parallelepiped, typically Cell::hSize), superseeds minCorner and maxCorner if defined. For periodic boundaries only.
rMean (float) – mean radius or spheres
rRelFuzz (float) – dispersion of radius relative to rMean
num (int) – number of spheres to be generated. If negative (default), generate as many as possible with stochastic sizes, ending after a fixed number of tries to place the sphere in space, else generate exactly
num
spheres with deterministic size distribution.periodic (bool) – whether the packing to be generated should be periodic
porosity (float) – initial guess for the iterative generation procedure (if
num
>1). The algorithm will be retrying until the number of generated spheres isnum
. The first iteration tries with the provided porosity, but next iterations increase it if necessary (hence an initialy high porosity can speed-up the algorithm). IfpsdSizes
is not defined,rRelFuzz
(\(z\)) andnum
(\(N\)) are used so that the porosity given (\(\rho\)) is approximately achieved at the end of generation, \(r_m=\sqrt[3]{\frac{V(1-\rho)}{\frac{4}{3}\pi(1+z^2)N}}\). The default is \(\rho\)=0.5. The optimal value depends onrRelFuzz
orpsdSizes
.psdSizes – sieve sizes (particle diameters) when particle size distribution (PSD) is specified.
psdCumm – cummulative fractions of particle sizes given by
psdSizes
; must be the same length as psdSizes and should be non-decreasing.distributeMass (bool) – if
True
, given distribution will be used to distribute sphere’s mass rather than radius of them.seed – number used to initialize the random number generator.
- Returns:
number of created spheres, which can be lower than
num
depending on the method used.
Note
Works in 2D if
minCorner[k]=maxCorner[k]
for one coordinate.If
num
is defined, then sizes generation is deterministic, giving the best fit of target distribution. It enables spheres placement in descending size order, thus giving lower porosity than the random generation.By default (with
distributeMass==False
), the distribution is applied to particle count (i.e. particle count percent passing). The typical geomechanics sense of “particle size distribution” is the distribution of mass fraction (i.e. mass percent passing); this can be achieved withdistributeMass=True
.Sphere radius distribution can be specified using one of the following ways:
rMean
,rRelFuzz
andnum
gives uniform radius distribution in \(rMean×(1 \pm rRelFuzz)\). Less thannum
spheres can be generated if it is too high.rRelFuzz
,num
and (optional)porosity
, which estimates mean radius so thatporosity
is attained at the end.rMean
must be less than 0 (default).porosity
is only an initial guess for the generation algorithm, which will retry with higher porosity until the prescibed num is obtained.psdSizes
andpsdCumm
, two arrays specifying points of the particle size distribution function. As many spheres as possible are generated.psdSizes
,psdCumm
,num
, and (optional)porosity
, like above but ifnum
is not obtained,psdSizes
will be scaled down uniformly, untilnum
is obtained (see appliedPsdScaling).
- makeClumpCloud((SpherePack)arg1, (Vector3)minCorner, (Vector3)maxCorner, (object)clumps[, (bool)periodic=False[, (int)num=-1[, (int)seed=-1]]]) int : ¶
Create a random (in particles positions and orientations) cloud of clumps the same way makeCloud does with spheres. The parameters
minCorner
,maxCorner
,periodic
,num
andseed
are the same as in makeCloud. The parameterclumps
is a list containing all the different clumps to be appended asSpherePack
objects. Here is an exemple that shows how to create a cloud made of 10 identical clumps :clp = SpherePack([((0,0,0), 1e-2), ((1e-2,0,0), 1e-2)]) # The clump we want a cloud of sp = SpherePack() sp.makeClumpCloud((0,0,0), (1,1,1), [clp], num=10, seed=42) sp.toSimulation() # All the particles in the cloud are now appended to O.bodies
- psd((SpherePack)arg1[, (int)bins=50[, (bool)mass=True]]) tuple : ¶
Return particle size distribution of the packing.
- Parameters:
bins (int) – number of bins between minimum and maximum diameter
mass – Compute relative mass rather than relative particle count for each bin. Corresponds to distributeMass parameter for makeCloud.
- Returns:
tuple of
(cumm,edges)
, wherecumm
are cummulative fractions for respective diameters andedges
are those diameter values. Dimension of both arrays is equal tobins+1
.
- relDensity((SpherePack)arg1) float : ¶
Relative packing density, measured as sum of spheres’ volumes / aabb volume. (Sphere overlaps are ignored.)
- rotate((SpherePack)arg1, (Vector3)axis, (float)angle) None : ¶
Rotate all spheres around packing center (in terms of aabb()), given axis and angle of the rotation.
- save((SpherePack)arg1, (str)fileName) None : ¶
Save packing to external text file (will be overwritten).
- scale((SpherePack)arg1, (float)arg2) None : ¶
Scale the packing around its center (in terms of aabb()) by given factor (may be negative).
- toList((SpherePack)arg1) list : ¶
Return packing data as python list.
- toSimulation(rot=Matrix3(1, 0, 0, 0, 1, 0, 0, 0, 1), **kw)¶
Append spheres directly to the simulation. In addition calling O.bodies.append, this method also appropriately sets periodic cell information of the simulation.
>>> from yade import pack; from math import * >>> sp=pack.SpherePack()
Create random periodic packing with 20 spheres:
>>> sp.makeCloud((0,0,0),(5,5,5),rMean=.5,rRelFuzz=.5,periodic=True,num=20) 20
Virgin simulation is aperiodic:
>>> O.reset() >>> O.periodic False
Add generated packing to the simulation, rotated by 45° along +z
>>> sp.toSimulation(rot=Quaternion((0,0,1),pi/4),color=(0,0,1)) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
Periodic properties are transferred to the simulation correctly, including rotation (this could be avoided by explicitly passing “hSize=O.cell.hSize” as an argument):
>>> O.periodic True >>> O.cell.refSize Vector3(5,5,5) >>> O.cell.hSize Matrix3(3.53553,-3.53553,0, 3.53553,3.53553,0, 0,0,5)
The current state (even if rotated) is taken as mechanically undeformed, i.e. with identity transformation:
>>> O.cell.trsf Matrix3(1,0,0, 0,1,0, 0,0,1)
- Parameters:
rot (Quaternion/Matrix3) – rotation of the packing, which will be applied on spheres and will be used to set Cell.trsf as well.
**kw – passed to utils.sphere
- Returns:
list of body ids added (like O.bodies.append)
- translate((SpherePack)arg1, (Vector3)arg2) None : ¶
Translate all spheres by given vector.
- class yade._packSpheres.SpherePackIterator¶
- __init__((object)arg1, (SpherePackIterator)arg2) None ¶
- next()¶
__next__( (SpherePackIterator)arg1) -> tuple
Spatial predicates for volumes (defined analytically or by triangulation).
- class yade._packPredicates.Predicate¶
Spatial predicate base class. Predicates support boolean operations as described in user’s manual
- aabb((Predicate)arg1) tuple : ¶
lower and upper corner of predicate’s axis aligned bounding box
aabb( (Predicate)arg1) -> None
- center((Predicate)arg1) Vector3 : ¶
center of the predicate
- containsPoint((Predicate)arg1, (Vector3)pt[, (float)pad=0]) bool : ¶
if given point is inside the predicate or not.
pred.containsPoint(pt,pad)
is equivalent to directly calling predicate itselfpred(pt,pad)
containsPoint( (Predicate)arg1, (Vector3)arg2, (float)arg3) -> None
- dim((Predicate)arg1) Vector3 : ¶
axis aligned dimensions of the predicate
- class yade._packPredicates.PredicateBoolean(inherits Predicate)¶
Boolean operation on 2 predicates (abstract class)
- property A¶
- property B¶
- __init__()¶
Raises an exception This class cannot be instantiated from Python
- aabb((Predicate)arg1) tuple : ¶
lower and upper corner of predicate’s axis aligned bounding box
aabb( (Predicate)arg1) -> None
- center((Predicate)arg1) Vector3 : ¶
center of the predicate
- containsPoint((Predicate)arg1, (Vector3)pt[, (float)pad=0]) bool : ¶
if given point is inside the predicate or not.
pred.containsPoint(pt,pad)
is equivalent to directly calling predicate itselfpred(pt,pad)
containsPoint( (Predicate)arg1, (Vector3)arg2, (float)arg3) -> None
- dim((Predicate)arg1) Vector3 : ¶
axis aligned dimensions of the predicate
- class yade._packPredicates.PredicateDifference(inherits PredicateBoolean → Predicate)¶
Difference (conjunction with negative predicate) of 2 predicates. A point has to be inside the first and outside the second predicate. Can be constructed using the
-
operator on predicates:pred1 - pred2
.- property A¶
- property B¶
- __init__((object)arg1, (object)arg2, (object)arg3) None ¶
- aabb((Predicate)arg1) tuple : ¶
lower and upper corner of predicate’s axis aligned bounding box
aabb( (Predicate)arg1) -> None
- center((Predicate)arg1) Vector3 : ¶
center of the predicate
- containsPoint((Predicate)arg1, (Vector3)pt[, (float)pad=0]) bool : ¶
if given point is inside the predicate or not.
pred.containsPoint(pt,pad)
is equivalent to directly calling predicate itselfpred(pt,pad)
containsPoint( (Predicate)arg1, (Vector3)arg2, (float)arg3) -> None
- dim((Predicate)arg1) Vector3 : ¶
axis aligned dimensions of the predicate
- class yade._packPredicates.PredicateIntersection(inherits PredicateBoolean → Predicate)¶
Intersection (conjunction) of 2 predicates. A point has to be inside both predicates. Can be constructed using the
&
operator on predicates:pred1 & pred2
.- property A¶
- property B¶
- __init__((object)arg1, (object)arg2, (object)arg3) None ¶
- aabb((Predicate)arg1) tuple : ¶
lower and upper corner of predicate’s axis aligned bounding box
aabb( (Predicate)arg1) -> None
- center((Predicate)arg1) Vector3 : ¶
center of the predicate
- containsPoint((Predicate)arg1, (Vector3)pt[, (float)pad=0]) bool : ¶
if given point is inside the predicate or not.
pred.containsPoint(pt,pad)
is equivalent to directly calling predicate itselfpred(pt,pad)
containsPoint( (Predicate)arg1, (Vector3)arg2, (float)arg3) -> None
- dim((Predicate)arg1) Vector3 : ¶
axis aligned dimensions of the predicate
- class yade._packPredicates.PredicateSymmetricDifference(inherits PredicateBoolean → Predicate)¶
SymmetricDifference (exclusive disjunction) of 2 predicates. A point has to be in exactly one predicate of the two. Can be constructed using the
^
operator on predicates:pred1 ^ pred2
.- property A¶
- property B¶
- __init__((object)arg1, (object)arg2, (object)arg3) None ¶
- aabb((Predicate)arg1) tuple : ¶
lower and upper corner of predicate’s axis aligned bounding box
aabb( (Predicate)arg1) -> None
- center((Predicate)arg1) Vector3 : ¶
center of the predicate
- containsPoint((Predicate)arg1, (Vector3)pt[, (float)pad=0]) bool : ¶
if given point is inside the predicate or not.
pred.containsPoint(pt,pad)
is equivalent to directly calling predicate itselfpred(pt,pad)
containsPoint( (Predicate)arg1, (Vector3)arg2, (float)arg3) -> None
- dim((Predicate)arg1) Vector3 : ¶
axis aligned dimensions of the predicate
- class yade._packPredicates.PredicateUnion(inherits PredicateBoolean → Predicate)¶
Union (non-exclusive disjunction) of 2 predicates. A point has to be inside any of the two predicates to be inside. Can be constructed using the
|
operator on predicates:pred1 | pred2
.- property A¶
- property B¶
- __init__((object)arg1, (object)arg2, (object)arg3) None ¶
- aabb((Predicate)arg1) tuple : ¶
lower and upper corner of predicate’s axis aligned bounding box
aabb( (Predicate)arg1) -> None
- center((Predicate)arg1) Vector3 : ¶
center of the predicate
- containsPoint((Predicate)arg1, (Vector3)pt[, (float)pad=0]) bool : ¶
if given point is inside the predicate or not.
pred.containsPoint(pt,pad)
is equivalent to directly calling predicate itselfpred(pt,pad)
containsPoint( (Predicate)arg1, (Vector3)arg2, (float)arg3) -> None
- dim((Predicate)arg1) Vector3 : ¶
axis aligned dimensions of the predicate
- class yade._packPredicates.inAlignedBox(inherits Predicate)¶
Axis-aligned box predicate
- __init__((object)arg1, (Vector3)minAABB, (Vector3)maxAABB) None : ¶
Ctor taking minumum and maximum points of the box (as 3-tuples).
- aabb((Predicate)arg1) tuple : ¶
lower and upper corner of predicate’s axis aligned bounding box
aabb( (Predicate)arg1) -> None
- center((Predicate)arg1) Vector3 : ¶
center of the predicate
- containsPoint((Predicate)arg1, (Vector3)pt[, (float)pad=0]) bool : ¶
if given point is inside the predicate or not.
pred.containsPoint(pt,pad)
is equivalent to directly calling predicate itselfpred(pt,pad)
containsPoint( (Predicate)arg1, (Vector3)arg2, (float)arg3) -> None
- dim((Predicate)arg1) Vector3 : ¶
axis aligned dimensions of the predicate
- class yade._packPredicates.inCylinder(inherits Predicate)¶
Cylinder predicate
- __init__((object)arg1, (Vector3)centerBottom, (Vector3)centerTop, (float)radius) None : ¶
Ctor taking centers of the lateral walls (as 3-tuples) and radius.
- aabb((Predicate)arg1) tuple : ¶
lower and upper corner of predicate’s axis aligned bounding box
aabb( (Predicate)arg1) -> None
- center((Predicate)arg1) Vector3 : ¶
center of the predicate
- containsPoint((Predicate)arg1, (Vector3)pt[, (float)pad=0]) bool : ¶
if given point is inside the predicate or not.
pred.containsPoint(pt,pad)
is equivalent to directly calling predicate itselfpred(pt,pad)
containsPoint( (Predicate)arg1, (Vector3)arg2, (float)arg3) -> None
- dim((Predicate)arg1) Vector3 : ¶
axis aligned dimensions of the predicate
- class yade._packPredicates.inEllipsoid(inherits Predicate)¶
Ellipsoid predicate
- __init__((object)arg1, (Vector3)centerPoint, (Vector3)abc) None : ¶
Ctor taking center of the ellipsoid (3-tuple) and its 3 radii (3-tuple).
- aabb((Predicate)arg1) tuple : ¶
lower and upper corner of predicate’s axis aligned bounding box
aabb( (Predicate)arg1) -> None
- center((Predicate)arg1) Vector3 : ¶
center of the predicate
- containsPoint((Predicate)arg1, (Vector3)pt[, (float)pad=0]) bool : ¶
if given point is inside the predicate or not.
pred.containsPoint(pt,pad)
is equivalent to directly calling predicate itselfpred(pt,pad)
containsPoint( (Predicate)arg1, (Vector3)arg2, (float)arg3) -> None
- dim((Predicate)arg1) Vector3 : ¶
axis aligned dimensions of the predicate
- class yade._packPredicates.inGtsSurface(inherits Predicate)¶
GTS surface predicate
- __init__((object)arg1, (object)surface[, (bool)noPad]) None : ¶
Ctor taking a gts.Surface() instance, which must not be modified during instance lifetime. The optional noPad can disable padding (if set to True), which speeds up calls several times. Note: padding checks inclusion of 6 points along +- cardinal directions in the pad distance from given point, which is not exact.
- aabb((Predicate)arg1) tuple : ¶
lower and upper corner of predicate’s axis aligned bounding box
aabb( (Predicate)arg1) -> None
- center((Predicate)arg1) Vector3 : ¶
center of the predicate
- containsPoint((Predicate)arg1, (Vector3)pt[, (float)pad=0]) bool : ¶
if given point is inside the predicate or not.
pred.containsPoint(pt,pad)
is equivalent to directly calling predicate itselfpred(pt,pad)
containsPoint( (Predicate)arg1, (Vector3)arg2, (float)arg3) -> None
- dim((Predicate)arg1) Vector3 : ¶
axis aligned dimensions of the predicate
- property surf¶
The associated gts.Surface object.
- class yade._packPredicates.inHyperboloid(inherits Predicate)¶
Hyperboloid predicate
- __init__((object)arg1, (Vector3)centerBottom, (Vector3)centerTop, (float)radius, (float)skirt) None : ¶
Ctor taking centers of the lateral walls (as 3-tuples), radius at bases and skirt (middle radius).
- aabb((Predicate)arg1) tuple : ¶
lower and upper corner of predicate’s axis aligned bounding box
aabb( (Predicate)arg1) -> None
- center((Predicate)arg1) Vector3 : ¶
center of the predicate
- containsPoint((Predicate)arg1, (Vector3)pt[, (float)pad=0]) bool : ¶
if given point is inside the predicate or not.
pred.containsPoint(pt,pad)
is equivalent to directly calling predicate itselfpred(pt,pad)
containsPoint( (Predicate)arg1, (Vector3)arg2, (float)arg3) -> None
- dim((Predicate)arg1) Vector3 : ¶
axis aligned dimensions of the predicate
- class yade._packPredicates.inParallelepiped(inherits Predicate)¶
Parallelepiped predicate
- __init__((object)arg1, (Vector3)o, (Vector3)a, (Vector3)b, (Vector3)c) None : ¶
Ctor taking four points:
o
(for origin) and thena
,b
,c
which define endpoints of 3 respective edges fromo
.
- aabb((Predicate)arg1) tuple : ¶
lower and upper corner of predicate’s axis aligned bounding box
aabb( (Predicate)arg1) -> None
- center((Predicate)arg1) Vector3 : ¶
center of the predicate
- containsPoint((Predicate)arg1, (Vector3)pt[, (float)pad=0]) bool : ¶
if given point is inside the predicate or not.
pred.containsPoint(pt,pad)
is equivalent to directly calling predicate itselfpred(pt,pad)
containsPoint( (Predicate)arg1, (Vector3)arg2, (float)arg3) -> None
- dim((Predicate)arg1) Vector3 : ¶
axis aligned dimensions of the predicate
- class yade._packPredicates.inSphere(inherits Predicate)¶
Sphere predicate.
- __init__((object)arg1, (Vector3)center, (float)radius) None : ¶
Ctor taking center (as a 3-tuple) and radius
- aabb((Predicate)arg1) tuple : ¶
lower and upper corner of predicate’s axis aligned bounding box
aabb( (Predicate)arg1) -> None
- center((Predicate)arg1) Vector3 : ¶
center of the predicate
- containsPoint((Predicate)arg1, (Vector3)pt[, (float)pad=0]) bool : ¶
if given point is inside the predicate or not.
pred.containsPoint(pt,pad)
is equivalent to directly calling predicate itselfpred(pt,pad)
containsPoint( (Predicate)arg1, (Vector3)arg2, (float)arg3) -> None
- dim((Predicate)arg1) Vector3 : ¶
axis aligned dimensions of the predicate
- class yade._packPredicates.notInNotch(inherits Predicate)¶
Outside of infinite, rectangle-shaped notch predicate
- __init__((object)arg1, (Vector3)centerPoint, (Vector3)edge, (Vector3)normal, (float)aperture) None : ¶
Ctor taking point in the symmetry plane, vector pointing along the edge, plane normal and aperture size. The side inside the notch is edge×normal. Normal is made perpendicular to the edge. All vectors are normalized at construction time.
- aabb((Predicate)arg1) tuple : ¶
lower and upper corner of predicate’s axis aligned bounding box
aabb( (Predicate)arg1) -> None
- center((Predicate)arg1) Vector3 : ¶
center of the predicate
- containsPoint((Predicate)arg1, (Vector3)pt[, (float)pad=0]) bool : ¶
if given point is inside the predicate or not.
pred.containsPoint(pt,pad)
is equivalent to directly calling predicate itselfpred(pt,pad)
containsPoint( (Predicate)arg1, (Vector3)arg2, (float)arg3) -> None
- dim((Predicate)arg1) Vector3 : ¶
axis aligned dimensions of the predicate
Computation of oriented bounding box for cloud of points.
- yade._packObb.cloudBestFitOBB((tuple)arg1) tuple ¶
Return (Vector3 center, Vector3 halfSize, Quaternion orientation) of best-fit oriented bounding-box for given tuple of points (uses brute-force velome minimization, do not use for very large clouds).