CIHDigitalConfigurator / CIH_Toolkit

CIH_Toolkit
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Discussion issue for Spatial Specifications #9

Open alelom opened 3 years ago

alelom commented 3 years ago

Issue to keep track of current work and aggregate other issues

Currently, the procedure we follow to Apply spatial specifications to objects is:

  1. Filtering 1.1 Extract the reference lines of the Spatial Specification 1.2 Produce a bounding box from the Domain.Max and reference line 1.3 Check if the object's centre line is contained in the Bounding box so obtained. See details below.

    ```cs private void RunScript(List geometries, List boxes, ref object pattern, ref object A) { // For each geometry, // if it is contained in at least 1 box, pass it. // Otherwise filter it out. var patt = new List(); var sortedBoxes = new HashSet(); foreach(var geom in geometries) { bool pass = false; if (geom != null) foreach(var box in boxes) { if(box.Contains(geom.GetBoundingBox(false))){ pass = true; sortedBoxes.Add(box); } } patt.Add(pass); } pattern = patt; A = sortedBoxes; } ```

    NOTE: 1.2 could be improved by extracting 2 bounding boxes, one for Domain.Max and one for Domain.Min; the filterCondition would be satisfied only if the object centreline is included in Domain.Max box but not included in Domain.Min box

    1. Checking 2.1 Obtain the Representation of the objects to check, e.g. extrude Beams along their centreLine with their crossSectional property 2.2 Get the Bounding box from point 1.2 2.3 Check if the Representation of 2.1 (e.g. the extrusion) is included in the bounding box of 2.2.

    NOTE: again, 2.2 can be improved as per 1.2.

    We could introduce a SpatialDomainCondition like:

    public class SpatialCondition<T> where T : IElement
    {
       public T ReferenceElement {get;set;}  // element, or location that the spatial Domain should use as reference to apply the Condition to
       public Condition Condition {get;set;}
    }
    

    when this is applied, depending on the dimensionality of the IElement stored in T, the Condition is extracted expecting a different type:

    • For IElement2D, one condition is expected (for Z, or depth, like for a slab)
    • For IElement1D, to express conditions on the two dimensions (for X and Y, or width and height, like for a cross section of a beam), one can input a LogicalCondition with X and Y conditions

    Or we might have multiple different SpatialConditions, e.g. SpatialCondition1D,2D etc.

    Finally, if multiple conditions (specifications) are targeting the same beams, the current script cannot aggregate results. This could be solved by storing the hash of the check to be applied on the filtered objects. https://github.com/CIHDigitalConfigurator/CIH_Toolkit/issues/10