Show / Hide Table of Contents

    Class CellComplex

    A non-manifold cellular structure.

    Examples
    
    // Assemble CellComplex from Grid2d
    var numLevels = 10;
    var levelHeight = 1;
    var cellSize = 2;
    var complex = new CellComplex();
    var boundary = new Circle(new Vector3(), 10).ToPolygon();
    var grid = new Grid2d(boundary, Vector3.Origin, Vector3.XAxis, Vector3.YAxis);
    var pathMaterial = new Material("Path", new Color(1, 0, 0, 0.75));
    
    grid.U.DivideByFixedLength(cellSize);
    grid.V.DivideByFixedLength(cellSize);
    
    
    for (var i = 0; i < numLevels; i++)
    {
        foreach (var cell in grid.GetCells())
        {
            foreach (var crv in cell.GetTrimmedCellGeometry())
            {
                complex.AddCell((Polygon)crv, levelHeight, i * levelHeight, grid.U, grid.V);
            }
        }
    }
    
    // Draw base CellComplex
    foreach (var face in complex.GetFaces())
    {
        this.Model.AddElement(new Panel(face.GetGeometry(), BuiltInMaterials.Mass));
    }
    
    // Traverse CellComplex
    var start = new Vector3(15, 15, 15);
    var end = new Vector3(-15, -15, -15);
    
    // Draw lines from start and end to closest points, for reference
    foreach (var pt in new List<Vector3>() { start, end })
    {
        var closest = complex.GetClosestVertex(pt).GetGeometry();
        this.Model.AddElement(new ModelCurve(new Line(pt, closest), pathMaterial));
    }
    
    var curCell = complex.GetClosestCell(start);
    var traversedCells = curCell.TraverseNeighbors(end);
    
    foreach (var cell in traversedCells)
    {
        var rep = new Representation(new[] { cell.GetGeometry() });
        this.Model.AddElement(new GeometricElement(new Transform(), pathMaterial, rep, false, Guid.NewGuid(), "Path"));
    }
    
    Inheritance
    System.Object
    Element
    CellComplex
    Implements
    System.ComponentModel.INotifyPropertyChanged
    Inherited Members
    Element.Id
    Element.Name
    Element.AdditionalProperties
    Element.PropertyChanged
    Element.RaisePropertyChanged(String)
    Element.SetMapping(String, MappingBase)
    Element.GetMapping(String)
    Element.GetMapping<T>(String)
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Elements.Spatial.CellComplex
    Assembly: Hypar.Elements.dll
    Syntax
    public class CellComplex : Element, INotifyPropertyChanged

    Constructors

    CellComplex(Guid, String)

    Create a CellComplex.

    Declaration
    public CellComplex(Guid id = default(Guid), string name = null)
    Parameters
    Type Name Description
    System.Guid id

    Optional ID: If blank, a new Guid will be created.

    System.String name

    Optional name of your CellComplex.

    Fields

    Tolerance

    Tolerance for points being considered the same. Applies individually to X, Y, and Z coordinates, not the cumulative difference!

    Declaration
    public double Tolerance
    Field Value
    Type Description
    System.Double

    Methods

    AddCell(Polygon, Double, Double, Grid1d, Grid1d)

    Add a cell to the CellComplex.

    Declaration
    public Cell AddCell(Polygon polygon, double height, double elevation, Grid1d uGrid = null, Grid1d vGrid = null)
    Parameters
    Type Name Description
    Polygon polygon

    The polygon that forms the base of this cell.

    System.Double height

    The height of the cell.

    System.Double elevation

    The elevation of the bottom of this cell.

    Grid1d uGrid

    An optional but highly recommended U grid that allows the cell's top and bottom faces to store intended directionality.

    Grid1d vGrid

    An optional but highly recommended V grid that allows the cell's top and bottom faces to store intended directionality.

    Returns
    Type Description
    Cell

    The created Cell.

    GetCell(UInt64)

    Get a Cell by its ID.

    Declaration
    public Cell GetCell(ulong cellId)
    Parameters
    Type Name Description
    System.UInt64 cellId
    Returns
    Type Description
    Cell

    GetCells()

    Get all Cells.

    Declaration
    public List<Cell> GetCells()
    Returns
    Type Description
    System.Collections.Generic.List<Cell>

    GetClosestCell(Vector3)

    Get the associated Cell that is closest to a point.

    Declaration
    public Cell GetClosestCell(Vector3 point)
    Parameters
    Type Name Description
    Vector3 point
    Returns
    Type Description
    Cell

    GetClosestEdge(Vector3)

    Get the associated Edge that is closest to a point.

    Declaration
    public Edge GetClosestEdge(Vector3 point)
    Parameters
    Type Name Description
    Vector3 point
    Returns
    Type Description
    Edge

    GetClosestFace(Vector3)

    Get the associated Face that is closest to a point.

    Declaration
    public Face GetClosestFace(Vector3 point)
    Parameters
    Type Name Description
    Vector3 point
    Returns
    Type Description
    Face

    GetClosestVertex(Vector3)

    Get the associated Vertex that is closest to a point.

    Declaration
    public Vertex GetClosestVertex(Vector3 point)
    Parameters
    Type Name Description
    Vector3 point
    Returns
    Type Description
    Vertex

    GetEdge(UInt64)

    Get a Edge by its ID.

    Declaration
    public Edge GetEdge(ulong edgeId)
    Parameters
    Type Name Description
    System.UInt64 edgeId
    Returns
    Type Description
    Edge

    GetEdges()

    Get all Edges.

    Declaration
    public List<Edge> GetEdges()
    Returns
    Type Description
    System.Collections.Generic.List<Edge>

    GetFace(Nullable<UInt64>)

    Get a Face by its ID.

    Declaration
    public Face GetFace(ulong? faceId)
    Parameters
    Type Name Description
    System.Nullable<System.UInt64> faceId
    Returns
    Type Description
    Face

    GetFaces()

    Get all Faces.

    Declaration
    public List<Face> GetFaces()
    Returns
    Type Description
    System.Collections.Generic.List<Face>

    GetOrientation(Nullable<UInt64>)

    Get a U or V direction by its ID.

    Declaration
    public Orientation GetOrientation(ulong? orientationId)
    Parameters
    Type Name Description
    System.Nullable<System.UInt64> orientationId
    Returns
    Type Description
    Orientation

    GetVertex(UInt64)

    Get a Vertex by its ID.

    Declaration
    public Vertex GetVertex(ulong vertexId)
    Parameters
    Type Name Description
    System.UInt64 vertexId
    Returns
    Type Description
    Vertex

    GetVertices()

    Get all Vertices.

    Declaration
    public List<Vertex> GetVertices()
    Returns
    Type Description
    System.Collections.Generic.List<Vertex>

    GetVerticesMatchingXY(Double, Double, Nullable<Double>)

    Get all vertices matching an X/Y coordinate, regardless of Z.

    Declaration
    public List<Vertex> GetVerticesMatchingXY(double x, double y, double? fuzzyFactor = null)
    Parameters
    Type Name Description
    System.Double x

    X coordinate.

    System.Double y

    Y coordinate.

    System.Nullable<System.Double> fuzzyFactor

    Amount of tolerance in the search against each component of the coordinate.

    Returns
    Type Description
    System.Collections.Generic.List<Vertex>

    VertexExists(Vector3, out UInt64, Nullable<Double>)

    Whether a vertex location already exists in the CellComplex.

    Declaration
    public bool VertexExists(Vector3 point, out ulong id, double? fuzzyFactor = null)
    Parameters
    Type Name Description
    Vector3 point
    System.UInt64 id

    The ID of the Vertex, if a match is found.

    System.Nullable<System.Double> fuzzyFactor

    Amount of tolerance in the search against each component of the coordinate.

    Returns
    Type Description
    System.Boolean

    Implements

    System.ComponentModel.INotifyPropertyChanged

    Extension Methods

    ElementProxyExtensions.Proxy<T>(T, String)
    Identity.AddOverrideIdentity(Element, IOverride)
    Identity.AddOverrideIdentity(Element, String, String, Object)
    Identity.AddOverrideValue(Element, String, Object)
    Identity.OverrideIds<T>(Element, String)