/// <summary>
        /// Calculates the maximum number of points in this object, does not remove geometric duplicates
        /// </summary>
        /// <param name="sbsm"></param>
        /// <returns></returns>
        public static int NumberOfPointsMax(this IfcFace face)
        {
            int pointCount = 0;

            foreach (IfcFaceBound bound in face.Bounds)
            {
                pointCount += bound.NumberOfPointsMax();
            }
            return(pointCount);
        }
Exemplo n.º 2
0
        /// <summary>
        /// returns a Hash for the geometric behaviour of this object
        /// </summary>
        /// <param name="face"></param>
        /// <returns></returns>
        public static int GetGeometryHashCode(this IfcFace face)
        {
            int hash = face.Bounds.Count;

            if (hash > 2)
            {
                return(hash);          //probably unique enough
            }
            return(face.Bounds.Aggregate(hash, (current, b) => current ^ b.GetGeometryHashCode()));
        }
        /// <summary>
        /// returns a Hash for the geometric behaviour of this object
        /// </summary>
        /// <param name="solid"></param>
        /// <returns></returns>
        public static int GetGeometryHashCode(this IfcFace face)
        {
            int hash = face.Bounds.Count;

            if (hash > 2)
            {
                return(hash);          //probably unique enough
            }
            foreach (var b in face.Bounds)
            {
                hash ^= b.GetGeometryHashCode();
            }
            return(hash);
        }
Exemplo n.º 4
0
        public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
                base.Parse(propIndex, value, nestedIndex);
                return;

            case 1:
                _vertices.InternalAdd((IfcTextureVertex)value.EntityVal);
                return;

            case 2:
                _mappedTo = (IfcFace)(value.EntityVal);
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
        /// <summary>
        /// Compares two objects for geometric equality
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b">object to compare with</param>
        /// <returns></returns>
        public static bool GeometricEquals(this IfcFace a, IfcFace b)
        {
            if (a.Equals(b))
            {
                return(true);
            }
            if (a.Bounds.Count != b.Bounds.Count)
            {
                return(false);
            }
            List <IfcFaceBound> aFaceBounds = a.Bounds.ToList();
            List <IfcFaceBound> bFaceBounds = b.Bounds.ToList();

            for (int i = 0; i < aFaceBounds.Count; i++)
            {
                if (!(aFaceBounds[i].GeometricEquals(bFaceBounds[i])))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 6
0
        protected BbFace(IList <BbCoordinate3D> points)
        {
            List <IfcCartesianPoint> cPoints = new List <IfcCartesianPoint> ();

            foreach (var p in points)
            {
                cPoints.Add(p.IfcCartesianPoint);
            }

            IfcPolyLoop ifcPolyLoop = new IfcPolyLoop {
                Polygon = cPoints,
            };
            IfcFaceOuterBound ifFaceBound = new IfcFaceOuterBound {
                Bound       = ifcPolyLoop,
                Orientation = true,
            };

            IfcFace = new IfcFace {
                Bounds = new List <IfcFaceBound>()
                {
                    ifFaceBound
                },
            };
        }
Exemplo n.º 7
0
 public IfcTextureMap(IfcSurfaceTexture[] __Maps, IfcTextureVertex[] __Vertices, IfcFace __MappedTo)
     : base(__Maps)
 {
     this._Vertices = new List <IfcTextureVertex>(__Vertices);
     this._MappedTo = __MappedTo;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Calculates the maximum number of points in this object, does not remove geometric duplicates
 /// </summary>
 /// <param name="face"></param>
 /// <returns></returns>
 public static int NumberOfPointsMax(this IfcFace face)
 {
     return(face.Bounds.Sum(bound => bound.NumberOfPointsMax()));
 }