The assembly class is a non-terminal node in the Components tree. It carries almost no properties of its own, but makes sure that all geometrical transformations are propagated to its subcomponents.
The subcomponents are stored in a numpy array. This is definetely not always needed (except when fancy slicing is desired), but this keeps the consistency all along the code, making all lists instances of numpy.ndarray.
Methods
This method is a provision for the Visitor Pattern <http://http://en.wikipedia.org/wiki/Visitor_pattern> and is be used for traversing the tree.
As an assembly has sub-elements, we must iterate through them
Adds element at the component list.
Parameters : | component : Component
n : int = None
|
---|---|
Returns : | n :
|
Returns the boundaries of the assembly by finding the minimum bounding box aligned to the axis that contains it.
The algorithm works by finding the maximum and minimum values of x, y and z by traversing the subcomponents.
Returns : | bounds : numpy.ndarray \((2,3)\)
|
---|
This method iterates the clearData to all the items found in the list, making the clearData method be executed through the whole components tree.
This method searches for intersections between a given set of line segments and the Parts included in this Assembly. Please check the documentation at Part class for a better description of its internals.
Parameters : | p0, p1 - numpy.ndarray :math:`(N,3)` :
tol - double :
|
---|---|
Returns : | None :
lineParameter :
intersectionCoordinates :
triangleIndexes :
normals :
part :
|
The assembly material is important in the case it is an environment (the root element of the simulation). As a default, assemblies are initialized as IdealMaterial (no chromatic dispersion) and refractiveIndex = 1
Returns the index of refraction of the material given the wavelength (or a list of them)
Parameters : | wavelength : scalar or numpy.ndarray \((N)\)
|
---|---|
Returns : | refractiveIndex : same dimension as wavelength
|
Remove the element at the n-th position of the component list. This also de-registers this assembly as its parent.
Parameters : | element : string, int or object
|
---|---|
Returns : | element :
|
This method iterates the rotation to all the items found in the list, making the rotate method be executed through the whole components tree.
Surface property of the assembly is not important, but it is set as default to Component.TRANSPARENT